Skip to content

Commit 0fedce7

Browse files
Anthony Pighin (Nokia)alexandrebelloni
authored andcommitted
rtc: abx80x: Disable alarm feature if no interrupt attached
Commit 795cda8 ("rtc: interface: Fix long-standing race when setting alarm") exposed an issue where the rtc-abx80x driver does not clear the alarm feature bit, but instead relies on the set_alarm operation to return invalid. For example, when a RTC_UIE_ON ioctl is handled, it should abort at the feature validation. Instead, it proceeds to the rtc_timer_enqueue(), which used to return an error from the set_alarm call. However, following the race condition handling, which likely should not be discarding predecing errors, a success condition is returned to the ioctl() caller. This results in (for example): hwclock: select() to /dev/rtc0 to wait for clock tick timed out Notwithstanding the validity of the race condition handling, if an interrupt wasn't specified, or could not be attached, the driver should clear the alarm feature bit. Fixes: 718a820 ("rtc: abx80x: add alarm support") Signed-off-by: Anthony Pighin <anthony.pighin@nokia.com> Link: https://patch.msgid.link/BN0PR08MB69510928028C933749F4139383D1A@BN0PR08MB6951.namprd08.prod.outlook.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 30c4d2f commit 0fedce7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/rtc/rtc-abx80x.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,8 @@ static int abx80x_probe(struct i2c_client *client)
932932
client->irq = 0;
933933
}
934934
}
935+
if (client->irq <= 0)
936+
clear_bit(RTC_FEATURE_ALARM, priv->rtc->features);
935937

936938
err = rtc_add_group(priv->rtc, &rtc_calib_attr_group);
937939
if (err) {

0 commit comments

Comments
 (0)