aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-27 15:12:43 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-27 18:01:38 -0500
commit4e886c29610f4374d8971ec7a248f011cc3bd73a (patch)
tree73028b1a6ae592bd1b774d98293d8c49e6c71b22
parent91525300baf162e83e923b09ca286f9205e21522 (diff)
Driver core: Fix up build when CONFIG_BLOCK=N
This fixes up the driver core build errors when CONFIG_BLOCK=N Thanks to Alexander van Heukelum <heukelum@mailshack.com> for the basis of this patch, and to Jeremy Fitzhardinge <jeremy@goop.org> for reporting the problem. Cc: Alexander van Heukelum <heukelum@mailshack.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/class.c2
-rw-r--r--drivers/base/core.c30
2 files changed, 20 insertions, 12 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 59cf35894cfc..d916bbf5b72a 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -149,7 +149,7 @@ int class_register(struct class *cls)
149 if (error) 149 if (error)
150 return error; 150 return error;
151 151
152#ifdef CONFIG_SYSFS_DEPRECATED 152#if defined(CONFIG_SYSFS_DEPRECATED) && defined(CONFIG_BLOCK)
153 /* let the block class directory show up in the root of sysfs */ 153 /* let the block class directory show up in the root of sysfs */
154 if (cls != &block_class) 154 if (cls != &block_class)
155 cls->subsys.kobj.kset = class_kset; 155 cls->subsys.kobj.kset = class_kset;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index edf3bbeb8d6a..b1727876182c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -27,9 +27,17 @@
27int (*platform_notify)(struct device *dev) = NULL; 27int (*platform_notify)(struct device *dev) = NULL;
28int (*platform_notify_remove)(struct device *dev) = NULL; 28int (*platform_notify_remove)(struct device *dev) = NULL;
29 29
30/* 30#ifdef CONFIG_BLOCK
31 * sysfs bindings for devices. 31static inline int device_is_not_partition(struct device *dev)
32 */ 32{
33 return !(dev->type == &part_type);
34}
35#else
36static inline int device_is_not_partition(struct device *dev)
37{
38 return 1;
39}
40#endif
33 41
34/** 42/**
35 * dev_driver_string - Return a device's driver name, if at all possible 43 * dev_driver_string - Return a device's driver name, if at all possible
@@ -652,14 +660,14 @@ static int device_add_class_symlinks(struct device *dev)
652#ifdef CONFIG_SYSFS_DEPRECATED 660#ifdef CONFIG_SYSFS_DEPRECATED
653 /* stacked class devices need a symlink in the class directory */ 661 /* stacked class devices need a symlink in the class directory */
654 if (dev->kobj.parent != &dev->class->subsys.kobj && 662 if (dev->kobj.parent != &dev->class->subsys.kobj &&
655 dev->type != &part_type) { 663 device_is_not_partition(dev)) {
656 error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, 664 error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
657 dev->bus_id); 665 dev->bus_id);
658 if (error) 666 if (error)
659 goto out_subsys; 667 goto out_subsys;
660 } 668 }
661 669
662 if (dev->parent && dev->type != &part_type) { 670 if (dev->parent && device_is_not_partition(dev)) {
663 struct device *parent = dev->parent; 671 struct device *parent = dev->parent;
664 char *class_name; 672 char *class_name;
665 673
@@ -688,11 +696,11 @@ static int device_add_class_symlinks(struct device *dev)
688 return 0; 696 return 0;
689 697
690out_device: 698out_device:
691 if (dev->parent && dev->type != &part_type) 699 if (dev->parent && device_is_not_partition(dev))
692 sysfs_remove_link(&dev->kobj, "device"); 700 sysfs_remove_link(&dev->kobj, "device");
693out_busid: 701out_busid:
694 if (dev->kobj.parent != &dev->class->subsys.kobj && 702 if (dev->kobj.parent != &dev->class->subsys.kobj &&
695 dev->type != &part_type) 703 device_is_not_partition(dev))
696 sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); 704 sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
697#else 705#else
698 /* link in the class directory pointing to the device */ 706 /* link in the class directory pointing to the device */
@@ -701,7 +709,7 @@ out_busid:
701 if (error) 709 if (error)
702 goto out_subsys; 710 goto out_subsys;
703 711
704 if (dev->parent && dev->type != &part_type) { 712 if (dev->parent && device_is_not_partition(dev)) {
705 error = sysfs_create_link(&dev->kobj, &dev->parent->kobj, 713 error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
706 "device"); 714 "device");
707 if (error) 715 if (error)
@@ -725,7 +733,7 @@ static void device_remove_class_symlinks(struct device *dev)
725 return; 733 return;
726 734
727#ifdef CONFIG_SYSFS_DEPRECATED 735#ifdef CONFIG_SYSFS_DEPRECATED
728 if (dev->parent && dev->type != &part_type) { 736 if (dev->parent && device_is_not_partition(dev)) {
729 char *class_name; 737 char *class_name;
730 738
731 class_name = make_class_name(dev->class->name, &dev->kobj); 739 class_name = make_class_name(dev->class->name, &dev->kobj);
@@ -737,10 +745,10 @@ static void device_remove_class_symlinks(struct device *dev)
737 } 745 }
738 746
739 if (dev->kobj.parent != &dev->class->subsys.kobj && 747 if (dev->kobj.parent != &dev->class->subsys.kobj &&
740 dev->type != &part_type) 748 device_is_not_partition(dev))
741 sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); 749 sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
742#else 750#else
743 if (dev->parent && dev->type != &part_type) 751 if (dev->parent && device_is_not_partition(dev))
744 sysfs_remove_link(&dev->kobj, "device"); 752 sysfs_remove_link(&dev->kobj, "device");
745 753
746 sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); 754 sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);