[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<CY4PR03MB33993A5FF5F4B8C27E3DA2939B732@CY4PR03MB3399.namprd03.prod.outlook.com>
Date: Tue, 16 Jan 2024 10:48:06 +0000
From: "Miclaus, Antoniu" <Antoniu.Miclaus@...log.com>
To: "alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>
CC: "linux-rtc@...r.kernel.org" <linux-rtc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] rtc: max31335: use regmap_update_bits_check
> From: Alexandre Belloni <alexandre.belloni@...tlin.com>
>
> Simplify the IRQ handler by using regmap_update_bits_check.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...tlin.com>
Reviewed-by: Antoniu Miclaus <antoniu.miclaus@...log.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
Powered by blists - more mailing lists