X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fbase%2Fbus.c;h=ff850d1b0d92020648021f4aa77371225de98239;hb=8380770c842faef3001e44662953d64ad9a93663;hp=dca734819e50cc670439f22806eac6198e8c29eb;hpb=805f53f085346b6765eda02820721a14ce0d644f;p=linux-2.6-omap-h63xx.git diff --git a/drivers/base/bus.c b/drivers/base/bus.c index dca734819e5..ff850d1b0d9 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) } } -static struct kobj_type ktype_bus = { +static struct kobj_type bus_ktype = { .sysfs_ops = &bus_sysfs_ops, +}; + +static int bus_uevent_filter(struct kset *kset, struct kobject *kobj) +{ + struct kobj_type *ktype = get_ktype(kobj); + + if (ktype == &bus_ktype) + return 1; + return 0; +} +static struct kset_uevent_ops bus_uevent_ops = { + .filter = bus_uevent_filter, }; -static decl_subsys(bus, &ktype_bus, NULL); +static decl_subsys(bus, &bus_ktype, &bus_uevent_ops); #ifdef CONFIG_HOTPLUG @@ -556,34 +568,29 @@ static void remove_bind_files(struct device_driver *drv) driver_remove_file(drv, &driver_attr_unbind); } +static BUS_ATTR(drivers_probe, S_IWUSR, NULL, store_drivers_probe); +static BUS_ATTR(drivers_autoprobe, S_IWUSR | S_IRUGO, + show_drivers_autoprobe, store_drivers_autoprobe); + static int add_probe_files(struct bus_type *bus) { int retval; - bus->drivers_probe_attr.attr.name = "drivers_probe"; - bus->drivers_probe_attr.attr.mode = S_IWUSR; - bus->drivers_probe_attr.attr.owner = bus->owner; - bus->drivers_probe_attr.store = store_drivers_probe; - retval = bus_create_file(bus, &bus->drivers_probe_attr); + retval = bus_create_file(bus, &bus_attr_drivers_probe); if (retval) goto out; - bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; - bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; - bus->drivers_autoprobe_attr.attr.owner = bus->owner; - bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; - bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; - retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); + retval = bus_create_file(bus, &bus_attr_drivers_autoprobe); if (retval) - bus_remove_file(bus, &bus->drivers_probe_attr); + bus_remove_file(bus, &bus_attr_drivers_probe); out: return retval; } static void remove_probe_files(struct bus_type *bus) { - bus_remove_file(bus, &bus->drivers_autoprobe_attr); - bus_remove_file(bus, &bus->drivers_probe_attr); + bus_remove_file(bus, &bus_attr_drivers_autoprobe); + bus_remove_file(bus, &bus_attr_drivers_probe); } #else static inline int add_bind_files(struct device_driver *drv) { return 0; } @@ -610,7 +617,8 @@ int bus_add_driver(struct device_driver *drv) if (error) goto out_put_bus; drv->kobj.kset = &bus->drivers; - if ((error = kobject_register(&drv->kobj))) + error = kobject_register(&drv->kobj); + if (error) goto out_put_bus; if (drv->bus->drivers_autoprobe) { @@ -760,7 +768,8 @@ static int bus_add_attrs(struct bus_type * bus) if (bus->bus_attrs) { for (i = 0; attr_name(bus->bus_attrs[i]); i++) { - if ((error = bus_create_file(bus,&bus->bus_attrs[i]))) + error = bus_create_file(bus,&bus->bus_attrs[i]); + if (error) goto Err; } }