Skip to contentSkip to conversation

docs: filesystems: replace to_dev() with kobj_to_dev()

PATCH Applied Denis Efremov 2 participants 2 messages Aug 30, 2020 – Sep 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: filesystems: replace to_dev() with kobj_to_dev()

Commit a4232963757e ("driver-core: Move kobj_to_dev from genhd.h to device.h") introduced kobj_to_dev() function.

---
 Documentation/filesystems/sysfs.rst                    | 3 +--
 Documentation/translations/zh_CN/filesystems/sysfs.txt | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
Documentation/filesystems/sysfs.rst +1 -2
index ab0f7795792b..5a3209a4cebf 100644
@@ -172,14 +172,13 @@ calls the associated methods.
 
 To illustrate::
 
-    #define to_dev(obj) container_of(obj, struct device, kobj)
     #define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
 
     static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
 				char *buf)
     {
 	    struct device_attribute *dev_attr = to_dev_attr(attr);
-	    struct device *dev = to_dev(kobj);
+	    struct device *dev = kobj_to_dev(kobj);
 	    ssize_t ret = -EIO;
 
 	    if (dev_attr->show)
Documentation/translations/zh_CN/filesystems/sysfs.txt +1 -2
index 9481e3ed2a06..046cc1d52058 100644
@@ -154,14 +154,13 @@ sysfs 会为这个类型调用适当的方法。当一个文件被读写时,
 
 示例:
 
-#define to_dev(obj) container_of(obj, struct device, kobj)
 #define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
 
 static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
                              char *buf)
 {
         struct device_attribute *dev_attr = to_dev_attr(attr);
-        struct device *dev = to_dev(kobj);
+        struct device *dev = kobj_to_dev(kobj);
         ssize_t ret = -EIO;
 
         if (dev_attr->show)
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 17 lines · On Sun, 30 Aug 2020 17:41:35 +0300 Denis Efremov <[email protected]> wrote:

Commit a4232963757e ("driver-core: Move kobj_to_dev from genhd.h to device.h") introduced kobj_to_dev() function.

---
 Documentation/filesystems/sysfs.rst                    | 3 +--
 Documentation/translations/zh_CN/filesystems/sysfs.txt | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
Documentation/filesystems/sysfs.rst +0 -0
index ab0f7795792b..5a3209a4cebf 100644
@@ -172,14 +172,13 @@ calls the associated methods.
 
 To illustrate::
 

Documentation/filesystems/sysfs.rst calls the associated methods. · line 182

Quoted 10 lines
Documentation/filesystems/sysfs.rst +1 -2
-    #define to_dev(obj) container_of(obj, struct device, kobj)
     #define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
 
     static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
 				char *buf)
     {
 	    struct device_attribute *dev_attr = to_dev_attr(attr);
-	    struct device *dev = to_dev(kobj);
+	    struct device *dev = kobj_to_dev(kobj);
 	    ssize_t ret = -EIO;

Applied, thanks.

jon