Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1682272
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 09/11] rtc: ds1307: switch to rtc_register_device |
| Date | 2017-07-06 11:50 +0200 |
| Message-ID | <u0bA6-2xi-31@gated-at.bofh.it> (permalink) |
| References | <u0bA5-2xi-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This removes a possible race condition and crash and allows for further
improvement of the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/rtc/rtc-ds1307.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 43e9dc6f2edc..bac920a50ece 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1663,8 +1663,8 @@ static int ds1307_probe(struct i2c_client *client,
device_set_wakeup_capable(ds1307->dev, true);
set_bit(HAS_ALARM, &ds1307->flags);
}
- ds1307->rtc = devm_rtc_device_register(ds1307->dev, ds1307->name,
- rtc_ops, THIS_MODULE);
+
+ ds1307->rtc = devm_rtc_allocate_device(ds1307->dev);
if (IS_ERR(ds1307->rtc)) {
return PTR_ERR(ds1307->rtc);
}
@@ -1726,6 +1726,11 @@ static int ds1307_probe(struct i2c_client *client,
}
}
+ ds1307->rtc->ops = rtc_ops;
+ err = rtc_register_device(ds1307->rtc);
+ if (err)
+ return err;
+
ds1307_hwmon_register(ds1307);
ds1307_clks_register(ds1307);
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/11] RTC: rework registration Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 07/11] rtc: rv8803: use generic nvmem support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 04/11] rtc: at91rm9200: remove race condition Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 11/11] rtc: ds1307: remove ds1307_remove Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 09/11] rtc: ds1307: switch to rtc_register_device Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 03/11] rtc: introduce new registration method Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 06/11] rtc: rv8803: switch to rtc_register_device Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 02/11] rtc: class separate id allocation from registration Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 01/11] rtc: class separate device allocation from registration Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 05/11] rtc: add generic nvmem support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200 [PATCH 08/11] rtc: rv8803: remove rv8803_remove Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-06 11:50 +0200
csiph-web