Skip to content

Commit

Permalink
rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag
Browse files Browse the repository at this point in the history
The IRQF_NO_SUSPEND flag is used to identify the interrupts that should
be left enabled so as to allow them to work as expected during the
suspend-resume cycle, but doesn't guarantee that it will wake the system
from a suspended state, enable_irq_wake is recommended to be used for
the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly
introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: rtc-linux@googlegroups.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
  • Loading branch information
Sudeep Holla authored and Alexandre Belloni committed Nov 8, 2015
1 parent 93a6f91 commit caff0cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/rtc/rtc-ds1343.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/pm.h>
#include <linux/pm_wakeirq.h>
#include <linux/slab.h>

#define DS1343_DRV_VERSION "01.00"
Expand Down Expand Up @@ -663,15 +664,15 @@ static int ds1343_probe(struct spi_device *spi)

if (priv->irq >= 0) {
res = devm_request_threaded_irq(&spi->dev, spi->irq, NULL,
ds1343_thread,
IRQF_NO_SUSPEND | IRQF_ONESHOT,
ds1343_thread, IRQF_ONESHOT,
"ds1343", priv);
if (res) {
priv->irq = -1;
dev_err(&spi->dev,
"unable to request irq for rtc ds1343\n");
} else {
device_set_wakeup_capable(&spi->dev, 1);
device_init_wakeup(&spi->dev, true);
dev_pm_set_wake_irq(&spi->dev, spi->irq);
}
}

Expand All @@ -692,6 +693,8 @@ static int ds1343_remove(struct spi_device *spi)
priv->irqen &= ~RTC_AF;
mutex_unlock(&priv->mutex);

dev_pm_clear_wake_irq(&spi->dev);
device_init_wakeup(&spi->dev, false);
devm_free_irq(&spi->dev, spi->irq, priv);
}

Expand Down

0 comments on commit caff0cc

Please sign in to comment.