diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/base/bus.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index eb1b7fa20dce..000e7b2006f8 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 | ||
@@ -440,22 +439,6 @@ static void device_remove_attrs(struct bus_type *bus, struct device *dev) | |||
440 | } | 439 | } |
441 | } | 440 | } |
442 | 441 | ||
443 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
444 | static int make_deprecated_bus_links(struct device *dev) | ||
445 | { | ||
446 | return sysfs_create_link(&dev->kobj, | ||
447 | &dev->bus->p->subsys.kobj, "bus"); | ||
448 | } | ||
449 | |||
450 | static void remove_deprecated_bus_links(struct device *dev) | ||
451 | { | ||
452 | sysfs_remove_link(&dev->kobj, "bus"); | ||
453 | } | ||
454 | #else | ||
455 | static inline int make_deprecated_bus_links(struct device *dev) { return 0; } | ||
456 | static inline void remove_deprecated_bus_links(struct device *dev) { } | ||
457 | #endif | ||
458 | |||
459 | /** | 442 | /** |
460 | * bus_add_device - add device to bus | 443 | * bus_add_device - add device to bus |
461 | * @dev: device being added | 444 | * @dev: device being added |
@@ -482,15 +465,10 @@ int bus_add_device(struct device *dev) | |||
482 | &dev->bus->p->subsys.kobj, "subsystem"); | 465 | &dev->bus->p->subsys.kobj, "subsystem"); |
483 | if (error) | 466 | if (error) |
484 | goto out_subsys; | 467 | goto out_subsys; |
485 | error = make_deprecated_bus_links(dev); | ||
486 | if (error) | ||
487 | goto out_deprecated; | ||
488 | klist_add_tail(&dev->p->knode_bus, &bus->p->klist_devices); | 468 | klist_add_tail(&dev->p->knode_bus, &bus->p->klist_devices); |
489 | } | 469 | } |
490 | return 0; | 470 | return 0; |
491 | 471 | ||
492 | out_deprecated: | ||
493 | sysfs_remove_link(&dev->kobj, "subsystem"); | ||
494 | out_subsys: | 472 | out_subsys: |
495 | sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev)); | 473 | sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev)); |
496 | out_id: | 474 | out_id: |
@@ -530,7 +508,6 @@ void bus_remove_device(struct device *dev) | |||
530 | { | 508 | { |
531 | if (dev->bus) { | 509 | if (dev->bus) { |
532 | sysfs_remove_link(&dev->kobj, "subsystem"); | 510 | sysfs_remove_link(&dev->kobj, "subsystem"); |
533 | remove_deprecated_bus_links(dev); | ||
534 | sysfs_remove_link(&dev->bus->p->devices_kset->kobj, | 511 | sysfs_remove_link(&dev->bus->p->devices_kset->kobj, |
535 | dev_name(dev)); | 512 | dev_name(dev)); |
536 | device_remove_attrs(dev->bus, dev); | 513 | device_remove_attrs(dev->bus, dev); |
@@ -880,9 +857,9 @@ static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store); | |||
880 | int bus_register(struct bus_type *bus) | 857 | int bus_register(struct bus_type *bus) |
881 | { | 858 | { |
882 | int retval; | 859 | int retval; |
883 | struct bus_type_private *priv; | 860 | struct subsys_private *priv; |
884 | 861 | ||
885 | priv = kzalloc(sizeof(struct bus_type_private), GFP_KERNEL); | 862 | priv = kzalloc(sizeof(struct subsys_private), GFP_KERNEL); |
886 | if (!priv) | 863 | if (!priv) |
887 | return -ENOMEM; | 864 | return -ENOMEM; |
888 | 865 | ||
@@ -998,7 +975,7 @@ struct klist *bus_get_device_klist(struct bus_type *bus) | |||
998 | EXPORT_SYMBOL_GPL(bus_get_device_klist); | 975 | EXPORT_SYMBOL_GPL(bus_get_device_klist); |
999 | 976 | ||
1000 | /* | 977 | /* |
1001 | * Yes, this forcably breaks the klist abstraction temporarily. It | 978 | * Yes, this forcibly breaks the klist abstraction temporarily. It |
1002 | * just wants to sort the klist, not change reference counts and | 979 | * just wants to sort the klist, not change reference counts and |
1003 | * take/drop locks rapidly in the process. It does all this while | 980 | * take/drop locks rapidly in the process. It does all this while |
1004 | * holding the lock for the list, so objects can't otherwise be | 981 | * holding the lock for the list, so objects can't otherwise be |