pch_phub: use kobj_to_dev()
authorGeliang Tang <geliangtang@163.com>
Wed, 13 Jan 2016 15:30:10 +0000 (23:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 22:57:30 +0000 (14:57 -0800)
Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/pch_phub.c

index 9a17a9bab8d6c980b2e23787c2fc0dbf6807e3c7..15bb0c8cdda38b1b788993a78a68196a22c8f74b 100644 (file)
@@ -503,8 +503,7 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
        int err;
        ssize_t rom_size;
 
-       struct pch_phub_reg *chip =
-               dev_get_drvdata(container_of(kobj, struct device, kobj));
+       struct pch_phub_reg *chip = dev_get_drvdata(kobj_to_dev(kobj));
 
        ret = mutex_lock_interruptible(&pch_phub_mutex);
        if (ret) {
@@ -567,8 +566,7 @@ static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj,
        unsigned int addr_offset;
        int ret;
        ssize_t rom_size;
-       struct pch_phub_reg *chip =
-               dev_get_drvdata(container_of(kobj, struct device, kobj));
+       struct pch_phub_reg *chip = dev_get_drvdata(kobj_to_dev(kobj));
 
        ret = mutex_lock_interruptible(&pch_phub_mutex);
        if (ret)