rtc: ds1305: use to_spi_device and kobj_to_dev
authorGeliang Tang <geliangtang@163.com>
Wed, 23 Dec 2015 12:54:33 +0000 (20:54 +0800)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 4 Feb 2016 22:44:16 +0000 (23:44 +0100)
For better readability, use to_spi_device() and kobj_to_dev() instead
of container_of().

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1305.c

index f39691eea7360272f6c7449a2d25202e6c4106b3..8e41c4613e5135cbd4db573586f85ef60678447e 100644 (file)
@@ -532,7 +532,7 @@ ds1305_nvram_read(struct file *filp, struct kobject *kobj,
        struct spi_transfer     x[2];
        int                     status;
 
-       spi = container_of(kobj, struct spi_device, dev.kobj);
+       spi = to_spi_device(kobj_to_dev(kobj));
 
        addr = DS1305_NVRAM + off;
        msg_init(&m, x, &addr, count, NULL, buf);
@@ -554,7 +554,7 @@ ds1305_nvram_write(struct file *filp, struct kobject *kobj,
        struct spi_transfer     x[2];
        int                     status;
 
-       spi = container_of(kobj, struct spi_device, dev.kobj);
+       spi = to_spi_device(kobj_to_dev(kobj));
 
        addr = (DS1305_WRITE | DS1305_NVRAM) + off;
        msg_init(&m, x, &addr, count, buf, NULL);