diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-22 16:27:50 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-22 16:27:50 -0700 |
commit | 54105dbd0951eb75bb7ecb5474405d6e1e08355e (patch) | |
tree | b5ef3219bd9b075b68f80286ff0c2d74ea42444e /pending | |
parent | 6a9419213a0dc24d2a1bd90f4093480652142f33 (diff) | |
download | patches-54105dbd0951eb75bb7ecb5474405d6e1e08355e.tar.gz |
driver core work
Diffstat (limited to 'pending')
-rw-r--r-- | pending/block-make-genhd-use-the-new-class-iterator-functions.patch | 159 | ||||
-rw-r--r-- | pending/class-move-driver-core-specific-parts-to-a-private-structure.patch | 575 |
2 files changed, 0 insertions, 734 deletions
diff --git a/pending/block-make-genhd-use-the-new-class-iterator-functions.patch b/pending/block-make-genhd-use-the-new-class-iterator-functions.patch deleted file mode 100644 index 601b686f92762b..00000000000000 --- a/pending/block-make-genhd-use-the-new-class-iterator-functions.patch +++ /dev/null @@ -1,159 +0,0 @@ -From foo@baz Tue Apr 9 12:12:43 2002 -Date: Tue, 22 Jan 2008 18:17:41 -0500 -To: Greg KH <greg@kroah.com> -From: Greg Kroah-Hartman <gregkh@suse.de> -Subject: block: make genhd use the new class iterator functions - - -The block code should not be mucking around in the internals of the -struct class structure. This moves the code to use the new iterator -functions to make sure everything is properly locked. - -Note: This is still broken, the rest of the file needs to be fixed up... - -Cc: Kay Sievers <kay.sievers@vrfy.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - block/genhd.c | 108 ++++++++++++++++++++++++++++++++-------------------------- - 1 file changed, 60 insertions(+), 48 deletions(-) - ---- a/block/genhd.c -+++ b/block/genhd.c -@@ -211,58 +211,65 @@ struct gendisk *get_gendisk(dev_t devt, - } - - /* -- * print a full list of all partitions - intended for places where the root -- * filesystem can't be mounted and thus to give the victim some idea of what -- * went wrong -+ * print a partitions - intended for places where the root filesystem can't be -+ * mounted and thus to give the victim some idea of what went wrong - */ --void __init printk_all_partitions(void) -+static int printk_partition(struct device *dev, void *data) - { -- struct device *dev; - struct gendisk *sgp; - char buf[BDEVNAME_SIZE]; - int n; - -- mutex_lock(&block_class_lock); -- /* For each block device... */ -- list_for_each_entry(dev, &block_class.devices, node) { -- if (dev->type != &disk_type) -- continue; -- sgp = dev_to_disk(dev); -- /* -- * Don't show empty devices or things that have been surpressed -- */ -- if (get_capacity(sgp) == 0 || -- (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) -- continue; -+ if (dev->type != &disk_type) -+ goto exit; - -- /* -- * Note, unlike /proc/partitions, I am showing the numbers in -- * hex - the same format as the root= option takes. -- */ -- printk("%02x%02x %10llu %s", -- sgp->major, sgp->first_minor, -- (unsigned long long)get_capacity(sgp) >> 1, -- disk_name(sgp, 0, buf)); -- if (sgp->driverfs_dev != NULL && -- sgp->driverfs_dev->driver != NULL) -- printk(" driver: %s\n", -- sgp->driverfs_dev->driver->name); -- else -- printk(" (driver?)\n"); -+ sgp = dev_to_disk(dev); -+ /* -+ * Don't show empty devices or things that have been surpressed -+ */ -+ if (get_capacity(sgp) == 0 || -+ (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) -+ goto exit; - -- /* now show the partitions */ -- for (n = 0; n < sgp->minors - 1; ++n) { -- if (sgp->part[n] == NULL) -- continue; -- if (sgp->part[n]->nr_sects == 0) -- continue; -- printk(" %02x%02x %10llu %s\n", -- sgp->major, n + 1 + sgp->first_minor, -- (unsigned long long)sgp->part[n]->nr_sects >> 1, -- disk_name(sgp, n + 1, buf)); -- } -+ /* -+ * Note, unlike /proc/partitions, I am showing the numbers in -+ * hex - the same format as the root= option takes. -+ */ -+ printk("%02x%02x %10llu %s", -+ sgp->major, sgp->first_minor, -+ (unsigned long long)get_capacity(sgp) >> 1, -+ disk_name(sgp, 0, buf)); -+ if (sgp->driverfs_dev != NULL && -+ sgp->driverfs_dev->driver != NULL) -+ printk(" driver: %s\n", -+ sgp->driverfs_dev->driver->name); -+ else -+ printk(" (driver?)\n"); -+ -+ /* now show the partitions */ -+ for (n = 0; n < sgp->minors - 1; ++n) { -+ if (sgp->part[n] == NULL) -+ goto exit; -+ if (sgp->part[n]->nr_sects == 0) -+ goto exit; -+ printk(" %02x%02x %10llu %s\n", -+ sgp->major, n + 1 + sgp->first_minor, -+ (unsigned long long)sgp->part[n]->nr_sects >> 1, -+ disk_name(sgp, n + 1, buf)); - } -+exit: -+ return 0; -+} - -+/* -+ * print a full list of all partitions - intended for places where the root -+ * filesystem can't be mounted and thus to give the victim some idea of what -+ * went wrong -+ */ -+void __init printk_all_partitions(void) -+{ -+ mutex_lock(&block_class_lock); -+ class_for_each_device(&block_class, NULL, printk_partition); - mutex_unlock(&block_class_lock); - } - -@@ -623,18 +630,23 @@ void genhd_media_change_notify(struct ge - } - EXPORT_SYMBOL_GPL(genhd_media_change_notify); - -+static int match_id(struct device *dev, void *data) -+{ -+ const char *name = data; -+ if (strcmp(dev->bus_id, name) == 0) -+ return 1; -+ return 0; -+} -+ - dev_t blk_lookup_devt(const char *name) - { - struct device *dev; - dev_t devt = MKDEV(0, 0); - - mutex_lock(&block_class_lock); -- list_for_each_entry(dev, &block_class.devices, node) { -- if (strcmp(dev->bus_id, name) == 0) { -- devt = dev->devt; -- break; -- } -- } -+ dev = class_find_device(&block_class, (void *)name, match_id); -+ if (dev) -+ devt = dev->devt; - mutex_unlock(&block_class_lock); - - return devt; diff --git a/pending/class-move-driver-core-specific-parts-to-a-private-structure.patch b/pending/class-move-driver-core-specific-parts-to-a-private-structure.patch deleted file mode 100644 index e0da56e8fc0df9..00000000000000 --- a/pending/class-move-driver-core-specific-parts-to-a-private-structure.patch +++ /dev/null @@ -1,575 +0,0 @@ -erom foo@baz Tue Apr 9 12:12:43 2002 -Date: Tue, 22 Jan 2008 18:17:41 -0500 -To: Greg KH <greg@kroah.com> -From: Greg Kroah-Hartman <gregkh@suse.de> -Subject: class: move driver core specific parts to a private structure - -This moves the portions of struct class that are dynamic (kobject and -lock and lists) out of the main structure and into a dymamic, private, -structure. - -Note, right now this breaks the genhd.c code badly, hopefully Kay can -fix this up for me :) - - -Cc: Kay Sievers <kay.sievers@vrfy.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/base/base.h | 28 ++++++++++ - drivers/base/class.c | 130 +++++++++++++++++++++++++++---------------------- - drivers/base/core.c | 46 +++++++++-------- - include/linux/device.h | 9 +-- - 4 files changed, 127 insertions(+), 86 deletions(-) - ---- a/drivers/base/base.h -+++ b/drivers/base/base.h -@@ -36,6 +36,34 @@ struct driver_private { - }; - #define to_driver(obj) container_of(obj, struct driver_private, kobj) - -+ -+/** -+ * struct class_private - structure to hold the private to the driver core portions of the class structure. -+ * -+ * @subsys - the struct kset that defines this class. This is the main kobject -+ * @children - list of class_devices associated with this class -+ * @devices - list of devices associated with this class -+ * @interfaces - list of class_interfaces associated with this class -+ * @class_dirs - -+ * @sem - semaphore to protect the children, devices, and interfaces lists. -+ * @class - pointer back to the struct class that this structure is associated -+ * with. -+ * -+ * This structure is the one that is the actual kobject allowing struct -+ * class to be statically allocated safely. Nothing outside of the driver -+ * core should ever touch these fields. -+ */ -+struct class_private { -+ struct kset subsys; -+ struct list_head children; -+ struct list_head devices; -+ struct list_head interfaces; -+ struct kset class_dirs; -+ struct semaphore sem; -+ struct class *class; -+}; -+#define to_class(obj) container_of(obj, struct class_private, subsys.kobj) -+ - /* initialisation functions */ - extern int devices_init(void); - extern int buses_init(void); ---- a/drivers/base/class.c -+++ b/drivers/base/class.c -@@ -21,17 +21,16 @@ - #include "base.h" - - #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) --#define to_class(obj) container_of(obj, struct class, subsys.kobj) - - static ssize_t - class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) - { - struct class_attribute * class_attr = to_class_attr(attr); -- struct class * dc = to_class(kobj); -+ struct class_private *cp = to_class(kobj); - ssize_t ret = -EIO; - - if (class_attr->show) -- ret = class_attr->show(dc, buf); -+ ret = class_attr->show(cp->class, buf); - return ret; - } - -@@ -40,17 +39,18 @@ class_attr_store(struct kobject * kobj, - const char * buf, size_t count) - { - struct class_attribute * class_attr = to_class_attr(attr); -- struct class * dc = to_class(kobj); -+ struct class_private *cp = to_class(kobj); - ssize_t ret = -EIO; - - if (class_attr->store) -- ret = class_attr->store(dc, buf, count); -+ ret = class_attr->store(cp->class, buf, count); - return ret; - } - - static void class_release(struct kobject * kobj) - { -- struct class *class = to_class(kobj); -+ struct class_private *cp = to_class(kobj); -+ struct class *class = cp->class; - - pr_debug("class '%s': release.\n", class->name); - -@@ -79,7 +79,7 @@ int class_create_file(struct class * cls - { - int error; - if (cls) { -- error = sysfs_create_file(&cls->subsys.kobj, &attr->attr); -+ error = sysfs_create_file(&cls->p->subsys.kobj, &attr->attr); - } else - error = -EINVAL; - return error; -@@ -88,20 +88,20 @@ int class_create_file(struct class * cls - void class_remove_file(struct class * cls, const struct class_attribute * attr) - { - if (cls) -- sysfs_remove_file(&cls->subsys.kobj, &attr->attr); -+ sysfs_remove_file(&cls->p->subsys.kobj, &attr->attr); - } - - static struct class *class_get(struct class *cls) - { - if (cls) -- return container_of(kset_get(&cls->subsys), struct class, subsys); -- return NULL; -+ kset_get(&cls->p->subsys); -+ return cls; - } - - static void class_put(struct class * cls) - { - if (cls) -- kset_put(&cls->subsys); -+ kset_put(&cls->p->subsys); - } - - -@@ -138,32 +138,42 @@ static void remove_class_attrs(struct cl - int class_register(struct class * cls) - { - int error; -+ struct class_private *cp; - - pr_debug("device class '%s': registering\n", cls->name); - -- INIT_LIST_HEAD(&cls->children); -- INIT_LIST_HEAD(&cls->devices); -- INIT_LIST_HEAD(&cls->interfaces); -- kset_init(&cls->class_dirs); -- init_MUTEX(&cls->sem); -- error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name); -- if (error) -+ cp = kzalloc(sizeof(*cp), GFP_KERNEL); -+ if (!cp) -+ return -ENOMEM; -+ INIT_LIST_HEAD(&cp->children); -+ INIT_LIST_HEAD(&cp->devices); -+ INIT_LIST_HEAD(&cp->interfaces); -+ kset_init(&cp->class_dirs); -+ init_MUTEX(&cp->sem); -+ error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); -+ if (error) { -+ kfree(cp); - return error; -+ } - - #ifdef CONFIG_SYSFS_DEPRECATED - /* let the block class directory show up in the root of sysfs */ - if (cls != &block_class) -- cls->subsys.kobj.kset = class_kset; -+ cp->subsys.kobj.kset = class_kset; - #else -- cls->subsys.kobj.kset = class_kset; -+ cp->subsys.kobj.kset = class_kset; - #endif -- cls->subsys.kobj.ktype = &class_ktype; -- -- error = kset_register(&cls->subsys); -- if (!error) { -- error = add_class_attrs(class_get(cls)); -- class_put(cls); -+ cp->subsys.kobj.ktype = &class_ktype; -+ cp->class = cls; -+ cls->p = cp; -+ -+ error = kset_register(&cp->subsys); -+ if (error) { -+ kfree(cp); -+ return error; - } -+ error = add_class_attrs(class_get(cls)); -+ class_put(cls); - return error; - } - -@@ -171,7 +181,7 @@ void class_unregister(struct class * cls - { - pr_debug("device class '%s': unregistering\n", cls->name); - remove_class_attrs(cls); -- kset_unregister(&cls->subsys); -+ kset_unregister(&cls->p->subsys); - } - - static void class_create_release(struct class *cls) -@@ -583,7 +593,7 @@ int class_device_add(struct class_device - if (parent_class_dev) - class_dev->kobj.parent = &parent_class_dev->kobj; - else -- class_dev->kobj.parent = &parent_class->subsys.kobj; -+ class_dev->kobj.parent = &parent_class->p->subsys.kobj; - - error = kobject_add(&class_dev->kobj, class_dev->kobj.parent, - "%s", class_dev->class_id); -@@ -592,7 +602,7 @@ int class_device_add(struct class_device - - /* add the needed attributes to this device */ - error = sysfs_create_link(&class_dev->kobj, -- &parent_class->subsys.kobj, "subsystem"); -+ &parent_class->p->subsys.kobj, "subsystem"); - if (error) - goto out3; - -@@ -628,13 +638,13 @@ int class_device_add(struct class_device - kobject_uevent(&class_dev->kobj, KOBJ_ADD); - - /* notify any interfaces this device is now here */ -- down(&parent_class->sem); -- list_add_tail(&class_dev->node, &parent_class->children); -- list_for_each_entry(class_intf, &parent_class->interfaces, node) { -+ down(&parent_class->p->sem); -+ list_add_tail(&class_dev->node, &parent_class->p->children); -+ list_for_each_entry(class_intf, &parent_class->p->interfaces, node) { - if (class_intf->add) - class_intf->add(class_dev, class_intf); - } -- up(&parent_class->sem); -+ up(&parent_class->p->sem); - - goto out1; - -@@ -736,12 +746,13 @@ void class_device_del(struct class_devic - struct class_interface *class_intf; - - if (parent_class) { -- down(&parent_class->sem); -+ down(&parent_class->p->sem); - list_del_init(&class_dev->node); -- list_for_each_entry(class_intf, &parent_class->interfaces, node) -+ list_for_each_entry(class_intf, &parent_class->p->interfaces, -+ node) - if (class_intf->remove) - class_intf->remove(class_dev, class_intf); -- up(&parent_class->sem); -+ up(&parent_class->p->sem); - } - - if (class_dev->dev) { -@@ -783,14 +794,14 @@ void class_device_destroy(struct class * - struct class_device *class_dev = NULL; - struct class_device *class_dev_tmp; - -- down(&cls->sem); -- list_for_each_entry(class_dev_tmp, &cls->children, node) { -+ down(&cls->p->sem); -+ list_for_each_entry(class_dev_tmp, &cls->p->children, node) { - if (class_dev_tmp->devt == devt) { - class_dev = class_dev_tmp; - break; - } - } -- up(&cls->sem); -+ up(&cls->p->sem); - - if (class_dev) - class_device_unregister(class_dev); -@@ -833,8 +844,8 @@ int class_for_each_device(struct class * - - if (!class) - return -EINVAL; -- down(&class->sem); -- list_for_each_entry(dev, &class->devices, node) { -+ down(&class->p->sem); -+ list_for_each_entry(dev, &class->p->devices, node) { - dev = get_device(dev); - if (dev) { - error = fn(dev, data); -@@ -844,7 +855,7 @@ int class_for_each_device(struct class * - if (error) - break; - } -- up(&class->sem); -+ up(&class->p->sem); - - return error; - } -@@ -879,8 +890,8 @@ struct device *class_find_device(struct - if (!class) - return NULL; - -- down(&class->sem); -- list_for_each_entry(dev, &class->devices, node) { -+ down(&class->p->sem); -+ list_for_each_entry(dev, &class->p->devices, node) { - dev = get_device(dev); - if (dev) { - if (match(dev, data)) { -@@ -891,7 +902,7 @@ struct device *class_find_device(struct - } else - break; - } -- up(&class->sem); -+ up(&class->p->sem); - - return found ? dev : NULL; - } -@@ -925,8 +936,8 @@ struct class_device *class_find_child(st - if (!class) - return NULL; - -- down(&class->sem); -- list_for_each_entry(dev, &class->children, node) { -+ down(&class->p->sem); -+ list_for_each_entry(dev, &class->p->children, node) { - dev = class_device_get(dev); - if (dev) { - if (match(dev, data)) { -@@ -937,7 +948,7 @@ struct class_device *class_find_child(st - } else - break; - } -- up(&class->sem); -+ up(&class->p->sem); - - return found ? dev : NULL; - } -@@ -947,6 +958,7 @@ int class_interface_register(struct clas - { - struct class *parent; - struct class_device *class_dev; -+ struct class_private *cp; - struct device *dev; - - if (!class_intf || !class_intf->class) -@@ -956,41 +968,43 @@ int class_interface_register(struct clas - if (!parent) - return -EINVAL; - -- down(&parent->sem); -- list_add_tail(&class_intf->node, &parent->interfaces); -+ cp = parent->p; -+ down(&cp->sem); -+ list_add_tail(&class_intf->node, &cp->interfaces); - if (class_intf->add) { -- list_for_each_entry(class_dev, &parent->children, node) -+ list_for_each_entry(class_dev, &cp->children, node) - class_intf->add(class_dev, class_intf); - } - if (class_intf->add_dev) { -- list_for_each_entry(dev, &parent->devices, node) -+ list_for_each_entry(dev, &cp->devices, node) - class_intf->add_dev(dev, class_intf); - } -- up(&parent->sem); -+ up(&cp->sem); - - return 0; - } - - void class_interface_unregister(struct class_interface *class_intf) - { -- struct class * parent = class_intf->class; -+ struct class *parent = class_intf->class; -+ struct class_private *cp = parent->p; - struct class_device *class_dev; - struct device *dev; - - if (!parent) - return; - -- down(&parent->sem); -+ down(&cp->sem); - list_del_init(&class_intf->node); - if (class_intf->remove) { -- list_for_each_entry(class_dev, &parent->children, node) -+ list_for_each_entry(class_dev, &cp->children, node) - class_intf->remove(class_dev, class_intf); - } - if (class_intf->remove_dev) { -- list_for_each_entry(dev, &parent->devices, node) -+ list_for_each_entry(dev, &cp->devices, node) - class_intf->remove_dev(dev, class_intf); - } -- up(&parent->sem); -+ up(&cp->sem); - - class_put(parent); - } ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -588,13 +588,13 @@ static struct kobject *get_device_parent - parent_kobj = &parent->kobj; - - /* find our class-directory at the parent and reference it */ -- spin_lock(&dev->class->class_dirs.list_lock); -- list_for_each_entry(k, &dev->class->class_dirs.list, entry) -+ spin_lock(&dev->class->p->class_dirs.list_lock); -+ list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) - if (k->parent == parent_kobj) { - kobj = kobject_get(k); - break; - } -- spin_unlock(&dev->class->class_dirs.list_lock); -+ spin_unlock(&dev->class->p->class_dirs.list_lock); - if (kobj) - return kobj; - -@@ -602,7 +602,7 @@ static struct kobject *get_device_parent - k = kobject_create(); - if (!k) - return NULL; -- k->kset = &dev->class->class_dirs; -+ k->kset = &dev->class->p->class_dirs; - retval = kobject_add(k, parent_kobj, "%s", dev->class->name); - if (retval < 0) { - kobject_put(k); -@@ -622,7 +622,7 @@ static void cleanup_device_parent(struct - struct kobject *glue_dir = dev->kobj.parent; - - /* see if we live in a "glue" directory */ -- if (!dev->class || glue_dir->kset != &dev->class->class_dirs) -+ if (!dev->class || glue_dir->kset != &dev->class->p->class_dirs) - return; - - kobject_put(glue_dir); -@@ -647,7 +647,7 @@ static int device_add_class_symlinks(str - if (!dev->class) - return 0; - -- error = sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj, -+ error = sysfs_create_link(&dev->kobj, &dev->class->p->subsys.kobj, - "subsystem"); - if (error) - goto out; -@@ -699,7 +699,7 @@ out_busid: - sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); - #else - /* link in the class directory pointing to the device */ -- error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, -+ error = sysfs_create_link(&dev->class->p->subsys.kobj, &dev->kobj, - dev->bus_id); - if (error) - goto out_subsys; -@@ -713,7 +713,7 @@ out_busid: - return 0; - - out_busid: -- sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); -+ sysfs_remove_link(&dev->class->p->subsys.kobj, dev->bus_id); - #endif - - out_subsys: -@@ -746,7 +746,7 @@ static void device_remove_class_symlinks - if (dev->parent && dev->type != &part_type) - sysfs_remove_link(&dev->kobj, "device"); - -- sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); -+ sysfs_remove_link(&dev->class->p->subsys.kobj, dev->bus_id); - #endif - - sysfs_remove_link(&dev->kobj, "subsystem"); -@@ -832,15 +832,16 @@ int device_add(struct device *dev) - klist_add_tail(&dev->knode_parent, &parent->klist_children); - - if (dev->class) { -- down(&dev->class->sem); -+ down(&dev->class->p->sem); - /* tie the class to the device */ -- list_add_tail(&dev->node, &dev->class->devices); -+ list_add_tail(&dev->node, &dev->class->p->devices); - - /* notify any interfaces that the device is here */ -- list_for_each_entry(class_intf, &dev->class->interfaces, node) -+ list_for_each_entry(class_intf, &dev->class->p->interfaces, -+ node) - if (class_intf->add_dev) - class_intf->add_dev(dev, class_intf); -- up(&dev->class->sem); -+ up(&dev->class->p->sem); - } - Done: - put_device(dev); -@@ -944,14 +945,15 @@ void device_del(struct device * dev) - if (dev->class) { - device_remove_class_symlinks(dev); - -- down(&dev->class->sem); -+ down(&dev->class->p->sem); - /* notify any interfaces that the device is now gone */ -- list_for_each_entry(class_intf, &dev->class->interfaces, node) -+ list_for_each_entry(class_intf, &dev->class->p->interfaces, -+ node) - if (class_intf->remove_dev) - class_intf->remove_dev(dev, class_intf); - /* remove the device from the class list */ - list_del_init(&dev->node); -- up(&dev->class->sem); -+ up(&dev->class->p->sem); - } - device_remove_file(dev, &uevent_attr); - device_remove_attrs(dev); -@@ -1158,14 +1160,14 @@ static struct device *find_device(struct - struct device *dev = NULL; - struct device *dev_tmp; - -- down(&class->sem); -- list_for_each_entry(dev_tmp, &class->devices, node) { -+ down(&class->p->sem); -+ list_for_each_entry(dev_tmp, &class->p->devices, node) { - if (dev_tmp->devt == devt) { - dev = dev_tmp; - break; - } - } -- up(&class->sem); -+ up(&class->p->sem); - return dev; - } - -@@ -1265,9 +1267,9 @@ int device_rename(struct device *dev, ch - } - #else - if (dev->class) { -- sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); -- error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, -- dev->bus_id); -+ sysfs_remove_link(&dev->class->p->subsys.kobj, old_device_name); -+ error = sysfs_create_link(&dev->class->p->subsys.kobj, -+ &dev->kobj, dev->bus_id); - if (error) { - dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", - __FUNCTION__, error); ---- a/include/linux/device.h -+++ b/include/linux/device.h -@@ -34,6 +34,7 @@ struct device; - struct device_driver; - struct driver_private; - struct class; -+struct class_private; - struct class_device; - struct bus_type; - struct bus_type_private; -@@ -172,12 +173,6 @@ struct class { - const char * name; - struct module * owner; - -- struct kset subsys; -- struct list_head children; -- struct list_head devices; -- struct list_head interfaces; -- struct kset class_dirs; -- struct semaphore sem; /* locks children, devices, interfaces */ - struct class_attribute * class_attrs; - struct class_device_attribute * class_dev_attrs; - struct device_attribute * dev_attrs; -@@ -191,6 +186,8 @@ struct class { - - int (*suspend)(struct device *, pm_message_t state); - int (*resume)(struct device *); -+ -+ struct class_private *p; - }; - - extern int __must_check class_register(struct class *); |