rapidio: use kobj_to_dev()
authorGeliang Tang <geliangtang@163.com>
Wed, 20 Jan 2016 23:00:39 +0000 (15:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 21 Jan 2016 01:09:18 +0000 (17:09 -0800)
Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: "Bounine, Alexandre" <Alexandre.Bounine@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rapidio/rio-sysfs.c

index cdb005c0094df0b58362db0e6a4b462afd2f0621..eda41563d06d8a1f0e1fa65267fb9441bdf75b30 100644 (file)
@@ -125,8 +125,7 @@ rio_read_config(struct file *filp, struct kobject *kobj,
                struct bin_attribute *bin_attr,
                char *buf, loff_t off, size_t count)
 {
-       struct rio_dev *dev =
-           to_rio_dev(container_of(kobj, struct device, kobj));
+       struct rio_dev *dev = to_rio_dev(kobj_to_dev(kobj));
        unsigned int size = 0x100;
        loff_t init_off = off;
        u8 *data = (u8 *) buf;
@@ -197,8 +196,7 @@ rio_write_config(struct file *filp, struct kobject *kobj,
                 struct bin_attribute *bin_attr,
                 char *buf, loff_t off, size_t count)
 {
-       struct rio_dev *dev =
-           to_rio_dev(container_of(kobj, struct device, kobj));
+       struct rio_dev *dev = to_rio_dev(kobj_to_dev(kobj));
        unsigned int size = count;
        loff_t init_off = off;
        u8 *data = (u8 *) buf;