diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-09-12 22:14:14 +0200 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-09-12 22:14:44 +0200 |
commit | 4392ec1a6c582ee13f1e064be168f52de0a0b651 (patch) | |
tree | c55e5a8f0d3d5b9b4e19e6f5d73a6a1811bbd352 /drivers | |
parent | 749e36d0a0d725a3fc2dc8d6261557b9e06d210d (diff) | |
parent | 9612f8f503804d2fd2f63aa6ba1e58bba4612d96 (diff) | |
download | linux-4392ec1a6c582ee13f1e064be168f52de0a0b651.tar.bz2 |
Merge tag 'ib-mfd-rtc-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into rtc-next
Immutable branch between MFD and RTC due for the v4.20 merge window
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/menelaus.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c index 29b7164a823b..d28ebe7ecd21 100644 --- a/drivers/mfd/menelaus.c +++ b/drivers/mfd/menelaus.c @@ -1094,6 +1094,7 @@ static void menelaus_rtc_alarm_work(struct menelaus_chip *m) static inline void menelaus_rtc_init(struct menelaus_chip *m) { int alarm = (m->client->irq > 0); + int err; /* assume 32KDETEN pin is pulled high */ if (!(menelaus_read_reg(MENELAUS_OSC_CTRL) & 0x80)) { @@ -1101,6 +1102,12 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m) return; } + m->rtc = devm_rtc_allocate_device(&m->client->dev); + if (IS_ERR(m->rtc)) + return; + + m->rtc->ops = &menelaus_rtc_ops; + /* support RTC alarm; it can issue wakeups */ if (alarm) { if (menelaus_add_irq_work(MENELAUS_RTCALM_IRQ, @@ -1125,10 +1132,8 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m) menelaus_write_reg(MENELAUS_RTC_CTRL, m->rtc_control); } - m->rtc = rtc_device_register(DRIVER_NAME, - &m->client->dev, - &menelaus_rtc_ops, THIS_MODULE); - if (IS_ERR(m->rtc)) { + err = rtc_register_device(m->rtc); + if (err) { if (alarm) { menelaus_remove_irq_work(MENELAUS_RTCALM_IRQ); device_init_wakeup(&m->client->dev, 0); |