diff options
| -rw-r--r-- | drivers/base/base.h | 62 | ||||
| -rw-r--r-- | drivers/base/bus.c | 13 | ||||
| -rw-r--r-- | drivers/base/class.c | 38 | ||||
| -rw-r--r-- | drivers/base/core.c | 22 | ||||
| -rw-r--r-- | include/linux/device.h | 7 |
5 files changed, 64 insertions, 78 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h index 2ca7f5b7b824..19f49e41ce5d 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -1,31 +1,46 @@ | |||
| 1 | 1 | ||
| 2 | /** | 2 | /** |
| 3 | * struct bus_type_private - structure to hold the private to the driver core portions of the bus_type structure. | 3 | * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure. |
| 4 | * | 4 | * |
| 5 | * @subsys - the struct kset that defines this bus. This is the main kobject | 5 | * @subsys - the struct kset that defines this subsystem |
| 6 | * @drivers_kset - the list of drivers associated with this bus | 6 | * @devices_kset - the list of devices associated |
| 7 | * @devices_kset - the list of devices associated with this bus | 7 | * |
| 8 | * @drivers_kset - the list of drivers associated | ||
| 8 | * @klist_devices - the klist to iterate over the @devices_kset | 9 | * @klist_devices - the klist to iterate over the @devices_kset |
| 9 | * @klist_drivers - the klist to iterate over the @drivers_kset | 10 | * @klist_drivers - the klist to iterate over the @drivers_kset |
| 10 | * @bus_notifier - the bus notifier list for anything that cares about things | 11 | * @bus_notifier - the bus notifier list for anything that cares about things |
| 11 | * on this bus. | 12 | * on this bus. |
| 12 | * @bus - pointer back to the struct bus_type that this structure is associated | 13 | * @bus - pointer back to the struct bus_type that this structure is associated |
| 13 | * with. | 14 | * with. |
| 15 | * | ||
| 16 | * @class_interfaces - list of class_interfaces associated | ||
| 17 | * @glue_dirs - "glue" directory to put in-between the parent device to | ||
| 18 | * avoid namespace conflicts | ||
| 19 | * @class_mutex - mutex to protect the children, devices, and interfaces lists. | ||
| 20 | * @class - pointer back to the struct class that this structure is associated | ||
| 21 | * with. | ||
| 14 | * | 22 | * |
| 15 | * This structure is the one that is the actual kobject allowing struct | 23 | * This structure is the one that is the actual kobject allowing struct |
| 16 | * bus_type to be statically allocated safely. Nothing outside of the driver | 24 | * bus_type/class to be statically allocated safely. Nothing outside of the |
| 17 | * core should ever touch these fields. | 25 | * driver core should ever touch these fields. |
| 18 | */ | 26 | */ |
| 19 | struct bus_type_private { | 27 | struct subsys_private { |
| 20 | struct kset subsys; | 28 | struct kset subsys; |
| 21 | struct kset *drivers_kset; | ||
| 22 | struct kset *devices_kset; | 29 | struct kset *devices_kset; |
| 30 | |||
| 31 | struct kset *drivers_kset; | ||
| 23 | struct klist klist_devices; | 32 | struct klist klist_devices; |
| 24 | struct klist klist_drivers; | 33 | struct klist klist_drivers; |
| 25 | struct blocking_notifier_head bus_notifier; | 34 | struct blocking_notifier_head bus_notifier; |
| 26 | unsigned int drivers_autoprobe:1; | 35 | unsigned int drivers_autoprobe:1; |
| 27 | struct bus_type *bus; | 36 | struct bus_type *bus; |
| 37 | |||
| 38 | struct list_head class_interfaces; | ||
| 39 | struct kset glue_dirs; | ||
| 40 | struct mutex class_mutex; | ||
| 41 | struct class *class; | ||
| 28 | }; | 42 | }; |
| 43 | #define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj) | ||
| 29 | 44 | ||
| 30 | struct driver_private { | 45 | struct driver_private { |
| 31 | struct kobject kobj; | 46 | struct kobject kobj; |
| @@ -36,33 +51,6 @@ struct driver_private { | |||
| 36 | }; | 51 | }; |
| 37 | #define to_driver(obj) container_of(obj, struct driver_private, kobj) | 52 | #define to_driver(obj) container_of(obj, struct driver_private, kobj) |
| 38 | 53 | ||
| 39 | |||
| 40 | /** | ||
| 41 | * struct class_private - structure to hold the private to the driver core portions of the class structure. | ||
| 42 | * | ||
| 43 | * @class_subsys - the struct kset that defines this class. This is the main kobject | ||
| 44 | * @class_devices - list of devices associated with this class | ||
| 45 | * @class_interfaces - list of class_interfaces associated with this class | ||
| 46 | * @class_dirs - "glue" directory for virtual devices associated with this class | ||
| 47 | * @class_mutex - mutex to protect the children, devices, and interfaces lists. | ||
| 48 | * @class - pointer back to the struct class that this structure is associated | ||
| 49 | * with. | ||
| 50 | * | ||
| 51 | * This structure is the one that is the actual kobject allowing struct | ||
| 52 | * class to be statically allocated safely. Nothing outside of the driver | ||
| 53 | * core should ever touch these fields. | ||
| 54 | */ | ||
| 55 | struct class_private { | ||
| 56 | struct kset class_subsys; | ||
| 57 | struct klist class_devices; | ||
| 58 | struct list_head class_interfaces; | ||
| 59 | struct kset class_dirs; | ||
| 60 | struct mutex class_mutex; | ||
| 61 | struct class *class; | ||
| 62 | }; | ||
| 63 | #define to_class(obj) \ | ||
| 64 | container_of(obj, struct class_private, class_subsys.kobj) | ||
| 65 | |||
| 66 | /** | 54 | /** |
| 67 | * struct device_private - structure to hold the private to the driver core portions of the device structure. | 55 | * struct device_private - structure to hold the private to the driver core portions of the device structure. |
| 68 | * | 56 | * |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 33c270a64db7..e243bd49764b 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include "power/power.h" | 20 | #include "power/power.h" |
| 21 | 21 | ||
| 22 | #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) | 22 | #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) |
| 23 | #define to_bus(obj) container_of(obj, struct bus_type_private, subsys.kobj) | ||
| 24 | 23 | ||
| 25 | /* | 24 | /* |
| 26 | * sysfs bindings for drivers | 25 | * sysfs bindings for drivers |
| @@ -96,11 +95,11 @@ static ssize_t bus_attr_show(struct kobject *kobj, struct attribute *attr, | |||
| 96 | char *buf) | 95 | char *buf) |
| 97 | { | 96 | { |
| 98 | struct bus_attribute *bus_attr = to_bus_attr(attr); | 97 | struct bus_attribute *bus_attr = to_bus_attr(attr); |
| 99 | struct bus_type_private *bus_priv = to_bus(kobj); | 98 | struct subsys_private *subsys_priv = to_subsys_private(kobj); |
| 100 | ssize_t ret = 0; | 99 | ssize_t ret = 0; |
| 101 | 100 | ||
| 102 | if (bus_attr->show) | 101 | if (bus_attr->show) |
| 103 | ret = bus_attr->show(bus_priv->bus, buf); | 102 | ret = bus_attr->show(subsys_priv->bus, buf); |
| 104 | return ret; | 103 | return ret; |
| 105 | } | 104 | } |
| 106 | 105 | ||
| @@ -108,11 +107,11 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 108 | const char *buf, size_t count) | 107 | const char *buf, size_t count) |
| 109 | { | 108 | { |
| 110 | struct bus_attribute *bus_attr = to_bus_attr(attr); | 109 | struct bus_attribute *bus_attr = to_bus_attr(attr); |
| 111 | struct bus_type_private *bus_priv = to_bus(kobj); | 110 | struct subsys_private *subsys_priv = to_subsys_private(kobj); |
| 112 | ssize_t ret = 0; | 111 | ssize_t ret = 0; |
| 113 | 112 | ||
| 114 | if (bus_attr->store) | 113 | if (bus_attr->store) |
| 115 | ret = bus_attr->store(bus_priv->bus, buf, count); | 114 | ret = bus_attr->store(subsys_priv->bus, buf, count); |
| 116 | return ret; | 115 | return ret; |
| 117 | } | 116 | } |
| 118 | 117 | ||
| @@ -858,9 +857,9 @@ static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store); | |||
| 858 | int bus_register(struct bus_type *bus) | 857 | int bus_register(struct bus_type *bus) |
| 859 | { | 858 | { |
| 860 | int retval; | 859 | int retval; |
| 861 | struct bus_type_private *priv; | 860 | struct subsys_private *priv; |
| 862 | 861 | ||
| 863 | priv = kzalloc(sizeof(struct bus_type_private), GFP_KERNEL); | 862 | priv = kzalloc(sizeof(struct subsys_private), GFP_KERNEL); |
| 864 | if (!priv) | 863 | if (!priv) |
| 865 | return -ENOMEM; | 864 | return -ENOMEM; |
| 866 | 865 | ||
diff --git a/drivers/base/class.c b/drivers/base/class.c index 7975a52bdf5b..4f1df2e8fd74 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -27,7 +27,7 @@ static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr, | |||
| 27 | char *buf) | 27 | char *buf) |
| 28 | { | 28 | { |
| 29 | struct class_attribute *class_attr = to_class_attr(attr); | 29 | struct class_attribute *class_attr = to_class_attr(attr); |
| 30 | struct class_private *cp = to_class(kobj); | 30 | struct subsys_private *cp = to_subsys_private(kobj); |
| 31 | ssize_t ret = -EIO; | 31 | ssize_t ret = -EIO; |
| 32 | 32 | ||
| 33 | if (class_attr->show) | 33 | if (class_attr->show) |
| @@ -39,7 +39,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 39 | const char *buf, size_t count) | 39 | const char *buf, size_t count) |
| 40 | { | 40 | { |
| 41 | struct class_attribute *class_attr = to_class_attr(attr); | 41 | struct class_attribute *class_attr = to_class_attr(attr); |
| 42 | struct class_private *cp = to_class(kobj); | 42 | struct subsys_private *cp = to_subsys_private(kobj); |
| 43 | ssize_t ret = -EIO; | 43 | ssize_t ret = -EIO; |
| 44 | 44 | ||
| 45 | if (class_attr->store) | 45 | if (class_attr->store) |
| @@ -49,7 +49,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 49 | 49 | ||
| 50 | static void class_release(struct kobject *kobj) | 50 | static void class_release(struct kobject *kobj) |
| 51 | { | 51 | { |
| 52 | struct class_private *cp = to_class(kobj); | 52 | struct subsys_private *cp = to_subsys_private(kobj); |
| 53 | struct class *class = cp->class; | 53 | struct class *class = cp->class; |
| 54 | 54 | ||
| 55 | pr_debug("class '%s': release.\n", class->name); | 55 | pr_debug("class '%s': release.\n", class->name); |
| @@ -65,7 +65,7 @@ static void class_release(struct kobject *kobj) | |||
| 65 | 65 | ||
| 66 | static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject *kobj) | 66 | static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject *kobj) |
| 67 | { | 67 | { |
| 68 | struct class_private *cp = to_class(kobj); | 68 | struct subsys_private *cp = to_subsys_private(kobj); |
| 69 | struct class *class = cp->class; | 69 | struct class *class = cp->class; |
| 70 | 70 | ||
| 71 | return class->ns_type; | 71 | return class->ns_type; |
| @@ -82,7 +82,7 @@ static struct kobj_type class_ktype = { | |||
| 82 | .child_ns_type = class_child_ns_type, | 82 | .child_ns_type = class_child_ns_type, |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | /* Hotplug events for classes go to the class class_subsys */ | 85 | /* Hotplug events for classes go to the class subsys */ |
| 86 | static struct kset *class_kset; | 86 | static struct kset *class_kset; |
| 87 | 87 | ||
| 88 | 88 | ||
| @@ -90,7 +90,7 @@ int class_create_file(struct class *cls, const struct class_attribute *attr) | |||
| 90 | { | 90 | { |
| 91 | int error; | 91 | int error; |
| 92 | if (cls) | 92 | if (cls) |
| 93 | error = sysfs_create_file(&cls->p->class_subsys.kobj, | 93 | error = sysfs_create_file(&cls->p->subsys.kobj, |
| 94 | &attr->attr); | 94 | &attr->attr); |
| 95 | else | 95 | else |
| 96 | error = -EINVAL; | 96 | error = -EINVAL; |
| @@ -100,20 +100,20 @@ int class_create_file(struct class *cls, const struct class_attribute *attr) | |||
| 100 | void class_remove_file(struct class *cls, const struct class_attribute *attr) | 100 | void class_remove_file(struct class *cls, const struct class_attribute *attr) |
| 101 | { | 101 | { |
| 102 | if (cls) | 102 | if (cls) |
| 103 | sysfs_remove_file(&cls->p->class_subsys.kobj, &attr->attr); | 103 | sysfs_remove_file(&cls->p->subsys.kobj, &attr->attr); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | static struct class *class_get(struct class *cls) | 106 | static struct class *class_get(struct class *cls) |
| 107 | { | 107 | { |
| 108 | if (cls) | 108 | if (cls) |
| 109 | kset_get(&cls->p->class_subsys); | 109 | kset_get(&cls->p->subsys); |
| 110 | return cls; | 110 | return cls; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | static void class_put(struct class *cls) | 113 | static void class_put(struct class *cls) |
| 114 | { | 114 | { |
| 115 | if (cls) | 115 | if (cls) |
| 116 | kset_put(&cls->p->class_subsys); | 116 | kset_put(&cls->p->subsys); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | static int add_class_attrs(struct class *cls) | 119 | static int add_class_attrs(struct class *cls) |
| @@ -162,7 +162,7 @@ static void klist_class_dev_put(struct klist_node *n) | |||
| 162 | 162 | ||
| 163 | int __class_register(struct class *cls, struct lock_class_key *key) | 163 | int __class_register(struct class *cls, struct lock_class_key *key) |
| 164 | { | 164 | { |
| 165 | struct class_private *cp; | 165 | struct subsys_private *cp; |
| 166 | int error; | 166 | int error; |
| 167 | 167 | ||
| 168 | pr_debug("device class '%s': registering\n", cls->name); | 168 | pr_debug("device class '%s': registering\n", cls->name); |
| @@ -170,11 +170,11 @@ int __class_register(struct class *cls, struct lock_class_key *key) | |||
| 170 | cp = kzalloc(sizeof(*cp), GFP_KERNEL); | 170 | cp = kzalloc(sizeof(*cp), GFP_KERNEL); |
| 171 | if (!cp) | 171 | if (!cp) |
| 172 | return -ENOMEM; | 172 | return -ENOMEM; |
| 173 | klist_init(&cp->class_devices, klist_class_dev_get, klist_class_dev_put); | 173 | klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put); |
| 174 | INIT_LIST_HEAD(&cp->class_interfaces); | 174 | INIT_LIST_HEAD(&cp->class_interfaces); |
| 175 | kset_init(&cp->class_dirs); | 175 | kset_init(&cp->glue_dirs); |
| 176 | __mutex_init(&cp->class_mutex, "struct class mutex", key); | 176 | __mutex_init(&cp->class_mutex, "struct class mutex", key); |
| 177 | error = kobject_set_name(&cp->class_subsys.kobj, "%s", cls->name); | 177 | error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); |
| 178 | if (error) { | 178 | if (error) { |
| 179 | kfree(cp); | 179 | kfree(cp); |
| 180 | return error; | 180 | return error; |
| @@ -187,15 +187,15 @@ int __class_register(struct class *cls, struct lock_class_key *key) | |||
| 187 | #if defined(CONFIG_BLOCK) | 187 | #if defined(CONFIG_BLOCK) |
| 188 | /* let the block class directory show up in the root of sysfs */ | 188 | /* let the block class directory show up in the root of sysfs */ |
| 189 | if (!sysfs_deprecated || cls != &block_class) | 189 | if (!sysfs_deprecated || cls != &block_class) |
| 190 | cp->class_subsys.kobj.kset = class_kset; | 190 | cp->subsys.kobj.kset = class_kset; |
| 191 | #else | 191 | #else |
| 192 | cp->class_subsys.kobj.kset = class_kset; | 192 | cp->subsys.kobj.kset = class_kset; |
| 193 | #endif | 193 | #endif |
| 194 | cp->class_subsys.kobj.ktype = &class_ktype; | 194 | cp->subsys.kobj.ktype = &class_ktype; |
| 195 | cp->class = cls; | 195 | cp->class = cls; |
| 196 | cls->p = cp; | 196 | cls->p = cp; |
| 197 | 197 | ||
| 198 | error = kset_register(&cp->class_subsys); | 198 | error = kset_register(&cp->subsys); |
| 199 | if (error) { | 199 | if (error) { |
| 200 | kfree(cp); | 200 | kfree(cp); |
| 201 | return error; | 201 | return error; |
| @@ -210,7 +210,7 @@ void class_unregister(struct class *cls) | |||
| 210 | { | 210 | { |
| 211 | pr_debug("device class '%s': unregistering\n", cls->name); | 211 | pr_debug("device class '%s': unregistering\n", cls->name); |
| 212 | remove_class_attrs(cls); | 212 | remove_class_attrs(cls); |
| 213 | kset_unregister(&cls->p->class_subsys); | 213 | kset_unregister(&cls->p->subsys); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static void class_create_release(struct class *cls) | 216 | static void class_create_release(struct class *cls) |
| @@ -295,7 +295,7 @@ void class_dev_iter_init(struct class_dev_iter *iter, struct class *class, | |||
| 295 | 295 | ||
| 296 | if (start) | 296 | if (start) |
| 297 | start_knode = &start->knode_class; | 297 | start_knode = &start->knode_class; |
| 298 | klist_iter_init_node(&class->p->class_devices, &iter->ki, start_knode); | 298 | klist_iter_init_node(&class->p->klist_devices, &iter->ki, start_knode); |
| 299 | iter->type = type; | 299 | iter->type = type; |
| 300 | } | 300 | } |
| 301 | EXPORT_SYMBOL_GPL(class_dev_iter_init); | 301 | EXPORT_SYMBOL_GPL(class_dev_iter_init); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 6ed645411c40..46ff6c251932 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -610,7 +610,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj) | |||
| 610 | dir->class = class; | 610 | dir->class = class; |
| 611 | kobject_init(&dir->kobj, &class_dir_ktype); | 611 | kobject_init(&dir->kobj, &class_dir_ktype); |
| 612 | 612 | ||
| 613 | dir->kobj.kset = &class->p->class_dirs; | 613 | dir->kobj.kset = &class->p->glue_dirs; |
| 614 | 614 | ||
| 615 | retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name); | 615 | retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name); |
| 616 | if (retval < 0) { | 616 | if (retval < 0) { |
| @@ -635,7 +635,7 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 635 | if (sysfs_deprecated && dev->class == &block_class) { | 635 | if (sysfs_deprecated && dev->class == &block_class) { |
| 636 | if (parent && parent->class == &block_class) | 636 | if (parent && parent->class == &block_class) |
| 637 | return &parent->kobj; | 637 | return &parent->kobj; |
| 638 | return &block_class.p->class_subsys.kobj; | 638 | return &block_class.p->subsys.kobj; |
| 639 | } | 639 | } |
| 640 | #endif | 640 | #endif |
| 641 | 641 | ||
| @@ -654,13 +654,13 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 654 | mutex_lock(&gdp_mutex); | 654 | mutex_lock(&gdp_mutex); |
| 655 | 655 | ||
| 656 | /* find our class-directory at the parent and reference it */ | 656 | /* find our class-directory at the parent and reference it */ |
| 657 | spin_lock(&dev->class->p->class_dirs.list_lock); | 657 | spin_lock(&dev->class->p->glue_dirs.list_lock); |
| 658 | list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) | 658 | list_for_each_entry(k, &dev->class->p->glue_dirs.list, entry) |
| 659 | if (k->parent == parent_kobj) { | 659 | if (k->parent == parent_kobj) { |
| 660 | kobj = kobject_get(k); | 660 | kobj = kobject_get(k); |
| 661 | break; | 661 | break; |
| 662 | } | 662 | } |
| 663 | spin_unlock(&dev->class->p->class_dirs.list_lock); | 663 | spin_unlock(&dev->class->p->glue_dirs.list_lock); |
| 664 | if (kobj) { | 664 | if (kobj) { |
| 665 | mutex_unlock(&gdp_mutex); | 665 | mutex_unlock(&gdp_mutex); |
| 666 | return kobj; | 666 | return kobj; |
| @@ -682,7 +682,7 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) | |||
| 682 | { | 682 | { |
| 683 | /* see if we live in a "glue" directory */ | 683 | /* see if we live in a "glue" directory */ |
| 684 | if (!glue_dir || !dev->class || | 684 | if (!glue_dir || !dev->class || |
| 685 | glue_dir->kset != &dev->class->p->class_dirs) | 685 | glue_dir->kset != &dev->class->p->glue_dirs) |
| 686 | return; | 686 | return; |
| 687 | 687 | ||
| 688 | kobject_put(glue_dir); | 688 | kobject_put(glue_dir); |
| @@ -709,7 +709,7 @@ static int device_add_class_symlinks(struct device *dev) | |||
| 709 | return 0; | 709 | return 0; |
| 710 | 710 | ||
| 711 | error = sysfs_create_link(&dev->kobj, | 711 | error = sysfs_create_link(&dev->kobj, |
| 712 | &dev->class->p->class_subsys.kobj, | 712 | &dev->class->p->subsys.kobj, |
| 713 | "subsystem"); | 713 | "subsystem"); |
| 714 | if (error) | 714 | if (error) |
| 715 | goto out; | 715 | goto out; |
| @@ -728,7 +728,7 @@ static int device_add_class_symlinks(struct device *dev) | |||
| 728 | #endif | 728 | #endif |
| 729 | 729 | ||
| 730 | /* link in the class directory pointing to the device */ | 730 | /* link in the class directory pointing to the device */ |
| 731 | error = sysfs_create_link(&dev->class->p->class_subsys.kobj, | 731 | error = sysfs_create_link(&dev->class->p->subsys.kobj, |
| 732 | &dev->kobj, dev_name(dev)); | 732 | &dev->kobj, dev_name(dev)); |
| 733 | if (error) | 733 | if (error) |
| 734 | goto out_device; | 734 | goto out_device; |
| @@ -756,7 +756,7 @@ static void device_remove_class_symlinks(struct device *dev) | |||
| 756 | if (sysfs_deprecated && dev->class == &block_class) | 756 | if (sysfs_deprecated && dev->class == &block_class) |
| 757 | return; | 757 | return; |
| 758 | #endif | 758 | #endif |
| 759 | sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev)); | 759 | sysfs_delete_link(&dev->class->p->subsys.kobj, &dev->kobj, dev_name(dev)); |
| 760 | } | 760 | } |
| 761 | 761 | ||
| 762 | /** | 762 | /** |
| @@ -947,7 +947,7 @@ int device_add(struct device *dev) | |||
| 947 | mutex_lock(&dev->class->p->class_mutex); | 947 | mutex_lock(&dev->class->p->class_mutex); |
| 948 | /* tie the class to the device */ | 948 | /* tie the class to the device */ |
| 949 | klist_add_tail(&dev->knode_class, | 949 | klist_add_tail(&dev->knode_class, |
| 950 | &dev->class->p->class_devices); | 950 | &dev->class->p->klist_devices); |
| 951 | 951 | ||
| 952 | /* notify any interfaces that the device is here */ | 952 | /* notify any interfaces that the device is here */ |
| 953 | list_for_each_entry(class_intf, | 953 | list_for_each_entry(class_intf, |
| @@ -1535,7 +1535,7 @@ int device_rename(struct device *dev, const char *new_name) | |||
| 1535 | } | 1535 | } |
| 1536 | 1536 | ||
| 1537 | if (dev->class) { | 1537 | if (dev->class) { |
| 1538 | error = sysfs_rename_link(&dev->class->p->class_subsys.kobj, | 1538 | error = sysfs_rename_link(&dev->class->p->subsys.kobj, |
| 1539 | &dev->kobj, old_device_name, new_name); | 1539 | &dev->kobj, old_device_name, new_name); |
| 1540 | if (error) | 1540 | if (error) |
| 1541 | goto out; | 1541 | goto out; |
diff --git a/include/linux/device.h b/include/linux/device.h index dd4895313468..1e2d335ab683 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -30,9 +30,8 @@ struct device_private; | |||
| 30 | struct device_driver; | 30 | struct device_driver; |
| 31 | struct driver_private; | 31 | struct driver_private; |
| 32 | struct class; | 32 | struct class; |
| 33 | struct class_private; | 33 | struct subsys_private; |
| 34 | struct bus_type; | 34 | struct bus_type; |
| 35 | struct bus_type_private; | ||
| 36 | struct device_node; | 35 | struct device_node; |
| 37 | 36 | ||
| 38 | struct bus_attribute { | 37 | struct bus_attribute { |
| @@ -65,7 +64,7 @@ struct bus_type { | |||
| 65 | 64 | ||
| 66 | const struct dev_pm_ops *pm; | 65 | const struct dev_pm_ops *pm; |
| 67 | 66 | ||
| 68 | struct bus_type_private *p; | 67 | struct subsys_private *p; |
| 69 | }; | 68 | }; |
| 70 | 69 | ||
| 71 | extern int __must_check bus_register(struct bus_type *bus); | 70 | extern int __must_check bus_register(struct bus_type *bus); |
| @@ -213,7 +212,7 @@ struct class { | |||
| 213 | 212 | ||
| 214 | const struct dev_pm_ops *pm; | 213 | const struct dev_pm_ops *pm; |
| 215 | 214 | ||
| 216 | struct class_private *p; | 215 | struct subsys_private *p; |
| 217 | }; | 216 | }; |
| 218 | 217 | ||
| 219 | struct class_dev_iter { | 218 | struct class_dev_iter { |
