Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1308518

[PATCH 2/5] misc: cxl: use kobj_to_dev()

From Geliang Tang <geliangtang@163.com>
Newsgroups linux.kernel
Subject [PATCH 2/5] misc: cxl: use kobj_to_dev()
Date 2016-01-13 16:40 +0100
Message-ID <qQvGG-1Gf-25@gated-at.bofh.it> (permalink)
References <qQvGF-1Gf-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/misc/cxl/sysfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index 02006f71..038af5d 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;
 
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang <geliangtang@163.com> - 2016-01-13 16:40 +0100
  [PATCH 2/5] misc: cxl: use kobj_to_dev() Geliang Tang <geliangtang@163.com> - 2016-01-13 16:40 +0100
    Re: [PATCH 2/5] misc: cxl: use kobj_to_dev() Michael Ellerman <mpe@ellerman.id.au> - 2016-01-13 22:20 +0100
    Re: [PATCH 2/5] misc: cxl: use kobj_to_dev() Andrew Donnellan <andrew.donnellan@au1.ibm.com> - 2016-01-14 00:10 +0100
  [PATCH 4/5] misc: eeprom: use kobj_to_dev() Geliang Tang <geliangtang@163.com> - 2016-01-13 16:40 +0100
  Re: [PATCH 1/5] misc: c2port: use kobj_to_dev() Viresh Kumar <viresh.kumar@linaro.org> - 2016-01-14 10:50 +0100

csiph-web