Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b595756 authored by Tejun Heo's avatar Tejun Heo Committed by Greg Kroah-Hartman
Browse files

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: default avatarTejun Heo <htejun@gmail.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dbde0fcf
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -2415,7 +2415,6 @@ static struct bin_attribute mv64xxx_hs_reg_attr = { /* Hotswap register */
	.attr = {
	.attr = {
		.name = "hs_reg",
		.name = "hs_reg",
		.mode = S_IRUGO | S_IWUSR,
		.mode = S_IRUGO | S_IWUSR,
		.owner = THIS_MODULE,
	},
	},
	.size  = VAL_LEN_MAX,
	.size  = VAL_LEN_MAX,
	.read  = mv64xxx_hs_reg_read,
	.read  = mv64xxx_hs_reg_read,
+0 −2
Original line number Original line Diff line number Diff line
@@ -312,7 +312,6 @@ static struct bin_attribute ipl_parameter_attr = {
	.attr = {
	.attr = {
		.name = "binary_parameter",
		.name = "binary_parameter",
		.mode = S_IRUGO,
		.mode = S_IRUGO,
		.owner = THIS_MODULE,
	},
	},
	.size = PAGE_SIZE,
	.size = PAGE_SIZE,
	.read = &ipl_parameter_read,
	.read = &ipl_parameter_read,
@@ -336,7 +335,6 @@ static struct bin_attribute ipl_scp_data_attr = {
	.attr = {
	.attr = {
		.name = "scp_data",
		.name = "scp_data",
		.mode = S_IRUGO,
		.mode = S_IRUGO,
		.owner = THIS_MODULE,
	},
	},
	.size = PAGE_SIZE,
	.size = PAGE_SIZE,
	.read = &ipl_scp_data_read,
	.read = &ipl_scp_data_read,
+0 −2
Original line number Original line Diff line number Diff line
@@ -574,7 +574,6 @@ static int add_probe_files(struct bus_type *bus)


	bus->drivers_probe_attr.attr.name = "drivers_probe";
	bus->drivers_probe_attr.attr.name = "drivers_probe";
	bus->drivers_probe_attr.attr.mode = S_IWUSR;
	bus->drivers_probe_attr.attr.mode = S_IWUSR;
	bus->drivers_probe_attr.attr.owner = bus->owner;
	bus->drivers_probe_attr.store = store_drivers_probe;
	bus->drivers_probe_attr.store = store_drivers_probe;
	retval = bus_create_file(bus, &bus->drivers_probe_attr);
	retval = bus_create_file(bus, &bus->drivers_probe_attr);
	if (retval)
	if (retval)
@@ -582,7 +581,6 @@ static int add_probe_files(struct bus_type *bus)


	bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe";
	bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe";
	bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO;
	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.show = show_drivers_autoprobe;
	bus->drivers_autoprobe_attr.store = store_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->drivers_autoprobe_attr);
+0 −2
Original line number Original line Diff line number Diff line
@@ -605,7 +605,6 @@ int class_device_add(struct class_device *class_dev)
		goto out3;
		goto out3;
	class_dev->uevent_attr.attr.name = "uevent";
	class_dev->uevent_attr.attr.name = "uevent";
	class_dev->uevent_attr.attr.mode = S_IWUSR;
	class_dev->uevent_attr.attr.mode = S_IWUSR;
	class_dev->uevent_attr.attr.owner = parent_class->owner;
	class_dev->uevent_attr.store = store_uevent;
	class_dev->uevent_attr.store = store_uevent;
	error = class_device_create_file(class_dev, &class_dev->uevent_attr);
	error = class_device_create_file(class_dev, &class_dev->uevent_attr);
	if (error)
	if (error)
@@ -620,7 +619,6 @@ int class_device_add(struct class_device *class_dev)
		}
		}
		attr->attr.name = "dev";
		attr->attr.name = "dev";
		attr->attr.mode = S_IRUGO;
		attr->attr.mode = S_IRUGO;
		attr->attr.owner = parent_class->owner;
		attr->show = show_dev;
		attr->show = show_dev;
		error = class_device_create_file(class_dev, attr);
		error = class_device_create_file(class_dev, attr);
		if (error) {
		if (error) {
+0 −4
Original line number Original line Diff line number Diff line
@@ -683,8 +683,6 @@ int device_add(struct device *dev)


	dev->uevent_attr.attr.name = "uevent";
	dev->uevent_attr.attr.name = "uevent";
	dev->uevent_attr.attr.mode = S_IRUGO | S_IWUSR;
	dev->uevent_attr.attr.mode = S_IRUGO | S_IWUSR;
	if (dev->driver)
		dev->uevent_attr.attr.owner = dev->driver->owner;
	dev->uevent_attr.store = store_uevent;
	dev->uevent_attr.store = store_uevent;
	dev->uevent_attr.show = show_uevent;
	dev->uevent_attr.show = show_uevent;
	error = device_create_file(dev, &dev->uevent_attr);
	error = device_create_file(dev, &dev->uevent_attr);
@@ -700,8 +698,6 @@ int device_add(struct device *dev)
		}
		}
		attr->attr.name = "dev";
		attr->attr.name = "dev";
		attr->attr.mode = S_IRUGO;
		attr->attr.mode = S_IRUGO;
		if (dev->driver)
			attr->attr.owner = dev->driver->owner;
		attr->show = show_dev;
		attr->show = show_dev;
		error = device_create_file(dev, attr);
		error = device_create_file(dev, attr);
		if (error) {
		if (error) {
Loading