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

Subsystems: char and misc drivers, the rest

STALE3857d

3 messages, 3 authors, 2016-01-13 · open the first message on its own page

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

From: Geliang Tang <hidden>
Date: 2016-01-13 15:31:43

Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <redacted>
---
 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

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

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-01-13 21:19:45

On Wed, 2016-01-13 at 23:30 +0800, Geliang Tang wrote:
Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <redacted>
---
 drivers/misc/cxl/sysfs.c | 5 ++---
Looks fine. Do you want me to merge it or just ack it?

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

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

From: Andrew Donnellan <hidden>
Date: 2016-01-13 23:02:20

On 14/01/16 02:30, Geliang Tang wrote:
Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <redacted>
Good simplification.

Reviewed-by: Andrew Donnellan <redacted>

-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help