aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/bus.c16
-rw-r--r--lib/kobject.c9
2 files changed, 22 insertions, 3 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index dca734819e50..7ff5aafe2167 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);
148
149 if (ktype == &bus_ktype)
150 return 1;
151 return 0;
152}
143 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
diff --git a/lib/kobject.c b/lib/kobject.c
index ac1520651b9b..b4ebd7631700 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -597,10 +597,17 @@ int kset_add(struct kset * k)
597 597
598int kset_register(struct kset * k) 598int kset_register(struct kset * k)
599{ 599{
600 int err;
601
600 if (!k) 602 if (!k)
601 return -EINVAL; 603 return -EINVAL;
604
602 kset_init(k); 605 kset_init(k);
603 return kset_add(k); 606 err = kset_add(k);
607 if (err)
608 return err;
609 kobject_uevent(&k->kobj, KOBJ_ADD);
610 return 0;
604} 611}
605 612
606 613