aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Reid <preid@electromag.com.au>2017-02-23 22:12:51 -0500
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-02-24 05:14:53 -0500
commitd4f6c6f15a1f57e10374cf1a457f4eab5933bd0c (patch)
tree38de5b6128eab750323809c445502701ca1d0ebc
parent3769a375ab8380ebecc78d0a3fe6e9079f9d6988 (diff)
rtc: ds3232: Call device_init_wakeup before device_register
The wakealarm attribute is currently not exposed in the sysfs interface as the device has not been set as doing wakealarm when device_register is called. Changing the order of the calls fixes that problem. Interrupts are cleared in check_rtc_status prior to requesting the interrupt. This is only set if an irq is defined. If irq registration fails then set wakeup_capable to false. With this change the sysfs wakealarm attribute will be left visible but it is non functional. rtcwake still returns that the device is not enabled for wakeup. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r--drivers/rtc/rtc-ds3232.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 60de3a0cc35b..9bb39a06b994 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -363,6 +363,9 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
363 if (ret) 363 if (ret)
364 return ret; 364 return ret;
365 365
366 if (ds3232->irq > 0)
367 device_init_wakeup(dev, 1);
368
366 ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops, 369 ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
367 THIS_MODULE); 370 THIS_MODULE);
368 if (IS_ERR(ds3232->rtc)) 371 if (IS_ERR(ds3232->rtc))
@@ -374,10 +377,10 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
374 IRQF_SHARED | IRQF_ONESHOT, 377 IRQF_SHARED | IRQF_ONESHOT,
375 name, dev); 378 name, dev);
376 if (ret) { 379 if (ret) {
380 device_set_wakeup_capable(dev, 0);
377 ds3232->irq = 0; 381 ds3232->irq = 0;
378 dev_err(dev, "unable to request IRQ\n"); 382 dev_err(dev, "unable to request IRQ\n");
379 } else 383 }
380 device_init_wakeup(dev, 1);
381 } 384 }
382 385
383 return 0; 386 return 0;