diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-11-09 17:34:08 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2020-11-19 12:50:12 +0100 |
commit | fdcfd854333be5b30377dc5daa9cd0fa1643a979 (patch) | |
tree | 89b755560a425f0eb332a86037e2b6d429b7fb5a /drivers/rtc/rtc-aspeed.c | |
parent | 6746bc095bbd1da719aadd9a11fe2c75a12f22e0 (diff) | |
download | lwn-fdcfd854333be5b30377dc5daa9cd0fa1643a979.tar.gz lwn-fdcfd854333be5b30377dc5daa9cd0fa1643a979.zip |
rtc: rework rtc_register_device() resource management
rtc_register_device() is a managed interface but it doesn't use devres
by itself - instead it marks an rtc_device as "registered" and the devres
callback for devm_rtc_allocate_device() takes care of resource release.
This doesn't correspond with the design behind devres where managed
structures should not be aware of being managed. The correct solution
here is to register a separate devres callback for unregistering the
device.
While at it: rename rtc_register_device() to devm_rtc_register_device()
and add it to the list of managed interfaces in devres.rst. This way we
can avoid any potential confusion of driver developers who may expect
there to exist a corresponding unregister function.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl
Diffstat (limited to 'drivers/rtc/rtc-aspeed.c')
-rw-r--r-- | drivers/rtc/rtc-aspeed.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-aspeed.c b/drivers/rtc/rtc-aspeed.c index eacdd0637cce..a93352ed3aec 100644 --- a/drivers/rtc/rtc-aspeed.c +++ b/drivers/rtc/rtc-aspeed.c @@ -104,7 +104,7 @@ static int aspeed_rtc_probe(struct platform_device *pdev) rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; rtc->rtc_dev->range_max = 38814989399LL; /* 3199-12-31 23:59:59 */ - return rtc_register_device(rtc->rtc_dev); + return devm_rtc_register_device(rtc->rtc_dev); } static const struct of_device_id aspeed_rtc_match[] = { |