aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-09-11 23:19:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 18:33:18 -0400
commit388975cccaaf11abd47525f664c76891c440481a (patch)
tree597308874997808e7621ab4a56f0b1fd201e8639 /drivers/md
parentcb26a311578e67769e92a39a0a63476533cb7e12 (diff)
sysfs: clean up sysfs_get_dirent()
The pre-existing sysfs interfaces which take explicit namespace argument are weird in that they place the optional @ns in front of @name which is contrary to the established convention. For example, we end up forcing vast majority of sysfs_get_dirent() users to do sysfs_get_dirent(parent, NULL, name), which is silly and error-prone especially as @ns and @name may be interchanged without causing compilation warning. This renames sysfs_get_dirent() to sysfs_get_dirent_ns() and swap the positions of @name and @ns, and sysfs_get_dirent() is now a wrapper around sysfs_get_dirent_ns(). This makes confusions a lot less likely. There are other interfaces which take @ns before @name. They'll be updated by following patches. This patch doesn't introduce any functional changes. v2: EXPORT_SYMBOL_GPL() wasn't updated leading to undefined symbol error on module builds. Reported by build test robot. Fixed. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c4
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/md.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index a7fd82133b12..12dc29ba7399 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1654,9 +1654,9 @@ int bitmap_create(struct mddev *mddev)
1654 bitmap->mddev = mddev; 1654 bitmap->mddev = mddev;
1655 1655
1656 if (mddev->kobj.sd) 1656 if (mddev->kobj.sd)
1657 bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap"); 1657 bm = sysfs_get_dirent(mddev->kobj.sd, "bitmap");
1658 if (bm) { 1658 if (bm) {
1659 bitmap->sysfs_can_clear = sysfs_get_dirent(bm, NULL, "can_clear"); 1659 bitmap->sysfs_can_clear = sysfs_get_dirent(bm, "can_clear");
1660 sysfs_put(bm); 1660 sysfs_put(bm);
1661 } else 1661 } else
1662 bitmap->sysfs_can_clear = NULL; 1662 bitmap->sysfs_can_clear = NULL;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index adf4d7e1d5e1..8a0d7625681c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3555,7 +3555,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
3555 printk(KERN_WARNING 3555 printk(KERN_WARNING
3556 "md: cannot register extra attributes for %s\n", 3556 "md: cannot register extra attributes for %s\n",
3557 mdname(mddev)); 3557 mdname(mddev));
3558 mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, NULL, "sync_action"); 3558 mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
3559 } 3559 }
3560 if (mddev->pers->sync_request != NULL && 3560 if (mddev->pers->sync_request != NULL &&
3561 pers->sync_request == NULL) { 3561 pers->sync_request == NULL) {
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 608050c43f17..b0051f2fbc0c 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -501,7 +501,7 @@ extern struct attribute_group md_bitmap_group;
501static inline struct sysfs_dirent *sysfs_get_dirent_safe(struct sysfs_dirent *sd, char *name) 501static inline struct sysfs_dirent *sysfs_get_dirent_safe(struct sysfs_dirent *sd, char *name)
502{ 502{
503 if (sd) 503 if (sd)
504 return sysfs_get_dirent(sd, NULL, name); 504 return sysfs_get_dirent(sd, name);
505 return sd; 505 return sd;
506} 506}
507static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd) 507static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd)