sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minor
[linux-2.6.git] / drivers / base / class.c
index e085af0..71ce3ff 100644 (file)
@@ -148,6 +148,10 @@ int class_register(struct class *cls)
        if (error)
                return error;
 
+       /* set the default /sys/dev directory for devices of this class */
+       if (!cls->dev_kobj)
+               cls->dev_kobj = sysfs_dev_char_kobj;
+
 #if defined(CONFIG_SYSFS_DEPRECATED) && defined(CONFIG_BLOCK)
        /* let the block class directory show up in the root of sysfs */
        if (cls != &block_class)