Skip to content

Commit

Permalink
rtc: max31335: remove unecessary locking
Browse files Browse the repository at this point in the history
There is no race condition when accessing MAX31335_STATUS1 because it is
always about clearing the alarm interrupt bit.

Reviewed-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20240115232215.273374-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
  • Loading branch information
alexandrebelloni committed Jan 17, 2024
1 parent dedaf03 commit 590b1d1
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions drivers/rtc/rtc-max31335.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,27 +348,19 @@ 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;
struct mutex *lock = &max31335->rtc->ops_lock;
int ret, status;

mutex_lock(lock);

ret = regmap_read(max31335->regmap, MAX31335_STATUS1, &status);
if (ret)
goto exit;
return IRQ_HANDLED;

if (FIELD_GET(MAX31335_STATUS1_A1F, status)) {
ret = regmap_update_bits(max31335->regmap, MAX31335_STATUS1,
MAX31335_STATUS1_A1F, 0);
if (ret)
goto exit;
regmap_update_bits(max31335->regmap, MAX31335_STATUS1,
MAX31335_STATUS1_A1F, 0);

rtc_update_irq(max31335->rtc, 1, RTC_AF | RTC_IRQF);
}

exit:
mutex_unlock(lock);

return IRQ_HANDLED;
}

Expand Down

0 comments on commit 590b1d1

Please sign in to comment.