rtc: sysfs: use kobj_to_dev
authorsuguosong <suguosong@xiaomi.com>
Tue, 25 Feb 2020 02:19:23 +0000 (10:19 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 16 Mar 2020 10:12:08 +0000 (11:12 +0100)
use kobj_to_dev instead of open-conding it

Signed-off-by: suguosong <suguosong@xiaomi.com>
Link: https://lore.kernel.org/r/20200225021923.8570-1-guosongsu@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/sysfs.c

index b7ca7d79fb285b072423e6919891ac96d3c9e169..950fac0d41ff9aef0050b5f75679ef46b05f665f 100644 (file)
@@ -279,7 +279,7 @@ static bool rtc_does_wakealarm(struct rtc_device *rtc)
 static umode_t rtc_attr_is_visible(struct kobject *kobj,
                                   struct attribute *attr, int n)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct rtc_device *rtc = to_rtc_device(dev);
        umode_t mode = attr->mode;