diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
commit | dc690d8ef842b464f1c429a376ca16cb8dbee6ae (patch) | |
tree | 77955849af5a15755f5e55e24ae4b9c520583a72 /drivers/base/bus.c | |
parent | 57399ec9077a4b962b81037aaa279fab52f5e989 (diff) | |
parent | 91a6902958f052358899f58683d44e36228d85c2 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (61 commits)
sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
sysfs: make directory dentries and inodes reclaimable
sysfs: implement sysfs_get_dentry()
sysfs: move sysfs_drop_dentry() to dir.c and make it static
sysfs: restructure add/remove paths and fix inode update
sysfs: use sysfs_mutex to protect the sysfs_dirent tree
sysfs: consolidate sysfs spinlocks
sysfs: make kobj point to sysfs_dirent instead of dentry
sysfs: implement sysfs_find_dirent() and sysfs_get_dirent()
sysfs: implement SYSFS_FLAG_REMOVED flag
sysfs: rename sysfs_dirent->s_type to s_flags and make room for flags
sysfs: make sysfs_drop_dentry() access inodes using ilookup()
sysfs: Fix oops in sysfs_drop_dentry on x86_64
sysfs: use singly-linked list for sysfs_dirent tree
sysfs: slim down sysfs_dirent->s_active
sysfs: move s_active functions to fs/sysfs/dir.c
sysfs: fix root sysfs_dirent -> root dentry association
sysfs: use iget_locked() instead of new_inode()
sysfs: reorganize sysfs_new_indoe() and sysfs_create()
sysfs: fix parent refcounting during rename and move
...
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 24 |
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 | ||
141 | static struct kobj_type ktype_bus = { | 141 | static struct kobj_type bus_ktype = { |
142 | .sysfs_ops = &bus_sysfs_ops, | 142 | .sysfs_ops = &bus_sysfs_ops, |
143 | }; | ||
144 | |||
145 | static 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 | |||
154 | static struct kset_uevent_ops bus_uevent_ops = { | ||
155 | .filter = bus_uevent_filter, | ||
144 | }; | 156 | }; |
145 | 157 | ||
146 | static decl_subsys(bus, &ktype_bus, NULL); | 158 | static 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 | } |