Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
[pandora-kernel.git] / drivers / base / core.c
index 6cf9069..6ed6454 100644 (file)
 #include "base.h"
 #include "power/power.h"
 
+#ifdef CONFIG_SYSFS_DEPRECATED
+#ifdef CONFIG_SYSFS_DEPRECATED_V2
+long sysfs_deprecated = 1;
+#else
+long sysfs_deprecated = 0;
+#endif
+static __init int sysfs_deprecated_setup(char *arg)
+{
+       return strict_strtol(arg, 10, &sysfs_deprecated);
+}
+early_param("sysfs.deprecated", sysfs_deprecated_setup);
+#endif
+
 int (*platform_notify)(struct device *dev) = NULL;
 int (*platform_notify_remove)(struct device *dev) = NULL;
 static struct kobject *dev_kobj;
@@ -220,7 +233,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
                                 __func__, retval);
        }
 
-       /* have the device type specific fuction add its stuff */
+       /* have the device type specific function add its stuff */
        if (dev->type && dev->type->uevent) {
                retval = dev->type->uevent(dev, env);
                if (retval)
@@ -617,14 +630,15 @@ static struct kobject *get_device_parent(struct device *dev,
                struct kobject *parent_kobj;
                struct kobject *k;
 
-#ifdef CONFIG_SYSFS_DEPRECATED
+#ifdef CONFIG_BLOCK
                /* block disks show up in /sys/block */
-               if (dev->class == &block_class) {
+               if (sysfs_deprecated && dev->class == &block_class) {
                        if (parent && parent->class == &block_class)
                                return &parent->kobj;
                        return &block_class.p->class_subsys.kobj;
                }
 #endif
+
                /*
                 * If we have no parent, we live in "virtual".
                 * Class-devices with a non class-device as parent, live
@@ -707,9 +721,9 @@ static int device_add_class_symlinks(struct device *dev)
                        goto out_subsys;
        }
 
-#ifdef CONFIG_SYSFS_DEPRECATED
+#ifdef CONFIG_BLOCK
        /* /sys/block has directories and does not need symlinks */
-       if (dev->class == &block_class)
+       if (sysfs_deprecated && dev->class == &block_class)
                return 0;
 #endif
 
@@ -738,8 +752,8 @@ static void device_remove_class_symlinks(struct device *dev)
        if (dev->parent && device_is_not_partition(dev))
                sysfs_remove_link(&dev->kobj, "device");
        sysfs_remove_link(&dev->kobj, "subsystem");
-#ifdef CONFIG_SYSFS_DEPRECATED
-       if (dev->class == &block_class)
+#ifdef CONFIG_BLOCK
+       if (sysfs_deprecated && dev->class == &block_class)
                return;
 #endif
        sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));