Linux-RTC Archive mirror
 help / color / mirror / Atom feed
From: "Miclaus, Antoniu" <Antoniu.Miclaus@analog.com>
To: "alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>
Cc: "linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/2] rtc: max31335: use regmap_update_bits_check
Date: Tue, 16 Jan 2024 10:48:06 +0000	[thread overview]
Message-ID: <CY4PR03MB33993A5FF5F4B8C27E3DA2939B732@CY4PR03MB3399.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20240115232215.273374-2-alexandre.belloni@bootlin.com>

> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> Simplify the IRQ handler by using regmap_update_bits_check.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Reviewed-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
>  drivers/rtc/rtc-max31335.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-max31335.c b/drivers/rtc/rtc-max31335.c
> index 2ce23f60a7f3..a38d303d9df4 100644
> --- a/drivers/rtc/rtc-max31335.c
> +++ b/drivers/rtc/rtc-max31335.c
> @@ -348,18 +348,16 @@ static int max31335_alarm_irq_enable(struct device
> *dev, unsigned int enabled)
>  static irqreturn_t max31335_handle_irq(int irq, void *dev_id)
>  {
>  	struct max31335_data *max31335 = dev_id;
> -	int ret, status;
> +	bool status;
> +	int ret;
> 
> -	ret = regmap_read(max31335->regmap, MAX31335_STATUS1,
> &status);
> +	ret = regmap_update_bits_check(max31335->regmap,
> MAX31335_STATUS1,
> +				       MAX31335_STATUS1_A1F, 0, &status);
>  	if (ret)
>  		return IRQ_HANDLED;
> 
> -	if (FIELD_GET(MAX31335_STATUS1_A1F, status)) {
> -		regmap_update_bits(max31335->regmap,
> MAX31335_STATUS1,
> -				   MAX31335_STATUS1_A1F, 0);
> -
> +	if (status)
>  		rtc_update_irq(max31335->rtc, 1, RTC_AF | RTC_IRQF);
> -	}
> 
>  	return IRQ_HANDLED;
>  }
> --
> 2.43.0


  reply	other threads:[~2024-01-16 10:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 23:22 [PATCH 1/2] rtc: max31335: remove unecessary locking alexandre.belloni
2024-01-15 23:22 ` [PATCH 2/2] rtc: max31335: use regmap_update_bits_check alexandre.belloni
2024-01-16 10:48   ` Miclaus, Antoniu [this message]
2024-01-16 10:47 ` [PATCH 1/2] rtc: max31335: remove unecessary locking Miclaus, Antoniu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR03MB33993A5FF5F4B8C27E3DA2939B732@CY4PR03MB3399.namprd03.prod.outlook.com \
    --to=antoniu.miclaus@analog.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).