diff options
author | Tejun Heo <htejun@gmail.com> | 2007-06-13 14:45:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:09:06 -0400 |
commit | 7b595756ec1f49e0049a9e01a1298d53a7faaa15 (patch) | |
tree | cd06687ab3e5c7a5a4ef91903dff207a18c4db76 /drivers/base | |
parent | dbde0fcf9f8f6d477af3c32d9979e789ee680cde (diff) |
sysfs: kill unnecessary attribute->owner
sysfs is now completely out of driver/module lifetime game. After
deletion, a sysfs node doesn't access anything outside sysfs proper,
so there's no reason to hold onto the attribute owners. Note that
often the wrong modules were accounted for as owners leading to
accessing removed modules.
This patch kills now unnecessary attribute->owner. Note that with
this change, userland holding a sysfs node does not prevent the
backing module from being unloaded.
For more info regarding lifetime rule cleanup, please read the
following message.
http://article.gmane.org/gmane.linux.kernel/510293
(tweaked by Greg to not delete the field just yet, to make it easier to
merge things properly.)
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/bus.c | 2 | ||||
-rw-r--r-- | drivers/base/class.c | 2 | ||||
-rw-r--r-- | drivers/base/core.c | 4 | ||||
-rw-r--r-- | drivers/base/firmware_class.c | 2 |
4 files changed, 1 insertions, 9 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index f299e0d6abc4..61c67526a656 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -574,7 +574,6 @@ static int add_probe_files(struct bus_type *bus) | |||
574 | 574 | ||
575 | bus->drivers_probe_attr.attr.name = "drivers_probe"; | 575 | bus->drivers_probe_attr.attr.name = "drivers_probe"; |
576 | bus->drivers_probe_attr.attr.mode = S_IWUSR; | 576 | bus->drivers_probe_attr.attr.mode = S_IWUSR; |
577 | bus->drivers_probe_attr.attr.owner = bus->owner; | ||
578 | bus->drivers_probe_attr.store = store_drivers_probe; | 577 | bus->drivers_probe_attr.store = store_drivers_probe; |
579 | retval = bus_create_file(bus, &bus->drivers_probe_attr); | 578 | retval = bus_create_file(bus, &bus->drivers_probe_attr); |
580 | if (retval) | 579 | if (retval) |
@@ -582,7 +581,6 @@ static int add_probe_files(struct bus_type *bus) | |||
582 | 581 | ||
583 | bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; | 582 | bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; |
584 | bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; | 583 | bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; |
585 | bus->drivers_autoprobe_attr.attr.owner = bus->owner; | ||
586 | bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; | 584 | bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; |
587 | bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; | 585 | bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; |
588 | retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); | 586 | retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); |
diff --git a/drivers/base/class.c b/drivers/base/class.c index 8c506dbe3913..9cbfde23b9e3 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -605,7 +605,6 @@ int class_device_add(struct class_device *class_dev) | |||
605 | goto out3; | 605 | goto out3; |
606 | class_dev->uevent_attr.attr.name = "uevent"; | 606 | class_dev->uevent_attr.attr.name = "uevent"; |
607 | class_dev->uevent_attr.attr.mode = S_IWUSR; | 607 | class_dev->uevent_attr.attr.mode = S_IWUSR; |
608 | class_dev->uevent_attr.attr.owner = parent_class->owner; | ||
609 | class_dev->uevent_attr.store = store_uevent; | 608 | class_dev->uevent_attr.store = store_uevent; |
610 | error = class_device_create_file(class_dev, &class_dev->uevent_attr); | 609 | error = class_device_create_file(class_dev, &class_dev->uevent_attr); |
611 | if (error) | 610 | if (error) |
@@ -620,7 +619,6 @@ int class_device_add(struct class_device *class_dev) | |||
620 | } | 619 | } |
621 | attr->attr.name = "dev"; | 620 | attr->attr.name = "dev"; |
622 | attr->attr.mode = S_IRUGO; | 621 | attr->attr.mode = S_IRUGO; |
623 | attr->attr.owner = parent_class->owner; | ||
624 | attr->show = show_dev; | 622 | attr->show = show_dev; |
625 | error = class_device_create_file(class_dev, attr); | 623 | error = class_device_create_file(class_dev, attr); |
626 | if (error) { | 624 | if (error) { |
diff --git a/drivers/base/core.c b/drivers/base/core.c index cff4fbfbb055..e3fb87bfc6e1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -683,8 +683,6 @@ int device_add(struct device *dev) | |||
683 | 683 | ||
684 | dev->uevent_attr.attr.name = "uevent"; | 684 | dev->uevent_attr.attr.name = "uevent"; |
685 | dev->uevent_attr.attr.mode = S_IRUGO | S_IWUSR; | 685 | dev->uevent_attr.attr.mode = S_IRUGO | S_IWUSR; |
686 | if (dev->driver) | ||
687 | dev->uevent_attr.attr.owner = dev->driver->owner; | ||
688 | dev->uevent_attr.store = store_uevent; | 686 | dev->uevent_attr.store = store_uevent; |
689 | dev->uevent_attr.show = show_uevent; | 687 | dev->uevent_attr.show = show_uevent; |
690 | error = device_create_file(dev, &dev->uevent_attr); | 688 | error = device_create_file(dev, &dev->uevent_attr); |
@@ -700,8 +698,6 @@ int device_add(struct device *dev) | |||
700 | } | 698 | } |
701 | attr->attr.name = "dev"; | 699 | attr->attr.name = "dev"; |
702 | attr->attr.mode = S_IRUGO; | 700 | attr->attr.mode = S_IRUGO; |
703 | if (dev->driver) | ||
704 | attr->attr.owner = dev->driver->owner; | ||
705 | attr->show = show_dev; | 701 | attr->show = show_dev; |
706 | error = device_create_file(dev, attr); | 702 | error = device_create_file(dev, attr); |
707 | if (error) { | 703 | if (error) { |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 89a5f4a54913..0e511485d2e6 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -271,7 +271,7 @@ out: | |||
271 | } | 271 | } |
272 | 272 | ||
273 | static struct bin_attribute firmware_attr_data_tmpl = { | 273 | static struct bin_attribute firmware_attr_data_tmpl = { |
274 | .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE}, | 274 | .attr = {.name = "data", .mode = 0644}, |
275 | .size = 0, | 275 | .size = 0, |
276 | .read = firmware_data_read, | 276 | .read = firmware_data_read, |
277 | .write = firmware_data_write, | 277 | .write = firmware_data_write, |