diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2018-03-05 10:43:53 +0000 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-03-17 14:20:53 +0100 |
commit | 9d327c2d929161a6ca4d7ca0672414cc72100659 (patch) | |
tree | b1000f790a34fe93aa371f009be230f1ef88c97a /drivers/rtc/rtc-isl1208.c | |
parent | 72dd71f0dae47183efdf92279927ff26f0ed9f3f (diff) | |
download | linux-9d327c2d929161a6ca4d7ca0672414cc72100659.tar.gz linux-9d327c2d929161a6ca4d7ca0672414cc72100659.tar.bz2 linux-9d327c2d929161a6ca4d7ca0672414cc72100659.zip |
rtc: isl1208: enable interrupt after context preparation
The interrupt handler got enabled very early. If the interrupt cause is
triggering immediately before the context is fully prepared. This can
lead to undefined behaviour. Therefor we move the interrupt enable code
to the end of the probe function.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-isl1208.c')
-rw-r--r-- | drivers/rtc/rtc-isl1208.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index c8b495348229..a13a4ba79004 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -635,23 +635,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) if (isl1208_i2c_validate_client(client) < 0) return -ENODEV; - if (client->irq > 0) { - rc = devm_request_threaded_irq(&client->dev, client->irq, NULL, - isl1208_rtc_interrupt, - IRQF_SHARED | IRQF_ONESHOT, - isl1208_driver.driver.name, - client); - if (!rc) { - device_init_wakeup(&client->dev, 1); - enable_irq_wake(client->irq); - } else { - dev_err(&client->dev, - "Unable to request irq %d, no alarm support\n", - client->irq); - client->irq = 0; - } - } - rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name, &isl1208_rtc_ops, THIS_MODULE); @@ -674,6 +657,23 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) if (rc) return rc; + if (client->irq > 0) { + rc = devm_request_threaded_irq(&client->dev, client->irq, NULL, + isl1208_rtc_interrupt, + IRQF_SHARED | IRQF_ONESHOT, + isl1208_driver.driver.name, + client); + if (!rc) { + device_init_wakeup(&client->dev, 1); + enable_irq_wake(client->irq); + } else { + dev_err(&client->dev, + "Unable to request irq %d, no alarm support\n", + client->irq); + client->irq = 0; + } + } + return 0; } |