diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 19:10:33 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 19:10:33 -0500 |
| commit | e54be894eae10eca9892e965cc9532f5d5a11767 (patch) | |
| tree | 27ace4446e42058ef4813a34bf63b55a870e7a12 | |
| parent | 949f6711b83d2809d1ccb9d830155a65fdacdff9 (diff) | |
| parent | c6c0ac664c86ff6408fadbed4913938c8a732e26 (diff) | |
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
driver core: Document that device_rename() is only for networking
sysfs: remove useless test from sysfs_merge_group
driver-core: merge private parts of class and bus
driver core: fix whitespace in class_attr_string
| -rw-r--r-- | drivers/base/base.h | 62 | ||||
| -rw-r--r-- | drivers/base/bus.c | 13 | ||||
| -rw-r--r-- | drivers/base/class.c | 42 | ||||
| -rw-r--r-- | drivers/base/core.c | 24 | ||||
| -rw-r--r-- | fs/sysfs/group.c | 10 | ||||
| -rw-r--r-- | include/linux/device.h | 7 |
6 files changed, 70 insertions, 88 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 9c63a5687d69..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 | |
