summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-dev.c
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2017-03-17 12:48:21 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-21 06:44:33 +0100
commitd5ed9177f64fe95d9de79e6504d41612d9127e8a (patch)
tree4381e84b391db399b9e986582fc81aadf5bee6e9 /drivers/rtc/rtc-dev.c
parentdbef390d2eb0a7b0a6be21381a326d4e13953aba (diff)
downloadtalos-obmc-linux-d5ed9177f64fe95d9de79e6504d41612d9127e8a.tar.gz
talos-obmc-linux-d5ed9177f64fe95d9de79e6504d41612d9127e8a.zip
rtc: utilize new cdev_device_add helper function
Mostly straightforward, but we had to remove the rtc_dev_add/del_device functions as they split up the cdev_add and the device_add. Doing this also revealed that there was likely another subtle bug: seeing cdev_add was done after device_register, the cdev probably was not ready before device_add when the uevent occurs. This would race with userspace, if it tried to use the device directly after the uevent. This is fixed just by using the new helper function. Another weird thing is this driver would, in some error cases, call cdev_add() without calling cdev_init. This patchset corrects this by avoiding calling cdev_add if the devt is not set. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/rtc/rtc-dev.c')
-rw-r--r--drivers/rtc/rtc-dev.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 6dc8f29697ab..e81a8711fea7 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -477,23 +477,6 @@ void rtc_dev_prepare(struct rtc_device *rtc)
cdev_init(&rtc->char_dev, &rtc_dev_fops);
rtc->char_dev.owner = rtc->owner;
- rtc->char_dev.kobj.parent = &rtc->dev.kobj;
-}
-
-void rtc_dev_add_device(struct rtc_device *rtc)
-{
- if (cdev_add(&rtc->char_dev, rtc->dev.devt, 1))
- dev_warn(&rtc->dev, "%s: failed to add char device %d:%d\n",
- rtc->name, MAJOR(rtc_devt), rtc->id);
- else
- dev_dbg(&rtc->dev, "%s: dev (%d:%d)\n", rtc->name,
- MAJOR(rtc_devt), rtc->id);
-}
-
-void rtc_dev_del_device(struct rtc_device *rtc)
-{
- if (rtc->dev.devt)
- cdev_del(&rtc->char_dev);
}
void __init rtc_dev_init(void)
OpenPOWER on IntegriCloud