Skip to content

Commit b7d450d

Browse files
rtc: max31335: use regmap_update_bits_check
Simplify the IRQ handler by using regmap_update_bits_check. Reviewed-by: Antoniu Miclaus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 590b1d1 commit b7d450d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/rtc/rtc-max31335.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,16 @@ static int max31335_alarm_irq_enable(struct device *dev, unsigned int enabled)
348348
static irqreturn_t max31335_handle_irq(int irq, void *dev_id)
349349
{
350350
struct max31335_data *max31335 = dev_id;
351-
int ret, status;
351+
bool status;
352+
int ret;
352353

353-
ret = regmap_read(max31335->regmap, MAX31335_STATUS1, &status);
354+
ret = regmap_update_bits_check(max31335->regmap, MAX31335_STATUS1,
355+
MAX31335_STATUS1_A1F, 0, &status);
354356
if (ret)
355357
return IRQ_HANDLED;
356358

357-
if (FIELD_GET(MAX31335_STATUS1_A1F, status)) {
358-
regmap_update_bits(max31335->regmap, MAX31335_STATUS1,
359-
MAX31335_STATUS1_A1F, 0);
360-
359+
if (status)
361360
rtc_update_irq(max31335->rtc, 1, RTC_AF | RTC_IRQF);
362-
}
363361

364362
return IRQ_HANDLED;
365363
}

0 commit comments

Comments
 (0)