aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-13 14:45:17 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:06 -0400
commit7b595756ec1f49e0049a9e01a1298d53a7faaa15 (patch)
treecd06687ab3e5c7a5a4ef91903dff207a18c4db76
parentdbde0fcf9f8f6d477af3c32d9979e789ee680cde (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>
-rw-r--r--arch/ppc/syslib/mv64x60.c1
-rw-r--r--arch/s390/kernel/ipl.c2
-rw-r--r--drivers/base/bus.c2
-rw-r--r--drivers/base/class.c2
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/firmware_class.c2
-rw-r--r--drivers/block/pktcdvd.c3
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c10
-rw-r--r--drivers/cpufreq/cpufreq_stats.c3
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c2
-rw-r--r--drivers/cpufreq/freq_table.c1
-rw-r--r--drivers/firmware/dcdbas.h3
-rw-r--r--drivers/firmware/dell_rbu.c6
-rw-r--r--drivers/firmware/edd.c2
-rw-r--r--drivers/firmware/efivars.c6
-rw-r--r--drivers/i2c/chips/eeprom.c1
-rw-r--r--drivers/i2c/chips/max6875.c1
-rw-r--r--drivers/infiniband/core/sysfs.c1
-rw-r--r--drivers/input/mouse/psmouse.h1
-rw-r--r--drivers/macintosh/windfarm_core.c2
-rw-r--r--drivers/misc/asus-laptop.c3
-rw-r--r--drivers/net/ibmveth.c2
-rw-r--r--drivers/parisc/pdc_stable.c4
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c1
-rw-r--r--drivers/pci/pci-sysfs.c4
-rw-r--r--drivers/pci/probe.c2
-rw-r--r--drivers/pcmcia/socket_sysfs.c2
-rw-r--r--drivers/rapidio/rio-sysfs.c1
-rw-r--r--drivers/rtc/rtc-ds1553.c1
-rw-r--r--drivers/rtc/rtc-ds1742.c1
-rw-r--r--drivers/s390/cio/chp.c2
-rw-r--r--drivers/s390/net/qeth_sys.c2
-rw-r--r--drivers/scsi/arcmsr/arcmsr_attr.c3
-rw-r--r--drivers/scsi/libsas/sas_expander.c1
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c6
-rw-r--r--drivers/spi/at25.c1
-rw-r--r--drivers/video/aty/radeon_base.c2
-rw-r--r--drivers/video/backlight/backlight.c2
-rw-r--r--drivers/video/backlight/lcd.c2
-rw-r--r--drivers/w1/slaves/w1_ds2433.c1
-rw-r--r--drivers/w1/slaves/w1_therm.c1
-rw-r--r--drivers/w1/w1.c2
-rw-r--r--drivers/zorro/zorro-sysfs.c1
-rw-r--r--fs/ecryptfs/main.c2
-rw-r--r--fs/ocfs2/cluster/masklog.c1
-rw-r--r--fs/partitions/check.c1
-rw-r--r--fs/sysfs/bin.c19
-rw-r--r--fs/sysfs/file.c21
-rw-r--r--include/linux/sysdev.h3
-rw-r--r--include/linux/sysfs.h12
-rw-r--r--kernel/module.c9
-rw-r--r--kernel/params.c1
-rw-r--r--net/bridge/br_sysfs_br.c3
-rw-r--r--net/bridge/br_sysfs_if.c3
55 files changed, 44 insertions, 135 deletions
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index 8485a68cd475..032f4b7f4225 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -2415,7 +2415,6 @@ static struct bin_attribute mv64xxx_hs_reg_attr = { /* Hotswap register */
2415 .attr = { 2415 .attr = {
2416 .name = "hs_reg", 2416 .name = "hs_reg",
2417 .mode = S_IRUGO | S_IWUSR, 2417 .mode = S_IRUGO | S_IWUSR,
2418 .owner = THIS_MODULE,
2419 }, 2418 },
2420 .size = VAL_LEN_MAX, 2419 .size = VAL_LEN_MAX,
2421 .read = mv64xxx_hs_reg_read, 2420 .read = mv64xxx_hs_reg_read,
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 82b131ddd7ff..9a13b24ee1ab 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -312,7 +312,6 @@ static struct bin_attribute ipl_parameter_attr = {
312 .attr = { 312 .attr = {
313 .name = "binary_parameter", 313 .name = "binary_parameter",
314 .mode = S_IRUGO, 314 .mode = S_IRUGO,
315 .owner = THIS_MODULE,
316 }, 315 },
317 .size = PAGE_SIZE, 316 .size = PAGE_SIZE,
318 .read = &ipl_parameter_read, 317 .read = &ipl_parameter_read,
@@ -336,7 +335,6 @@ static struct bin_attribute ipl_scp_data_attr = {
336 .attr = { 335 .attr = {
337 .name = "scp_data", 336 .name = "scp_data",
338 .mode = S_IRUGO, 337 .mode = S_IRUGO,
339 .owner = THIS_MODULE,
340 }, 338 },
341 .size = PAGE_SIZE, 339 .size = PAGE_SIZE,
342 .read = &ipl_scp_data_read, 340 .read = &ipl_scp_data_read,
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
273static struct bin_attribute firmware_attr_data_tmpl = { 273static 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,
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index f1b9dd7d47d6..ce64e86d6ffb 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -146,8 +146,7 @@ static void pkt_kobj_release(struct kobject *kobj)
146 **********************************************************/ 146 **********************************************************/
147 147
148#define DEF_ATTR(_obj,_name,_mode) \ 148#define DEF_ATTR(_obj,_name,_mode) \
149 static struct attribute _obj = { \ 149 static struct attribute _obj = { .name = _name, .mode = _mode }
150 .name = _name, .owner = THIS_MODULE, .mode = _mode }
151 150
152/********************************************************** 151/**********************************************************
153 /sys/class/pktcdvd/pktcdvd[0-7]/ 152 /sys/class/pktcdvd/pktcdvd[0-7]/
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 8e222f2b80cc..b5df7e61aeb2 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2171,52 +2171,42 @@ static int create_files(struct bmc_device *bmc)
2171 int err; 2171 int err;
2172 2172
2173 bmc->device_id_attr.attr.name = "device_id"; 2173 bmc->device_id_attr.attr.name = "device_id";
2174 bmc->device_id_attr.attr.owner = THIS_MODULE;
2175 bmc->device_id_attr.attr.mode = S_IRUGO; 2174 bmc->device_id_attr.attr.mode = S_IRUGO;
2176 bmc->device_id_attr.show = device_id_show; 2175 bmc->device_id_attr.show = device_id_show;
2177 2176
2178 bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs"; 2177 bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs";
2179 bmc->provides_dev_sdrs_attr.attr.owner = THIS_MODULE;
2180 bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO; 2178 bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO;
2181 bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show; 2179 bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show;
2182 2180
2183 bmc->revision_attr.attr.name = "revision"; 2181 bmc->revision_attr.attr.name = "revision";
2184 bmc->revision_attr.attr.owner = THIS_MODULE;
2185 bmc->revision_attr.attr.mode = S_IRUGO; 2182 bmc->revision_attr.attr.mode = S_IRUGO;
2186 bmc->revision_attr.show = revision_show; 2183 bmc->revision_attr.show = revision_show;
2187 2184
2188 bmc->firmware_rev_attr.attr.name = "firmware_revision"; 2185 bmc->firmware_rev_attr.attr.name = "firmware_revision";
2189 bmc->firmware_rev_attr.attr.owner = THIS_MODULE;
2190 bmc->firmware_rev_attr.attr.mode = S_IRUGO; 2186 bmc->firmware_rev_attr.attr.mode = S_IRUGO;
2191 bmc->firmware_rev_attr.show = firmware_rev_show; 2187 bmc->firmware_rev_attr.show = firmware_rev_show;
2192 2188
2193 bmc->version_attr.attr.name = "ipmi_version"; 2189 bmc->version_attr.attr.name = "ipmi_version";
2194 bmc->version_attr.attr.owner = THIS_MODULE;
2195 bmc->version_attr.attr.mode = S_IRUGO; 2190 bmc->version_attr.attr.mode = S_IRUGO;
2196 bmc->version_attr.show = ipmi_version_show; 2191 bmc->version_attr.show = ipmi_version_show;
2197 2192
2198 bmc->add_dev_support_attr.attr.name = "additional_device_support"; 2193 bmc->add_dev_support_attr.attr.name = "additional_device_support";
2199 bmc->add_dev_support_attr.attr.owner = THIS_MODULE;
2200 bmc->add_dev_support_attr.attr.mode = S_IRUGO; 2194 bmc->add_dev_support_attr.attr.mode = S_IRUGO;
2201 bmc->add_dev_support_attr.show = add_dev_support_show; 2195 bmc->add_dev_support_attr.show = add_dev_support_show;
2202 2196
2203 bmc->manufacturer_id_attr.attr.name = "manufacturer_id"; 2197 bmc->manufacturer_id_attr.attr.name = "manufacturer_id";
2204 bmc->manufacturer_id_attr.attr.owner = THIS_MODULE;
2205 bmc->manufacturer_id_attr.attr.mode = S_IRUGO; 2198 bmc->manufacturer_id_attr.attr.mode = S_IRUGO;
2206 bmc->manufacturer_id_attr.show = manufacturer_id_show; 2199 bmc->manufacturer_id_attr.show = manufacturer_id_show;
2207 2200
2208 bmc->product_id_attr.attr.name = "product_id"; 2201 bmc->product_id_attr.attr.name = "product_id";
2209 bmc->product_id_attr.attr.owner = THIS_MODULE;
2210 bmc->product_id_attr.attr.mode = S_IRUGO; 2202 bmc->product_id_attr.attr.mode = S_IRUGO;
2211 bmc->product_id_attr.show = product_id_show; 2203 bmc->product_id_attr.show = product_id_show;
2212 2204
2213 bmc->guid_attr.attr.name = "guid"; 2205 bmc->guid_attr.attr.name = "guid";
2214 bmc->guid_attr.attr.owner = THIS_MODULE;
2215 bmc->guid_attr.attr.mode = S_IRUGO; 2206 bmc->guid_attr.attr.mode = S_IRUGO;
2216 bmc->guid_attr.show = guid_show; 2207 bmc->guid_attr.show = guid_show;
2217 2208
2218 bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; 2209 bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision";
2219 bmc->aux_firmware_rev_attr.attr.owner = THIS_MODULE;
2220 bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO; 2210 bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO;
2221 bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show; 2211 bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show;
2222 2212
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index d2f0cbd8b8f3..917b9bab9ccb 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -25,8 +25,7 @@ static spinlock_t cpufreq_stats_lock;
25 25
26#define CPUFREQ_STATDEVICE_ATTR(_name,_mode,_show) \ 26#define CPUFREQ_STATDEVICE_ATTR(_name,_mode,_show) \
27static struct freq_attr _attr_##_name = {\ 27static struct freq_attr _attr_##_name = {\
28 .attr = {.name = __stringify(_name), .owner = THIS_MODULE, \ 28 .attr = {.name = __stringify(_name), .mode = _mode, }, \
29 .mode = _mode, }, \
30 .show = _show,\ 29 .show = _show,\
31}; 30};
32 31
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 860345c7799a..a648970338b0 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -120,7 +120,7 @@ store_speed (struct cpufreq_policy *policy, const char *buf, size_t count)
120 120
121static struct freq_attr freq_attr_scaling_setspeed = 121static struct freq_attr freq_attr_scaling_setspeed =
122{ 122{
123 .attr = { .name = "scaling_setspeed", .mode = 0644, .owner = THIS_MODULE }, 123 .attr = { .name = "scaling_setspeed", .mode = 0644 },
124 .show = show_speed, 124 .show = show_speed,
125 .store = store_speed, 125 .store = store_speed,
126}; 126};
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index e7490925fdcf..5409f3afb3f8 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -199,7 +199,6 @@ static ssize_t show_available_freqs (struct cpufreq_policy *policy, char *buf)
199struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { 199struct freq_attr cpufreq_freq_attr_scaling_available_freqs = {
200 .attr = { .name = "scaling_available_frequencies", 200 .attr = { .name = "scaling_available_frequencies",
201 .mode = 0444, 201 .mode = 0444,
202 .owner=THIS_MODULE
203 }, 202 },
204 .show = show_available_freqs, 203 .show = show_available_freqs,
205}; 204};
diff --git a/drivers/firmware/dcdbas.h b/drivers/firmware/dcdbas.h
index 58a85182b3e8..dcdba0f1b32c 100644
--- a/drivers/firmware/dcdbas.h
+++ b/drivers/firmware/dcdbas.h
@@ -67,8 +67,7 @@
67#define DCDBAS_BIN_ATTR_RW(_name) \ 67#define DCDBAS_BIN_ATTR_RW(_name) \
68struct bin_attribute bin_attr_##_name = { \ 68struct bin_attribute bin_attr_##_name = { \
69 .attr = { .name = __stringify(_name), \ 69 .attr = { .name = __stringify(_name), \
70 .mode = 0600, \ 70 .mode = 0600 }, \
71 .owner = THIS_MODULE }, \
72 .read = _name##_read, \ 71 .read = _name##_read, \
73 .write = _name##_write, \ 72 .write = _name##_write, \
74} 73}
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index fc702e40bd43..f8afecb7d0cf 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -687,18 +687,18 @@ static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer,
687} 687}
688 688
689static struct bin_attribute rbu_data_attr = { 689static struct bin_attribute rbu_data_attr = {
690 .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444}, 690 .attr = {.name = "data", .mode = 0444},
691 .read = read_rbu_data, 691 .read = read_rbu_data,
692}; 692};
693 693
694static struct bin_attribute rbu_image_type_attr = { 694static struct bin_attribute rbu_image_type_attr = {
695 .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644}, 695 .attr = {.name = "image_type", .mode = 0644},
696 .read = read_rbu_image_type, 696 .read = read_rbu_image_type,
697 .write = write_rbu_image_type, 697 .write = write_rbu_image_type,
698}; 698};
699 699
700static struct bin_attribute rbu_packet_size_attr = { 700static struct bin_attribute rbu_packet_size_attr = {
701 .attr = {.name = "packet_size",.owner = THIS_MODULE,.mode = 0644}, 701 .attr = {.name = "packet_size", .mode = 0644},
702 .read = read_rbu_packet_size, 702 .read = read_rbu_packet_size,
703 .write = write_rbu_packet_size, 703 .write = write_rbu_packet_size,
704}; 704};
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index d8806e4f1829..15232271d848 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -74,7 +74,7 @@ static struct edd_device *edd_devices[EDD_MBR_SIG_MAX];
74 74
75#define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \ 75#define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \
76struct edd_attribute edd_attr_##_name = { \ 76struct edd_attribute edd_attr_##_name = { \
77 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ 77 .attr = {.name = __stringify(_name), .mode = _mode }, \
78 .show = _show, \ 78 .show = _show, \
79 .test = _test, \ 79 .test = _test, \
80}; 80};
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 1324984a4c35..bfd2d67df689 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -131,21 +131,21 @@ struct efivar_attribute {
131 131
132#define EFI_ATTR(_name, _mode, _show, _store) \ 132#define EFI_ATTR(_name, _mode, _show, _store) \
133struct subsys_attribute efi_attr_##_name = { \ 133struct subsys_attribute efi_attr_##_name = { \
134 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ 134 .attr = {.name = __stringify(_name), .mode = _mode}, \
135 .show = _show, \ 135 .show = _show, \
136 .store = _store, \ 136 .store = _store, \
137}; 137};
138 138
139#define EFIVAR_ATTR(_name, _mode, _show, _store) \ 139#define EFIVAR_ATTR(_name, _mode, _show, _store) \
140struct efivar_attribute efivar_attr_##_name = { \ 140struct efivar_attribute efivar_attr_##_name = { \
141 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ 141 .attr = {.name = __stringify(_name), .mode = _mode}, \
142 .show = _show, \ 142 .show = _show, \
143 .store = _store, \ 143 .store = _store, \
144}; 144};
145 145
146#define VAR_SUBSYS_ATTR(_name, _mode, _show, _store) \ 146#define VAR_SUBSYS_ATTR(_name, _mode, _show, _store) \
147struct subsys_attribute var_subsys_attr_##_name = { \ 147struct subsys_attribute var_subsys_attr_##_name = { \
148 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ 148 .attr = {.name = __stringify(_name), .mode = _mode}, \
149 .show = _show, \ 149 .show = _show, \
150 .store = _store, \ 150 .store = _store, \
151}; 151};
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index bfce13c8f1ff..5990dd5fc773 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -143,7 +143,6 @@ static struct bin_attribute eeprom_attr = {
143 .attr = { 143 .attr = {
144 .name = "eeprom", 144 .name = "eeprom",
145 .mode = S_IRUGO, 145 .mode = S_IRUGO,
146 .owner = THIS_MODULE,
147 }, 146 },
148 .size = EEPROM_SIZE, 147 .size = EEPROM_SIZE,
149 .read = eeprom_read, 148 .read = eeprom_read,
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index 76645c142977..1405ce5b236c 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -152,7 +152,6 @@ static struct bin_attribute user_eeprom_attr = {
152 .attr = { 152 .attr = {
153 .name = "eeprom", 153 .name = "eeprom",
154 .mode = S_IRUGO, 154 .mode = S_IRUGO,
155 .owner = THIS_MODULE,
156 }, 155 },
157 .size = USER_EEPROM_SIZE, 156 .size = USER_EEPROM_SIZE,
158 .read = max6875_read, 157 .read = max6875_read,
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 08c299ebf4a8..bf9b99292048 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -479,7 +479,6 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *,
479 479
480 element->attr.attr.name = element->name; 480 element->attr.attr.name = element->name;
481 element->attr.attr.mode = S_IRUGO; 481 element->attr.attr.mode = S_IRUGO;
482 element->attr.attr.owner = THIS_MODULE;
483 element->attr.show = show; 482 element->attr.show = show;
484 element->index = i; 483 element->index = i;
485 484
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 27a68835b5ba..1317bdd8cc7c 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -119,7 +119,6 @@ static struct psmouse_attribute psmouse_attr_##_name = { \
119 .attr = { \ 119 .attr = { \
120 .name = __stringify(_name), \ 120 .name = __stringify(_name), \
121 .mode = _mode, \ 121 .mode = _mode, \
122 .owner = THIS_MODULE, \
123 }, \ 122 }, \
124 .show = psmouse_attr_show_helper, \ 123 .show = psmouse_attr_show_helper, \
125 .store = psmouse_attr_set_helper, \ 124 .store = psmouse_attr_set_helper, \
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 11ced17f438a..4fcb245ba184 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -212,7 +212,6 @@ int wf_register_control(struct wf_control *new_ct)
212 list_add(&new_ct->link, &wf_controls); 212 list_add(&new_ct->link, &wf_controls);
213 213
214 new_ct->attr.attr.name = new_ct->name; 214 new_ct->attr.attr.name = new_ct->name;
215 new_ct->attr.attr.owner = THIS_MODULE;
216 new_ct->attr.attr.mode = 0644; 215 new_ct->attr.attr.mode = 0644;
217 new_ct->attr.show = wf_show_control; 216 new_ct->attr.show = wf_show_control;
218 new_ct->attr.store = wf_store_control; 217 new_ct->attr.store = wf_store_control;
@@ -325,7 +324,6 @@ int wf_register_sensor(struct wf_sensor *new_sr)
325 list_add(&new_sr->link, &wf_sensors); 324 list_add(&new_sr->link, &wf_sensors);
326 325
327 new_sr->attr.attr.name = new_sr->name; 326 new_sr->attr.attr.name = new_sr->name;
328 new_sr->attr.attr.owner = THIS_MODULE;
329 new_sr->attr.attr.mode = 0444; 327 new_sr->attr.attr.mode = 0444;
330 new_sr->attr.show = wf_show_sensor; 328 new_sr->attr.show = wf_show_sensor;
331 new_sr->attr.store = NULL; 329 new_sr->attr.store = NULL;
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 4f9060a2a2f2..7798f590e5aa 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -737,8 +737,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
737 struct device_attribute dev_attr_##_name = { \ 737 struct device_attribute dev_attr_##_name = { \
738 .attr = { \ 738 .attr = { \
739 .name = __stringify(_name), \ 739 .name = __stringify(_name), \
740 .mode = 0, \ 740 .mode = 0 }, \
741 .owner = THIS_MODULE }, \
742 .show = NULL, \ 741 .show = NULL, \
743 .store = NULL, \ 742 .store = NULL, \
744 } 743 }
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 6ec3d500f334..d96eb7229548 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1337,7 +1337,7 @@ const char * buf, size_t count)
1337 1337
1338#define ATTR(_name, _mode) \ 1338#define ATTR(_name, _mode) \
1339 struct attribute veth_##_name##_attr = { \ 1339 struct attribute veth_##_name##_attr = { \
1340 .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE \ 1340 .name = __stringify(_name), .mode = _mode, \
1341 }; 1341 };
1342 1342
1343static ATTR(active, 0644); 1343static ATTR(active, 0644);
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 924ef0609460..fc4bde259dc7 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -121,14 +121,14 @@ struct pdcspath_entry pdcspath_entry_##_name = { \
121 121
122#define PDCS_ATTR(_name, _mode, _show, _store) \ 122#define PDCS_ATTR(_name, _mode, _show, _store) \
123struct subsys_attribute pdcs_attr_##_name = { \ 123struct subsys_attribute pdcs_attr_##_name = { \
124 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ 124 .attr = {.name = __stringify(_name), .mode = _mode}, \
125 .show = _show, \ 125 .show = _show, \
126 .store = _store, \ 126 .store = _store, \
127}; 127};
128 128
129#define PATHS_ATTR(_name, _mode, _show, _store) \ 129#define PATHS_ATTR(_name, _mode, _show, _store) \
130struct pdcspath_attribute paths_attr_##_name = { \ 130struct pdcspath_attribute paths_attr_##_name = { \
131 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ 131 .attr = {.name = __stringify(_name), .mode = _mode}, \
132 .show = _show, \ 132 .show = _show, \
133 .store = _store, \ 133 .store = _store, \
134}; 134};
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index e7322c25d377..74556ec31a5b 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -117,7 +117,6 @@ static struct notification ibm_note;
117static struct bin_attribute ibm_apci_table_attr = { 117static struct bin_attribute ibm_apci_table_attr = {
118 .attr = { 118 .attr = {
119 .name = "apci_table", 119 .name = "apci_table",
120 .owner = THIS_MODULE,
121 .mode = S_IRUGO, 120 .mode = S_IRUGO,
122 }, 121 },
123 .read = ibm_read_apci_table, 122 .read = ibm_read_apci_table,
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 284e83a527f9..d448f8df8613 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -499,7 +499,6 @@ static int pci_create_resource_files(struct pci_dev *pdev)
499 sprintf(res_attr_name, "resource%d", i); 499 sprintf(res_attr_name, "resource%d", i);
500 res_attr->attr.name = res_attr_name; 500 res_attr->attr.name = res_attr_name;
501 res_attr->attr.mode = S_IRUSR | S_IWUSR; 501 res_attr->attr.mode = S_IRUSR | S_IWUSR;
502 res_attr->attr.owner = THIS_MODULE;
503 res_attr->size = pci_resource_len(pdev, i); 502 res_attr->size = pci_resource_len(pdev, i);
504 res_attr->mmap = pci_mmap_resource; 503 res_attr->mmap = pci_mmap_resource;
505 res_attr->private = &pdev->resource[i]; 504 res_attr->private = &pdev->resource[i];
@@ -582,7 +581,6 @@ static struct bin_attribute pci_config_attr = {
582 .attr = { 581 .attr = {
583 .name = "config", 582 .name = "config",
584 .mode = S_IRUGO | S_IWUSR, 583 .mode = S_IRUGO | S_IWUSR,
585 .owner = THIS_MODULE,
586 }, 584 },
587 .size = 256, 585 .size = 256,
588 .read = pci_read_config, 586 .read = pci_read_config,
@@ -593,7 +591,6 @@ static struct bin_attribute pcie_config_attr = {
593 .attr = { 591 .attr = {
594 .name = "config", 592 .name = "config",
595 .mode = S_IRUGO | S_IWUSR, 593 .mode = S_IRUGO | S_IWUSR,
596 .owner = THIS_MODULE,
597 }, 594 },
598 .size = 4096, 595 .size = 4096,
599 .read = pci_read_config, 596 .read = pci_read_config,
@@ -628,7 +625,6 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
628 rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); 625 rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
629 rom_attr->attr.name = "rom"; 626 rom_attr->attr.name = "rom";
630 rom_attr->attr.mode = S_IRUSR; 627 rom_attr->attr.mode = S_IRUSR;
631 rom_attr->attr.owner = THIS_MODULE;
632 rom_attr->read = pci_read_rom; 628 rom_attr->read = pci_read_rom;
633 rom_attr->write = pci_write_rom; 629 rom_attr->write = pci_write_rom;
634 retval = sysfs_create_bin_file(&pdev->dev.kobj, rom_attr); 630 retval = sysfs_create_bin_file(&pdev->dev.kobj, rom_attr);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e48fcf089621..08783bd381f5 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -39,7 +39,6 @@ static void pci_create_legacy_files(struct pci_bus *b)
39 b->legacy_io->attr.name = "legacy_io"; 39 b->legacy_io->attr.name = "legacy_io";
40 b->legacy_io->size = 0xffff; 40 b->legacy_io->size = 0xffff;
41 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; 41 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
42 b->legacy_io->attr.owner = THIS_MODULE;
43 b->legacy_io->read = pci_read_legacy_io; 42 b->legacy_io->read = pci_read_legacy_io;
44 b->legacy_io->write = pci_write_legacy_io; 43 b->legacy_io->write = pci_write_legacy_io;
45 class_device_create_bin_file(&b->class_dev, b->legacy_io); 44 class_device_create_bin_file(&b->class_dev, b->legacy_io);
@@ -49,7 +48,6 @@ static void pci_create_legacy_files(struct pci_bus *b)
49 b->legacy_mem->attr.name = "legacy_mem"; 48 b->legacy_mem->attr.name = "legacy_mem";
50 b->legacy_mem->size = 1024*1024; 49 b->legacy_mem->size = 1024*1024;
51 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; 50 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR;
52 b->legacy_mem->attr.owner = THIS_MODULE;
53 b->legacy_mem->mmap = pci_mmap_legacy_mem; 51 b->legacy_mem->mmap = pci_mmap_legacy_mem;
54 class_device_create_bin_file(&b->class_dev, b->legacy_mem); 52 class_device_create_bin_file(&b->class_dev, b->legacy_mem);
55 } 53 }
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index a2bb46526b56..dbfbe65779e5 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -366,7 +366,7 @@ static struct device_attribute *pccard_socket_attributes[] = {
366}; 366};
367 367
368static struct bin_attribute pccard_cis_attr = { 368static struct bin_attribute pccard_cis_attr = {
369 .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR, .owner = THIS_MODULE}, 369 .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
370 .size = 0x200, 370 .size = 0x200,
371 .read = pccard_show_cis, 371 .read = pccard_show_cis,
372 .write = pccard_store_cis, 372 .write = pccard_store_cis,
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index eed91434417d..a3972b9f96e6 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -197,7 +197,6 @@ static struct bin_attribute rio_config_attr = {
197 .attr = { 197 .attr = {
198 .name = "config", 198 .name = "config",
199 .mode = S_IRUGO | S_IWUSR, 199 .mode = S_IRUGO | S_IWUSR,
200 .owner = THIS_MODULE,
201 }, 200 },
202 .size = 0x200000, 201 .size = 0x200000,
203 .read = rio_read_config, 202 .read = rio_read_config,
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index afa64c7fa2e2..b024cfb558f4 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -290,7 +290,6 @@ static struct bin_attribute ds1553_nvram_attr = {
290 .attr = { 290 .attr = {
291 .name = "nvram", 291 .name = "nvram",
292 .mode = S_IRUGO | S_IWUGO, 292 .mode = S_IRUGO | S_IWUGO,
293 .owner = THIS_MODULE,
294 }, 293 },
295 .size = RTC_OFFSET, 294 .size = RTC_OFFSET,
296 .read = ds1553_nvram_read, 295 .read = ds1553_nvram_read,
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index d68288b389dc..1638acdbc913 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -159,7 +159,6 @@ static struct bin_attribute ds1742_nvram_attr = {
159 .attr = { 159 .attr = {
160 .name = "nvram", 160 .name = "nvram",
161 .mode = S_IRUGO | S_IWUGO, 161 .mode = S_IRUGO | S_IWUGO,
162 .owner = THIS_MODULE,
163 }, 162 },
164 .read = ds1742_nvram_read, 163 .read = ds1742_nvram_read,
165 .write = ds1742_nvram_write, 164 .write = ds1742_nvram_write,
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index ac289e6eadfe..96a8a72a6083 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -165,7 +165,6 @@ static struct bin_attribute chp_measurement_chars_attr = {
165 .attr = { 165 .attr = {
166 .name = "measurement_chars", 166 .name = "measurement_chars",
167 .mode = S_IRUSR, 167 .mode = S_IRUSR,
168 .owner = THIS_MODULE,
169 }, 168 },
170 .size = sizeof(struct cmg_chars), 169 .size = sizeof(struct cmg_chars),
171 .read = chp_measurement_chars_read, 170 .read = chp_measurement_chars_read,
@@ -217,7 +216,6 @@ static struct bin_attribute chp_measurement_attr = {
217 .attr = { 216 .attr = {
218 .name = "measurement", 217 .name = "measurement",
219 .mode = S_IRUSR, 218 .mode = S_IRUSR,
220 .owner = THIS_MODULE,
221 }, 219 },
222 .size = sizeof(struct cmg_entry), 220 .size = sizeof(struct cmg_entry),
223 .read = chp_measurement_read, 221 .read = chp_measurement_read,
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c
index 65ffc21afc37..bb0287ad1aac 100644
--- a/drivers/s390/net/qeth_sys.c
+++ b/drivers/s390/net/qeth_sys.c
@@ -991,7 +991,7 @@ static struct attribute_group qeth_osn_device_attr_group = {
991 991
992#define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \ 992#define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \
993struct device_attribute dev_attr_##_id = { \ 993struct device_attribute dev_attr_##_id = { \
994 .attr = {.name=__stringify(_name), .mode=_mode, .owner=THIS_MODULE },\ 994 .attr = {.name=__stringify(_name), .mode=_mode, },\
995 .show = _show, \ 995 .show = _show, \
996 .store = _store, \ 996 .store = _store, \
997}; 997};
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
index 03bfed61bffc..8908228bc134 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -188,7 +188,6 @@ static struct bin_attribute arcmsr_sysfs_message_read_attr = {
188 .attr = { 188 .attr = {
189 .name = "mu_read", 189 .name = "mu_read",
190 .mode = S_IRUSR , 190 .mode = S_IRUSR ,
191 .owner = THIS_MODULE,
192 }, 191 },
193 .size = 1032, 192 .size = 1032,
194 .read = arcmsr_sysfs_iop_message_read, 193 .read = arcmsr_sysfs_iop_message_read,
@@ -198,7 +197,6 @@ static struct bin_attribute arcmsr_sysfs_message_write_attr = {
198 .attr = { 197 .attr = {
199 .name = "mu_write", 198 .name = "mu_write",
200 .mode = S_IWUSR, 199 .mode = S_IWUSR,
201 .owner = THIS_MODULE,
202 }, 200 },
203 .size = 1032, 201 .size = 1032,
204 .write = arcmsr_sysfs_iop_message_write, 202 .write = arcmsr_sysfs_iop_message_write,
@@ -208,7 +206,6 @@ static struct bin_attribute arcmsr_sysfs_message_clear_attr = {
208 .attr = { 206 .attr = {
209 .name = "mu_clear", 207 .name = "mu_clear",
210 .mode = S_IWUSR, 208 .mode = S_IWUSR,
211 .owner = THIS_MODULE,
212 }, 209 },
213 .size = 1, 210 .size = 1,
214 .write = arcmsr_sysfs_iop_message_clear, 211 .write = arcmsr_sysfs_iop_message_clear,
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index e34442e405e8..578ed79f4148 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1368,7 +1368,6 @@ static void sas_ex_smp_hook(struct domain_device *dev)
1368 memset(bin_attr, 0, sizeof(*bin_attr)); 1368 memset(bin_attr, 0, sizeof(*bin_attr));
1369 1369
1370 bin_attr->attr.name = SMP_BIN_ATTR_NAME; 1370 bin_attr->attr.name = SMP_BIN_ATTR_NAME;
1371 bin_attr->attr.owner = THIS_MODULE;
1372 bin_attr->attr.mode = 0600; 1371 bin_attr->attr.mode = 0600;
1373 1372
1374 bin_attr->size = 0; 1373 bin_attr->size = 0;
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 95fe77e816f8..f81fe501a4a1 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1200,7 +1200,6 @@ static struct bin_attribute sysfs_ctlreg_attr = {
1200 .attr = { 1200 .attr = {
1201 .name = "ctlreg", 1201 .name = "ctlreg",
1202 .mode = S_IRUSR | S_IWUSR, 1202 .mode = S_IRUSR | S_IWUSR,
1203 .owner = THIS_MODULE,
1204 }, 1203 },
1205 .size = 256, 1204 .size = 256,
1206 .read = sysfs_ctlreg_read, 1205 .read = sysfs_ctlreg_read,
@@ -1422,7 +1421,6 @@ static struct bin_attribute sysfs_mbox_attr = {
1422 .attr = { 1421 .attr = {
1423 .name = "mbox", 1422 .name = "mbox",
1424 .mode = S_IRUSR | S_IWUSR, 1423 .mode = S_IRUSR | S_IWUSR,
1425 .owner = THIS_MODULE,
1426 }, 1424 },
1427 .size = MAILBOX_CMD_SIZE, 1425 .size = MAILBOX_CMD_SIZE,
1428 .read = sysfs_mbox_read, 1426 .read = sysfs_mbox_read,
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 8081b637d97e..96587253bfa9 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -73,7 +73,6 @@ static struct bin_attribute sysfs_fw_dump_attr = {
73 .attr = { 73 .attr = {
74 .name = "fw_dump", 74 .name = "fw_dump",
75 .mode = S_IRUSR | S_IWUSR, 75 .mode = S_IRUSR | S_IWUSR,
76 .owner = THIS_MODULE,
77 }, 76 },
78 .size = 0, 77 .size = 0,
79 .read = qla2x00_sysfs_read_fw_dump, 78 .read = qla2x00_sysfs_read_fw_dump,
@@ -149,7 +148,6 @@ static struct bin_attribute sysfs_nvram_attr = {
149 .attr = { 148 .attr = {
150 .name = "nvram", 149 .name = "nvram",
151 .mode = S_IRUSR | S_IWUSR, 150 .mode = S_IRUSR | S_IWUSR,
152 .owner = THIS_MODULE,
153 }, 151 },
154 .size = 512, 152 .size = 512,
155 .read = qla2x00_sysfs_read_nvram, 153 .read = qla2x00_sysfs_read_nvram,
@@ -198,7 +196,6 @@ static struct bin_attribute sysfs_optrom_attr = {
198 .attr = { 196 .attr = {
199 .name = "optrom", 197 .name = "optrom",
200 .mode = S_IRUSR | S_IWUSR, 198 .mode = S_IRUSR | S_IWUSR,
201 .owner = THIS_MODULE,
202 }, 199 },
203 .size = OPTROM_SIZE_24XX, 200 .size = OPTROM_SIZE_24XX,
204 .read = qla2x00_sysfs_read_optrom, 201 .read = qla2x00_sysfs_read_optrom,
@@ -279,7 +276,6 @@ static struct bin_attribute sysfs_optrom_ctl_attr = {
279 .attr = { 276 .attr = {
280 .name = "optrom_ctl", 277 .name = "optrom_ctl",
281 .mode = S_IWUSR, 278 .mode = S_IWUSR,
282 .owner = THIS_MODULE,
283 }, 279 },
284 .size = 0, 280 .size = 0,
285 .write = qla2x00_sysfs_write_optrom_ctl, 281 .write = qla2x00_sysfs_write_optrom_ctl,
@@ -327,7 +323,6 @@ static struct bin_attribute sysfs_vpd_attr = {
327 .attr = { 323 .attr = {
328 .name = "vpd", 324 .name = "vpd",
329 .mode = S_IRUSR | S_IWUSR, 325 .mode = S_IRUSR | S_IWUSR,
330 .owner = THIS_MODULE,
331 }, 326 },
332 .size = 0, 327 .size = 0,
333 .read = qla2x00_sysfs_read_vpd, 328 .read = qla2x00_sysfs_read_vpd,
@@ -375,7 +370,6 @@ static struct bin_attribute sysfs_sfp_attr = {
375 .attr = { 370 .attr = {
376 .name = "sfp", 371 .name = "sfp",
377 .mode = S_IRUSR | S_IWUSR, 372 .mode = S_IRUSR | S_IWUSR,
378 .owner = THIS_MODULE,
379 }, 373 },
380 .size = SFP_DEV_SIZE * 2, 374 .size = SFP_DEV_SIZE * 2,
381 .read = qla2x00_sysfs_read_sfp, 375 .read = qla2x00_sysfs_read_sfp,
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c
index 8efa07e8b8c2..fde1dededba3 100644
--- a/drivers/spi/at25.c
+++ b/drivers/spi/at25.c
@@ -314,7 +314,6 @@ static int at25_probe(struct spi_device *spi)
314 */ 314 */
315 at25->bin.attr.name = "eeprom"; 315 at25->bin.attr.name = "eeprom";
316 at25->bin.attr.mode = S_IRUSR; 316 at25->bin.attr.mode = S_IRUSR;
317 at25->bin.attr.owner = THIS_MODULE;
318 at25->bin.read = at25_bin_read; 317 at25->bin.read = at25_bin_read;
319 318
320 at25->bin.size = at25->chip.byte_len; 319 at25->bin.size = at25->chip.byte_len;
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 2ce050193018..3b3c6571f583 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2126,7 +2126,6 @@ static ssize_t radeon_show_edid2(struct kobject *kobj, char *buf, loff_t off, si
2126static struct bin_attribute edid1_attr = { 2126static struct bin_attribute edid1_attr = {
2127 .attr = { 2127 .attr = {
2128 .name = "edid1", 2128 .name = "edid1",
2129 .owner = THIS_MODULE,
2130 .mode = 0444, 2129 .mode = 0444,
2131 }, 2130 },
2132 .size = EDID_LENGTH, 2131 .size = EDID_LENGTH,
@@ -2136,7 +2135,6 @@ static struct bin_attribute edid1_attr = {
2136static struct bin_attribute edid2_attr = { 2135static struct bin_attribute edid2_attr = {
2137 .attr = { 2136 .attr = {
2138 .name = "edid2", 2137 .name = "edid2",
2139 .owner = THIS_MODULE,
2140 .mode = 0444, 2138 .mode = 0444,
2141 }, 2139 },
2142 .size = EDID_LENGTH, 2140 .size = EDID_LENGTH,
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index c65e81ff3578..7e06223bca94 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -172,7 +172,7 @@ static struct class backlight_class = {
172 172
173#define DECLARE_ATTR(_name,_mode,_show,_store) \ 173#define DECLARE_ATTR(_name,_mode,_show,_store) \
174{ \ 174{ \
175 .attr = { .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ 175 .attr = { .name = __stringify(_name), .mode = _mode }, \
176 .show = _show, \ 176 .show = _show, \
177 .store = _store, \ 177 .store = _store, \
178} 178}
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 6ef8f0a7a137..648b53c1fdea 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -157,7 +157,7 @@ static struct class lcd_class = {
157 157
158#define DECLARE_ATTR(_name,_mode,_show,_store) \ 158#define DECLARE_ATTR(_name,_mode,_show,_store) \
159{ \ 159{ \
160 .attr = { .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ 160 .attr = { .name = __stringify(_name), .mode = _mode }, \
161 .show = _show, \ 161 .show = _show, \
162 .store = _store, \ 162 .store = _store, \
163} 163}
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index 8ea17a53eed8..4e13aa71adea 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -252,7 +252,6 @@ static struct bin_attribute w1_f23_bin_attr = {
252 .attr = { 252 .attr = {
253 .name = "eeprom", 253 .name = "eeprom",
254 .mode = S_IRUGO | S_IWUSR, 254 .mode = S_IRUGO | S_IWUSR,
255 .owner = THIS_MODULE,
256 }, 255 },
257 .size = W1_EEPROM_SIZE, 256 .size = W1_EEPROM_SIZE,
258 .read = w1_f23_read_bin, 257 .read = w1_f23_read_bin,
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 1a6937dc190b..8ba4e572e09c 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -48,7 +48,6 @@ static struct bin_attribute w1_therm_bin_attr = {
48 .attr = { 48 .attr = {
49 .name = "w1_slave", 49 .name = "w1_slave",
50 .mode = S_IRUGO, 50 .mode = S_IRUGO,
51 .owner = THIS_MODULE,
52 }, 51 },
53 .size = W1_SLAVE_DATA_SIZE, 52 .size = W1_SLAVE_DATA_SIZE,
54 .read = w1_therm_read_bin, 53 .read = w1_therm_read_bin,
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 7d6876dbcc96..1838cb29b646 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -128,7 +128,6 @@ static struct bin_attribute w1_slave_attr_bin_id = {
128 .attr = { 128 .attr = {
129 .name = "id", 129 .name = "id",
130 .mode = S_IRUGO, 130 .mode = S_IRUGO,
131 .owner = THIS_MODULE,
132 }, 131 },
133 .size = 8, 132 .size = 8,
134 .read = w1_slave_read_id, 133 .read = w1_slave_read_id,
@@ -167,7 +166,6 @@ static struct bin_attribute w1_default_attr = {
167 .attr = { 166 .attr = {
168 .name = "rw", 167 .name = "rw",
169 .mode = S_IRUGO | S_IWUSR, 168 .mode = S_IRUGO | S_IWUSR,
170 .owner = THIS_MODULE,
171 }, 169 },
172 .size = PAGE_SIZE, 170 .size = PAGE_SIZE,
173 .read = w1_default_read, 171 .read = w1_default_read,
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index c3ba0ec334c4..7e03cc68b182 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -78,7 +78,6 @@ static struct bin_attribute zorro_config_attr = {
78 .attr = { 78 .attr = {
79 .name = "config", 79 .name = "config",
80 .mode = S_IRUGO | S_IWUSR, 80 .mode = S_IRUGO | S_IWUSR,
81 .owner = THIS_MODULE
82 }, 81 },
83 .size = sizeof(struct ConfigDev), 82 .size = sizeof(struct ConfigDev),
84 .read = zorro_read_config, 83 .read = zorro_read_config,
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 606128f5c927..02ca6f1e55d7 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -840,8 +840,6 @@ static int __init ecryptfs_init(void)
840 goto out; 840 goto out;
841 } 841 }
842 kobj_set_kset_s(&ecryptfs_subsys, fs_subsys); 842 kobj_set_kset_s(&ecryptfs_subsys, fs_subsys);
843 sysfs_attr_version.attr.owner = THIS_MODULE;
844 sysfs_attr_version_str.attr.owner = THIS_MODULE;
845 rc = do_sysfs_registration(); 843 rc = do_sysfs_registration();
846 if (rc) { 844 if (rc) {
847 printk(KERN_ERR "sysfs registration failed\n"); 845 printk(KERN_ERR "sysfs registration failed\n");
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index 2b205f5d5790..e9e042b93dbf 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -74,7 +74,6 @@ struct mlog_attribute {
74#define define_mask(_name) { \ 74#define define_mask(_name) { \
75 .attr = { \ 75 .attr = { \
76 .name = #_name, \ 76 .name = #_name, \
77 .owner = THIS_MODULE, \
78 .mode = S_IRUGO | S_IWUSR, \ 77 .mode = S_IRUGO | S_IWUSR, \
79 }, \ 78 }, \
80 .mask = ML_##_name, \ 79 .mask = ML_##_name, \
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 9a3a058f3553..98e0b85a9bb2 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -397,7 +397,6 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
397 static struct attribute addpartattr = { 397 static struct attribute addpartattr = {
398 .name = "whole_disk", 398 .name = "whole_disk",
399 .mode = S_IRUSR | S_IRGRP | S_IROTH, 399 .mode = S_IRUSR | S_IRGRP | S_IROTH,
400 .owner = THIS_MODULE,
401 }; 400 };
402 401
403 sysfs_create_file(&p->kobj, &addpartattr); 402 sysfs_create_file(&p->kobj, &addpartattr);
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 618b8aea6a7b..3c5574a40b09 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -175,25 +175,20 @@ static int open(struct inode * inode, struct file * file)
175 if (!sysfs_get_active(attr_sd)) 175 if (!sysfs_get_active(attr_sd))
176 return -ENODEV; 176 return -ENODEV;
177 177
178 /* Grab the module reference for this attribute */
179 error = -ENODEV;
180 if (!try_module_get(attr->attr.owner))
181 goto err_sput;
182
183 error = -EACCES; 178 error = -EACCES;
184 if ((file->f_mode & FMODE_WRITE) && !(attr->write || attr->mmap)) 179 if ((file->f_mode & FMODE_WRITE) && !(attr->write || attr->mmap))
185 goto err_mput; 180 goto err_out;
186 if ((file->f_mode & FMODE_READ) && !(attr->read || attr->mmap)) 181 if ((file->f_mode & FMODE_READ) && !(attr->read || attr->mmap))
187 goto err_mput; 182 goto err_out;
188 183
189 error = -ENOMEM; 184 error = -ENOMEM;
190 bb = kzalloc(sizeof(*bb), GFP_KERNEL); 185 bb = kzalloc(sizeof(*bb), GFP_KERNEL);
191 if (!bb) 186 if (!bb)
192 goto err_mput; 187 goto err_out;
193 188
194 bb->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); 189 bb->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
195 if (!bb->buffer) 190 if (!bb->buffer)
196 goto err_mput; 191 goto err_out;
197 192
198 mutex_init(&bb->mutex); 193 mutex_init(&bb->mutex);
199 file->private_data = bb; 194 file->private_data = bb;
@@ -203,9 +198,7 @@ static int open(struct inode * inode, struct file * file)
203 sysfs_get(attr_sd); 198 sysfs_get(attr_sd);
204 return 0; 199 return 0;
205 200
206 err_mput: 201 err_out:
207 module_put(attr->attr.owner);
208 err_sput:
209 sysfs_put_active(attr_sd); 202 sysfs_put_active(attr_sd);
210 kfree(bb); 203 kfree(bb);
211 return error; 204 return error;
@@ -214,13 +207,11 @@ static int open(struct inode * inode, struct file * file)
214static int release(struct inode * inode, struct file * file) 207static int release(struct inode * inode, struct file * file)
215{ 208{
216 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; 209 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
217 struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr;
218 struct bin_buffer *bb = file->private_data; 210 struct bin_buffer *bb = file->private_data;
219 211
220 if (bb->mmapped) 212 if (bb->mmapped)
221 sysfs_put_active_two(attr_sd); 213 sysfs_put_active_two(attr_sd);
222 sysfs_put(attr_sd); 214 sysfs_put(attr_sd);
223 module_put(attr->attr.owner);
224 kfree(bb->buffer); 215 kfree(bb->buffer);
225 kfree(bb); 216 kfree(bb);
226 return 0; 217 return 0;
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index d673d9b5d33f..a84b734f7b29 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -241,7 +241,6 @@ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t
241static int sysfs_open_file(struct inode *inode, struct file *file) 241static int sysfs_open_file(struct inode *inode, struct file *file)
242{ 242{
243 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; 243 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
244 struct attribute *attr = attr_sd->s_elem.attr.attr;
245 struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj; 244 struct kobject *kobj = attr_sd->s_parent->s_elem.dir.kobj;
246 struct sysfs_buffer * buffer; 245 struct sysfs_buffer * buffer;
247 struct sysfs_ops * ops = NULL; 246 struct sysfs_ops * ops = NULL;
@@ -251,11 +250,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
251 if (!sysfs_get_active_two(attr_sd)) 250 if (!sysfs_get_active_two(attr_sd))
252 return -ENODEV; 251 return -ENODEV;
253 252
254 /* Grab the module reference for this attribute */
255 error = -ENODEV;
256 if (!try_module_get(attr->owner))
257 goto err_sput;
258
259 /* if the kobject has no ktype, then we assume that it is a subsystem 253 /* if the kobject has no ktype, then we assume that it is a subsystem
260 * itself, and use ops for it. 254 * itself, and use ops for it.
261 */ 255 */
@@ -272,7 +266,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
272 * or the subsystem have no operations. 266 * or the subsystem have no operations.
273 */ 267 */
274 if (!ops) 268 if (!ops)
275 goto err_mput; 269 goto err_out;
276 270
277 /* File needs write support. 271 /* File needs write support.
278 * The inode's perms must say it's ok, 272 * The inode's perms must say it's ok,
@@ -280,7 +274,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
280 */ 274 */
281 if (file->f_mode & FMODE_WRITE) { 275 if (file->f_mode & FMODE_WRITE) {
282 if (!(inode->i_mode & S_IWUGO) || !ops->store) 276 if (!(inode->i_mode & S_IWUGO) || !ops->store)
283 goto err_mput; 277 goto err_out;
284 } 278 }
285 279
286 /* File needs read support. 280 /* File needs read support.
@@ -289,7 +283,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
289 */ 283 */
290 if (file->f_mode & FMODE_READ) { 284 if (file->f_mode & FMODE_READ) {
291 if (!(inode->i_mode & S_IRUGO) || !ops->show) 285 if (!(inode->i_mode & S_IRUGO) || !ops->show)
292 goto err_mput; 286 goto err_out;
293 } 287 }
294 288
295 /* No error? Great, allocate a buffer for the file, and store it 289 /* No error? Great, allocate a buffer for the file, and store it
@@ -298,7 +292,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
298 error = -ENOMEM; 292 error = -ENOMEM;
299 buffer = kzalloc(sizeof(struct sysfs_buffer), GFP_KERNEL); 293 buffer = kzalloc(sizeof(struct sysfs_buffer), GFP_KERNEL);
300 if (!buffer) 294 if (!buffer)
301 goto err_mput; 295 goto err_out;
302 296
303 init_MUTEX(&buffer->sem); 297 init_MUTEX(&buffer->sem);
304 buffer->needs_read_fill = 1; 298 buffer->needs_read_fill = 1;
@@ -310,9 +304,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
310 sysfs_get(attr_sd); 304 sysfs_get(attr_sd);
311 return 0; 305 return 0;
312 306
313 err_mput: 307 err_out:
314 module_put(attr->owner);
315 err_sput:
316 sysfs_put_active_two(attr_sd); 308 sysfs_put_active_two(attr_sd);
317 return error; 309 return error;
318} 310}
@@ -320,12 +312,9 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
320static int sysfs_release(struct inode * inode, struct file * filp) 312static int sysfs_release(struct inode * inode, struct file * filp)
321{ 313{
322 struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata; 314 struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata;
323 struct attribute *attr = attr_sd->s_elem.attr.attr;
324 struct sysfs_buffer *buffer = filp->private_data; 315 struct sysfs_buffer *buffer = filp->private_data;
325 316
326 sysfs_put(attr_sd); 317 sysfs_put(attr_sd);
327 /* After this point, attr should not be accessed. */
328 module_put(attr->owner);
329 318
330 if (buffer) { 319 if (buffer) {
331 if (buffer->page) 320 if (buffer->page)
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index e699ab279c2c..e285746588d6 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -101,8 +101,7 @@ struct sysdev_attribute {
101 101
102#define _SYSDEV_ATTR(_name,_mode,_show,_store) \ 102#define _SYSDEV_ATTR(_name,_mode,_show,_store) \
103{ \ 103{ \
104 .attr = { .name = __stringify(_name), .mode = _mode, \ 104 .attr = { .name = __stringify(_name), .mode = _mode }, \
105 .owner = THIS_MODULE }, \
106 .show = _show, \ 105 .show = _show, \
107 .store = _store, \ 106 .store = _store, \
108} 107}
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 2f86b080b39d..161e19aa2b4f 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -20,9 +20,13 @@ struct module;
20struct nameidata; 20struct nameidata;
21struct dentry; 21struct dentry;
22 22
23/* FIXME
24 * The *owner field is no longer used, but leave around
25 * until the tree gets cleaned up fully.
26 */
23struct attribute { 27struct attribute {
24 const char * name; 28 const char * name;
25 struct module * owner; 29 struct module * owner;
26 mode_t mode; 30 mode_t mode;
27}; 31};
28 32
@@ -39,14 +43,14 @@ struct attribute_group {
39 */ 43 */
40 44
41#define __ATTR(_name,_mode,_show,_store) { \ 45#define __ATTR(_name,_mode,_show,_store) { \
42 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ 46 .attr = {.name = __stringify(_name), .mode = _mode }, \
43 .show = _show, \ 47 .show = _show, \
44 .store = _store, \ 48 .store = _store, \
45} 49}
46 50
47#define __ATTR_RO(_name) { \ 51#define __ATTR_RO(_name) { \
48 .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, \ 52 .attr = { .name = __stringify(_name), .mode = 0444 }, \
49 .show = _name##_show, \ 53 .show = _name##_show, \
50} 54}
51 55
52#define __ATTR_NULL { .attr = { .name = NULL } } 56#define __ATTR_NULL { .attr = { .name = NULL } }
diff --git a/kernel/module.c b/kernel/module.c
index 9bd93de01f4a..015d60cfd90e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -488,8 +488,7 @@ static void free_modinfo_##field(struct module *mod) \
488 mod->field = NULL; \ 488 mod->field = NULL; \
489} \ 489} \
490static struct module_attribute modinfo_##field = { \ 490static struct module_attribute modinfo_##field = { \
491 .attr = { .name = __stringify(field), .mode = 0444, \ 491 .attr = { .name = __stringify(field), .mode = 0444 }, \
492 .owner = THIS_MODULE }, \
493 .show = show_modinfo_##field, \ 492 .show = show_modinfo_##field, \
494 .setup = setup_modinfo_##field, \ 493 .setup = setup_modinfo_##field, \
495 .test = modinfo_##field##_exists, \ 494 .test = modinfo_##field##_exists, \
@@ -793,7 +792,7 @@ static ssize_t show_refcnt(struct module_attribute *mattr,
793} 792}
794 793
795static struct module_attribute refcnt = { 794static struct module_attribute refcnt = {
796 .attr = { .name = "refcnt", .mode = 0444, .owner = THIS_MODULE }, 795 .attr = { .name = "refcnt", .mode = 0444 },
797 .show = show_refcnt, 796 .show = show_refcnt,
798}; 797};
799 798
@@ -851,7 +850,7 @@ static ssize_t show_initstate(struct module_attribute *mattr,
851} 850}
852 851
853static struct module_attribute initstate = { 852static struct module_attribute initstate = {
854 .attr = { .name = "initstate", .mode = 0444, .owner = THIS_MODULE }, 853 .attr = { .name = "initstate", .mode = 0444 },
855 .show = show_initstate, 854 .show = show_initstate,
856}; 855};
857 856
@@ -1032,7 +1031,6 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
1032 sattr->mattr.show = module_sect_show; 1031 sattr->mattr.show = module_sect_show;
1033 sattr->mattr.store = NULL; 1032 sattr->mattr.store = NULL;
1034 sattr->mattr.attr.name = sattr->name; 1033 sattr->mattr.attr.name = sattr->name;
1035 sattr->mattr.attr.owner = mod;
1036 sattr->mattr.attr.mode = S_IRUGO; 1034 sattr->mattr.attr.mode = S_IRUGO;
1037 *(gattr++) = &(sattr++)->mattr.attr; 1035 *(gattr++) = &(sattr++)->mattr.attr;
1038 } 1036 }
@@ -1090,7 +1088,6 @@ int module_add_modinfo_attrs(struct module *mod)
1090 if (!attr->test || 1088 if (!attr->test ||
1091 (attr->test && attr->test(mod))) { 1089 (attr->test && attr->test(mod))) {
1092 memcpy(temp_attr, attr, sizeof(*temp_attr)); 1090 memcpy(temp_attr, attr, sizeof(*temp_attr));
1093 temp_attr->attr.owner = mod;
1094 error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); 1091 error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr);
1095 ++temp_attr; 1092 ++temp_attr;
1096 } 1093 }
diff --git a/kernel/params.c b/kernel/params.c
index e61c46c97ce7..effbaaedd7f3 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -491,7 +491,6 @@ param_sysfs_setup(struct module_kobject *mk,
491 pattr->mattr.show = param_attr_show; 491 pattr->mattr.show = param_attr_show;
492 pattr->mattr.store = param_attr_store; 492 pattr->mattr.store = param_attr_store;
493 pattr->mattr.attr.name = (char *)&kp->name[name_skip]; 493 pattr->mattr.attr.name = (char *)&kp->name[name_skip];
494 pattr->mattr.attr.owner = mk->mod;
495 pattr->mattr.attr.mode = kp->perm; 494 pattr->mattr.attr.mode = kp->perm;
496 *(gattr++) = &(pattr++)->mattr.attr; 495 *(gattr++) = &(pattr++)->mattr.attr;
497 } 496 }
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 33c6c4a7c689..31ace23a0914 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -383,8 +383,7 @@ static ssize_t brforward_read(struct kobject *kobj, char *buf,
383 383
384static struct bin_attribute bridge_forward = { 384static struct bin_attribute bridge_forward = {
385 .attr = { .name = SYSFS_BRIDGE_FDB, 385 .attr = { .name = SYSFS_BRIDGE_FDB,
386 .mode = S_IRUGO, 386 .mode = S_IRUGO, },
387 .owner = THIS_MODULE, },
388 .read = brforward_read, 387 .read = brforward_read,
389}; 388};
390 389
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 2da22927d8dd..79db51fcb476 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -29,8 +29,7 @@ struct brport_attribute {
29#define BRPORT_ATTR(_name,_mode,_show,_store) \ 29#define BRPORT_ATTR(_name,_mode,_show,_store) \
30struct brport_attribute brport_attr_##_name = { \ 30struct brport_attribute brport_attr_##_name = { \
31 .attr = {.name = __stringify(_name), \ 31 .attr = {.name = __stringify(_name), \
32 .mode = _mode, \ 32 .mode = _mode }, \
33 .owner = THIS_MODULE, }, \
34 .show = _show, \ 33 .show = _show, \
35 .store = _store, \ 34 .store = _store, \
36}; 35};