From: Geliang Tang Date: Wed, 13 Jan 2016 15:30:09 +0000 (+0800) Subject: misc: cxl: use kobj_to_dev() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=85016ff33f359981a8c78a1eb67b04777207775c;p=openwrt%2Fstaging%2Fblogic.git misc: cxl: use kobj_to_dev() Use kobj_to_dev() instead of open-coding it. Signed-off-by: Geliang Tang Reviewed-by: Andrew Donnellan Acked-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c index 02006f7109a8..038af5d45145 100644 --- a/drivers/misc/cxl/sysfs.c +++ b/drivers/misc/cxl/sysfs.c @@ -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;