misc: c2port: use kobj_to_dev()
authorGeliang Tang <geliangtang@163.com>
Wed, 13 Jan 2016 15:30:08 +0000 (23:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 07:01:45 +0000 (23:01 -0800)
Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/c2port/core.c

index cc8645b5369d315afad0296ba4f5a5bd5a99ada8..1922cb8f6b88f3d408439cc6dd0fda8b5af54092 100644 (file)
@@ -721,9 +721,7 @@ static ssize_t c2port_read_flash_data(struct file *filp, struct kobject *kobj,
                                struct bin_attribute *attr,
                                char *buffer, loff_t offset, size_t count)
 {
-       struct c2port_device *c2dev =
-                       dev_get_drvdata(container_of(kobj,
-                                               struct device, kobj));
+       struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
        ssize_t ret;
 
        /* Check the device and flash access status */
@@ -838,9 +836,7 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
                                struct bin_attribute *attr,
                                char *buffer, loff_t offset, size_t count)
 {
-       struct c2port_device *c2dev =
-                       dev_get_drvdata(container_of(kobj,
-                                               struct device, kobj));
+       struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
        int ret;
 
        /* Check the device access status */