aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpiolib.c2
-rw-r--r--drivers/md/bitmap.c4
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/md.h2
-rw-r--r--fs/sysfs/dir.c11
-rw-r--r--fs/sysfs/file.c4
-rw-r--r--fs/sysfs/group.c10
-rw-r--r--fs/sysfs/symlink.c2
-rw-r--r--fs/sysfs/sysfs.h3
-rw-r--r--include/linux/sysfs.h19
10 files changed, 31 insertions, 28 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 86ef3461ec06..a094356020a6 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -408,7 +408,7 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
408 IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING; 408 IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
409 409
410 if (!value_sd) { 410 if (!value_sd) {
411 value_sd = sysfs_get_dirent(dev->kobj.sd, NULL, "value"); 411 value_sd = sysfs_get_dirent(dev->kobj.sd, "value");
412 if (!value_sd) { 412 if (!value_sd) {
413 ret = -ENODEV; 413 ret = -ENODEV;
414 goto err_out; 414 goto err_out;
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)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 1dfb4aaf9446..fee19d16e4a2 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -630,9 +630,10 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
630} 630}
631 631
632/** 632/**
633 * sysfs_get_dirent - find and get sysfs_dirent with the given name 633 * sysfs_get_dirent_ns - find and get sysfs_dirent with the given name
634 * @parent_sd: sysfs_dirent to search under 634 * @parent_sd: sysfs_dirent to search under
635 * @name: name to look for 635 * @name: name to look for
636 * @ns: the namespace tag to use
636 * 637 *
637 * Look for sysfs_dirent with name @name under @parent_sd and get 638 * Look for sysfs_dirent with name @name under @parent_sd and get
638 * it if found. 639 * it if found.
@@ -643,9 +644,9 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
643 * RETURNS: 644 * RETURNS:
644 * Pointer to sysfs_dirent if found, NULL if not. 645 * Pointer to sysfs_dirent if found, NULL if not.
645 */ 646 */
646struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 647struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
647 const void *ns, 648 const unsigned char *name,
648 const unsigned char *name) 649 const void *ns)
649{ 650{
650 struct sysfs_dirent *sd; 651 struct sysfs_dirent *sd;
651 652
@@ -656,7 +657,7 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
656 657
657 return sd; 658 return sd;
658} 659}
659EXPORT_SYMBOL_GPL(sysfs_get_dirent); 660EXPORT_SYMBOL_GPL(sysfs_get_dirent_ns);
660 661
661static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, 662static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd,
662 const void *ns, const char *name, struct sysfs_dirent **p_sd) 663 const void *ns, const char *name, struct sysfs_dirent **p_sd)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index e784340f1599..0f3214a70985 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -563,7 +563,7 @@ int sysfs_add_file_to_group(struct kobject *kobj,
563 int error; 563 int error;
564 564
565 if (group) 565 if (group)
566 dir_sd = sysfs_get_dirent(kobj->sd, NULL, group); 566 dir_sd = sysfs_get_dirent(kobj->sd, group);
567 else 567 else
568 dir_sd = sysfs_get(kobj->sd); 568 dir_sd = sysfs_get(kobj->sd);
569 569
@@ -645,7 +645,7 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
645 struct sysfs_dirent *dir_sd; 645 struct sysfs_dirent *dir_sd;
646 646
647 if (group) 647 if (group)
648 dir_sd = sysfs_get_dirent(kobj->sd, NULL, group); 648 dir_sd = sysfs_get_dirent(kobj->sd, group);
649 else 649 else
650 dir_sd = sysfs_get(kobj->sd); 650 dir_sd = sysfs_get(kobj->sd);
651 if (dir_sd) { 651 if (dir_sd) {
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index 25c78f23dae8..21102158ca33 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -207,7 +207,7 @@ void sysfs_remove_group(struct kobject *kobj,
207 struct sysfs_dirent *sd; 207 struct sysfs_dirent *sd;
208 208
209 if (grp->name) { 209 if (grp->name) {
210 sd = sysfs_get_dirent(dir_sd, NULL, grp->name); 210 sd = sysfs_get_dirent(dir_sd, grp->name);
211 if (!sd) { 211 if (!sd) {
212 WARN(!sd, KERN_WARNING 212 WARN(!sd, KERN_WARNING
213 "sysfs group %p not found for kobject '%s'\n", 213 "sysfs group %p not found for kobject '%s'\n",
@@ -262,7 +262,7 @@ int sysfs_merge_group(struct kobject *kobj,
262 struct attribute *const *attr; 262 struct attribute *const *attr;
263 int i; 263 int i;
264 264
265 dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); 265 dir_sd = sysfs_get_dirent(kobj->sd, grp->name);
266 if (!dir_sd) 266 if (!dir_sd)
267 return -ENOENT; 267 return -ENOENT;
268 268
@@ -289,7 +289,7 @@ void sysfs_unmerge_group(struct kobject *kobj,
289 struct sysfs_dirent *dir_sd; 289 struct sysfs_dirent *dir_sd;
290 struct attribute *const *attr; 290 struct attribute *const *attr;
291 291
292 dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); 292 dir_sd = sysfs_get_dirent(kobj->sd, grp->name);
293 if (dir_sd) { 293 if (dir_sd) {
294 for (attr = grp->attrs; *attr; ++attr) 294 for (attr = grp->attrs; *attr; ++attr)
295 sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); 295 sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name);
@@ -311,7 +311,7 @@ int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name,
311 struct sysfs_dirent *dir_sd; 311 struct sysfs_dirent *dir_sd;
312 int error = 0; 312 int error = 0;
313 313
314 dir_sd = sysfs_get_dirent(kobj->sd, NULL, group_name); 314 dir_sd = sysfs_get_dirent(kobj->sd, group_name);
315 if (!dir_sd) 315 if (!dir_sd)
316 return -ENOENT; 316 return -ENOENT;
317 317
@@ -333,7 +333,7 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
333{ 333{
334 struct sysfs_dirent *dir_sd; 334 struct sysfs_dirent *dir_sd;
335 335
336 dir_sd = sysfs_get_dirent(kobj->sd, NULL, group_name); 336 dir_sd = sysfs_get_dirent(kobj->sd, group_name);
337 if (dir_sd) { 337 if (dir_sd) {
338 sysfs_hash_and_remove(dir_sd, NULL, link_name); 338 sysfs_hash_and_remove(dir_sd, NULL, link_name);
339 sysfs_put(dir_sd); 339 sysfs_put(dir_sd);
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index 7d981ce2e87f..c96b31a16485 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -191,7 +191,7 @@ int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *targ,
191 old_ns = targ->sd->s_ns; 191 old_ns = targ->sd->s_ns;
192 192
193 result = -ENOENT; 193 result = -ENOENT;
194 sd = sysfs_get_dirent(parent_sd, old_ns, old); 194 sd = sysfs_get_dirent_ns(parent_sd, old, old_ns);
195 if (!sd) 195 if (!sd)
196 goto out; 196 goto out;
197 197
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 7664d1b3d594..6faacafda777 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -164,9 +164,6 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);
164struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, 164struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
165 const void *ns, 165 const void *ns,
166 const unsigned char *name); 166 const unsigned char *name);
167struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
168 const void *ns,
169 const unsigned char *name);
170struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type); 167struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type);
171 168
172void release_sysfs_dirent(struct sysfs_dirent *sd); 169void release_sysfs_dirent(struct sysfs_dirent *sd);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index c792f73ac7fa..6695040a0317 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -245,9 +245,9 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
245 245
246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
247void sysfs_notify_dirent(struct sysfs_dirent *sd); 247void sysfs_notify_dirent(struct sysfs_dirent *sd);
248struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 248struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
249 const void *ns, 249 const unsigned char *name,
250 const unsigned char *name); 250 const void *ns);
251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
252void sysfs_put(struct sysfs_dirent *sd); 252void sysfs_put(struct sysfs_dirent *sd);
253 253
@@ -422,10 +422,9 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) 422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
423{ 423{
424} 424}
425static inline 425static inline struct sysfs_dirent *
426struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 426sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
427 const void *ns, 427 const void *ns)
428 const unsigned char *name)
429{ 428{
430 return NULL; 429 return NULL;
431} 430}
@@ -462,4 +461,10 @@ static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target
462 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL); 461 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
463} 462}
464 463
464static inline struct sysfs_dirent *
465sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name)
466{
467 return sysfs_get_dirent_ns(parent_sd, name, NULL);
468}
469
465#endif /* _SYSFS_H_ */ 470#endif /* _SYSFS_H_ */