aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f7f906f0a2f2..2cb49a93b1e6 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -630,12 +630,14 @@ static struct kobject *get_device_parent(struct device *dev,
630 struct kobject *parent_kobj; 630 struct kobject *parent_kobj;
631 struct kobject *k; 631 struct kobject *k;
632 632
633#ifdef CONFIG_BLOCK
633 /* block disks show up in /sys/block */ 634 /* block disks show up in /sys/block */
634 if (sysfs_deprecated && dev->class == &block_class) { 635 if (sysfs_deprecated && dev->class == &block_class) {
635 if (parent && parent->class == &block_class) 636 if (parent && parent->class == &block_class)
636 return &parent->kobj; 637 return &parent->kobj;
637 return &block_class.p->class_subsys.kobj; 638 return &block_class.p->class_subsys.kobj;
638 } 639 }
640#endif
639 641
640 /* 642 /*
641 * If we have no parent, we live in "virtual". 643 * If we have no parent, we live in "virtual".
@@ -719,9 +721,11 @@ static int device_add_class_symlinks(struct device *dev)
719 goto out_subsys; 721 goto out_subsys;
720 } 722 }
721 723
724#ifdef CONFIG_BLOCK
722 /* /sys/block has directories and does not need symlinks */ 725 /* /sys/block has directories and does not need symlinks */
723 if (sysfs_deprecated && dev->class == &block_class) 726 if (sysfs_deprecated && dev->class == &block_class)
724 return 0; 727 return 0;
728#endif
725 729
726 /* link in the class directory pointing to the device */ 730 /* link in the class directory pointing to the device */
727 error = sysfs_create_link(&dev->class->p->class_subsys.kobj, 731 error = sysfs_create_link(&dev->class->p->class_subsys.kobj,
@@ -748,8 +752,10 @@ static void device_remove_class_symlinks(struct device *dev)
748 if (dev->parent && device_is_not_partition(dev)) 752 if (dev->parent && device_is_not_partition(dev))
749 sysfs_remove_link(&dev->kobj, "device"); 753 sysfs_remove_link(&dev->kobj, "device");
750 sysfs_remove_link(&dev->kobj, "subsystem"); 754 sysfs_remove_link(&dev->kobj, "subsystem");
755#ifdef CONFIG_BLOCK
751 if (sysfs_deprecated && dev->class == &block_class) 756 if (sysfs_deprecated && dev->class == &block_class)
752 return; 757 return;
758#endif
753 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev)); 759 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
754} 760}
755 761