aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index dca734819e50..61c67526a656 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -138,12 +138,24 @@ void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
138 } 138 }
139} 139}
140 140
141static struct kobj_type ktype_bus = { 141static struct kobj_type bus_ktype = {
142 .sysfs_ops = &bus_sysfs_ops, 142 .sysfs_ops = &bus_sysfs_ops,
143};
144
145static int bus_uevent_filter(struct kset *kset, struct kobject *kobj)
146{
147 struct kobj_type *ktype = get_ktype(kobj);
143 148
149 if (ktype == &bus_ktype)
150 return 1;
151 return 0;
152}
153
154static struct kset_uevent_ops bus_uevent_ops = {
155 .filter = bus_uevent_filter,
144}; 156};
145 157
146static decl_subsys(bus, &ktype_bus, NULL); 158static decl_subsys(bus, &bus_ktype, &bus_uevent_ops);
147 159
148 160
149#ifdef CONFIG_HOTPLUG 161#ifdef CONFIG_HOTPLUG
@@ -562,7 +574,6 @@ static int add_probe_files(struct bus_type *bus)
562 574
563 bus->drivers_probe_attr.attr.name = "drivers_probe"; 575 bus->drivers_probe_attr.attr.name = "drivers_probe";
564 bus->drivers_probe_attr.attr.mode = S_IWUSR; 576 bus->drivers_probe_attr.attr.mode = S_IWUSR;
565 bus->drivers_probe_attr.attr.owner = bus->owner;
566 bus->drivers_probe_attr.store = store_drivers_probe; 577 bus->drivers_probe_attr.store = store_drivers_probe;
567 retval = bus_create_file(bus, &bus->drivers_probe_attr); 578 retval = bus_create_file(bus, &bus->drivers_probe_attr);
568 if (retval) 579 if (retval)
@@ -570,7 +581,6 @@ static int add_probe_files(struct bus_type *bus)
570 581
571 bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; 582 bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe";
572 bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; 583 bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO;
573 bus->drivers_autoprobe_attr.attr.owner = bus->owner;
574 bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; 584 bus->drivers_autoprobe_attr.show = show_drivers_autoprobe;
575 bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; 585 bus->drivers_autoprobe_attr.store = store_drivers_autoprobe;
576 retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); 586 retval = bus_create_file(bus, &bus->drivers_autoprobe_attr);
@@ -610,7 +620,8 @@ int bus_add_driver(struct device_driver *drv)
610 if (error) 620 if (error)
611 goto out_put_bus; 621 goto out_put_bus;
612 drv->kobj.kset = &bus->drivers; 622 drv->kobj.kset = &bus->drivers;
613 if ((error = kobject_register(&drv->kobj))) 623 error = kobject_register(&drv->kobj);
624 if (error)
614 goto out_put_bus; 625 goto out_put_bus;
615 626
616 if (drv->bus->drivers_autoprobe) { 627 if (drv->bus->drivers_autoprobe) {
@@ -760,7 +771,8 @@ static int bus_add_attrs(struct bus_type * bus)
760 771
761 if (bus->bus_attrs) { 772 if (bus->bus_attrs) {
762 for (i = 0; attr_name(bus->bus_attrs[i]); i++) { 773 for (i = 0; attr_name(bus->bus_attrs[i]); i++) {
763 if ((error = bus_create_file(bus,&bus->bus_attrs[i]))) 774 error = bus_create_file(bus,&bus->bus_attrs[i]);
775 if (error)
764 goto Err; 776 goto Err;
765 } 777 }
766 } 778 }