diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-07-29 20:28:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:50:59 -0400 |
commit | 8380770c842faef3001e44662953d64ad9a93663 (patch) | |
tree | 631ce7dae6fe0edb36942e6165f679638f6beb68 | |
parent | 3b6662f192fc521b9657f63e68d20ec99979dae6 (diff) |
Driver core: make sysfs uevent-attributes static
Attributes do not have an owner(module) anymore, so there is no need
to carry the attributes in every single bus instance.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/base/bus.c | 21 | ||||
-rw-r--r-- | include/linux/device.h | 2 |
2 files changed, 9 insertions, 14 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 61c67526a656..ff850d1b0d92 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -568,32 +568,29 @@ static void remove_bind_files(struct device_driver *drv) | |||
568 | driver_remove_file(drv, &driver_attr_unbind); | 568 | driver_remove_file(drv, &driver_attr_unbind); |
569 | } | 569 | } |
570 | 570 | ||
571 | static BUS_ATTR(drivers_probe, S_IWUSR, NULL, store_drivers_probe); | ||
572 | static BUS_ATTR(drivers_autoprobe, S_IWUSR | S_IRUGO, | ||
573 | show_drivers_autoprobe, store_drivers_autoprobe); | ||
574 | |||
571 | static int add_probe_files(struct bus_type *bus) | 575 | static int add_probe_files(struct bus_type *bus) |
572 | { | 576 | { |
573 | int retval; | 577 | int retval; |
574 | 578 | ||
575 | bus->drivers_probe_attr.attr.name = "drivers_probe"; | 579 | retval = bus_create_file(bus, &bus_attr_drivers_probe); |
576 | bus->drivers_probe_attr.attr.mode = S_IWUSR; | ||
577 | bus->drivers_probe_attr.store = store_drivers_probe; | ||
578 | retval = bus_create_file(bus, &bus->drivers_probe_attr); | ||
579 | if (retval) | 580 | if (retval) |
580 | goto out; | 581 | goto out; |
581 | 582 | ||
582 | bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; | 583 | retval = bus_create_file(bus, &bus_attr_drivers_autoprobe); |
583 | bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
584 | bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; | ||
585 | bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; | ||
586 | retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); | ||
587 | if (retval) | 584 | if (retval) |
588 | bus_remove_file(bus, &bus->drivers_probe_attr); | 585 | bus_remove_file(bus, &bus_attr_drivers_probe); |
589 | out: | 586 | out: |
590 | return retval; | 587 | return retval; |
591 | } | 588 | } |
592 | 589 | ||
593 | static void remove_probe_files(struct bus_type *bus) | 590 | static void remove_probe_files(struct bus_type *bus) |
594 | { | 591 | { |
595 | bus_remove_file(bus, &bus->drivers_autoprobe_attr); | 592 | bus_remove_file(bus, &bus_attr_drivers_autoprobe); |
596 | bus_remove_file(bus, &bus->drivers_probe_attr); | 593 | bus_remove_file(bus, &bus_attr_drivers_probe); |
597 | } | 594 | } |
598 | #else | 595 | #else |
599 | static inline int add_bind_files(struct device_driver *drv) { return 0; } | 596 | static inline int add_bind_files(struct device_driver *drv) { return 0; } |
diff --git a/include/linux/device.h b/include/linux/device.h index 3a38d1f70cb7..5d97ca6d8655 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -64,8 +64,6 @@ struct bus_type { | |||
64 | struct bus_attribute * bus_attrs; | 64 | struct bus_attribute * bus_attrs; |
65 | struct device_attribute * dev_attrs; | 65 | struct device_attribute * dev_attrs; |
66 | struct driver_attribute * drv_attrs; | 66 | struct driver_attribute * drv_attrs; |
67 | struct bus_attribute drivers_autoprobe_attr; | ||
68 | struct bus_attribute drivers_probe_attr; | ||
69 | 67 | ||
70 | int (*match)(struct device * dev, struct device_driver * drv); | 68 | int (*match)(struct device * dev, struct device_driver * drv); |
71 | int (*uevent)(struct device *dev, char **envp, | 69 | int (*uevent)(struct device *dev, char **envp, |