misc: cxl: use kobj_to_dev()
authorGeliang Tang <geliangtang@163.com>
Wed, 13 Jan 2016 15:30:09 +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: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/cxl/sysfs.c

index 02006f7109a802821c3134ec03ed7d8658f23da7..038af5d45145b741fbe1f421f3a0ec4e11afabaa 100644 (file)
@@ -386,8 +386,7 @@ static ssize_t afu_eb_read(struct file *filp, struct kobject *kobj,
                               struct bin_attribute *bin_attr, char *buf,
                               loff_t off, size_t count)
 {
-       struct cxl_afu *afu = to_cxl_afu(container_of(kobj,
-                                                     struct device, kobj));
+       struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj));
 
        return cxl_afu_read_err_buffer(afu, buf, off, count);
 }
@@ -467,7 +466,7 @@ static ssize_t afu_read_config(struct file *filp, struct kobject *kobj,
                               loff_t off, size_t count)
 {
        struct afu_config_record *cr = to_cr(kobj);
-       struct cxl_afu *afu = to_cxl_afu(container_of(kobj->parent, struct device, kobj));
+       struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj->parent));
 
        u64 i, j, val;
 
This page took 0.027274 seconds and 5 git commands to generate.