Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: sysfs: kill owner field from attribute

Tejun's commit 7b595756ec1f49e0049a9e01a1298d53a7faaa15 made sysfs
attribute->owner unnecessary. But the field was left in the structure to
ease the merge. It's been over a year since that change and it is now
time to start killing attribute->owner along with its users - one arch at
a time!

This patch is attempt #1 to get rid of attribute->owner only for
CONFIG_X86_64 or CONFIG_X86_32 . We will deal with other arches later on
as and when possible - avr32 will be the next since that is something I
can test. Compile (make allyesconfig / make allmodconfig / custom config)
and boot tested.

akpm: the idea is that we put the declaration of sttribute.owner inside
`#ifndef CONFIG_X86'. But that proved to be too ambitious for now because
new usages kept on turning up in subsystem trees.

[akpm: remove the ifdef for now]
Signed-off-by: Parag Warudkar <parag.lkml@gmail.com>
Cc: Greg KH <greg@kroah.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Parag Warudkar and committed by
Linus Torvalds
01e8ef11 bb26b963

+9 -23
+1 -1
drivers/acpi/battery.c
··· 431 431 } 432 432 433 433 static struct device_attribute alarm_attr = { 434 - .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE}, 434 + .attr = {.name = "alarm", .mode = 0644}, 435 435 .show = acpi_battery_alarm_show, 436 436 .store = acpi_battery_alarm_store, 437 437 };
+1 -1
drivers/acpi/sbs.c
··· 463 463 } 464 464 465 465 static struct device_attribute alarm_attr = { 466 - .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE}, 466 + .attr = {.name = "alarm", .mode = 0644}, 467 467 .show = acpi_battery_alarm_show, 468 468 .store = acpi_battery_alarm_store, 469 469 };
-1
drivers/acpi/system.c
··· 115 115 table_attr->attr.read = acpi_table_show; 116 116 table_attr->attr.attr.name = table_attr->name; 117 117 table_attr->attr.attr.mode = 0444; 118 - table_attr->attr.attr.owner = THIS_MODULE; 119 118 120 119 return; 121 120 }
+1 -1
drivers/block/aoe/aoeblk.c
··· 90 90 static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL); 91 91 static DEVICE_ATTR(netif, S_IRUGO, aoedisk_show_netif, NULL); 92 92 static struct device_attribute dev_attr_firmware_version = { 93 - .attr = { .name = "firmware-version", .mode = S_IRUGO, .owner = THIS_MODULE }, 93 + .attr = { .name = "firmware-version", .mode = S_IRUGO }, 94 94 .show = aoedisk_show_fwver, 95 95 }; 96 96
+1 -1
drivers/block/nbd.c
··· 391 391 } 392 392 393 393 static struct device_attribute pid_attr = { 394 - .attr = { .name = "pid", .mode = S_IRUGO, .owner = THIS_MODULE }, 394 + .attr = { .name = "pid", .mode = S_IRUGO}, 395 395 .show = pid_show, 396 396 }; 397 397
-1
drivers/firmware/iscsi_ibft.c
··· 732 732 733 733 attr->attr.name = name; 734 734 attr->attr.mode = S_IRUSR; 735 - attr->attr.owner = THIS_MODULE; 736 735 737 736 attr->hdr = hdr; 738 737 attr->show = show;
-1
drivers/i2c/chips/at24.c
··· 460 460 */ 461 461 at24->bin.attr.name = "eeprom"; 462 462 at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; 463 - at24->bin.attr.owner = THIS_MODULE; 464 463 at24->bin.read = at24_bin_read; 465 464 at24->bin.size = chip.byte_len; 466 465
-1
drivers/i2c/chips/ds1682.c
··· 190 190 .attr = { 191 191 .name = "eeprom", 192 192 .mode = S_IRUGO | S_IWUSR, 193 - .owner = THIS_MODULE, 194 193 }, 195 194 .size = DS1682_EEPROM_SIZE, 196 195 .read = ds1682_eeprom_read,
+1 -1
drivers/infiniband/core/cm.c
··· 122 122 123 123 #define CM_COUNTER_ATTR(_name, _index) \ 124 124 struct cm_counter_attribute cm_##_name##_counter_attr = { \ 125 - .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, \ 125 + .attr = { .name = __stringify(_name), .mode = 0444 }, \ 126 126 .index = _index \ 127 127 } 128 128
-1
drivers/memstick/core/mspro_block.c
··· 1044 1044 1045 1045 s_attr->dev_attr.attr.name = s_attr->name; 1046 1046 s_attr->dev_attr.attr.mode = S_IRUGO; 1047 - s_attr->dev_attr.attr.owner = THIS_MODULE; 1048 1047 s_attr->dev_attr.show = mspro_block_attr_show(s_attr->id); 1049 1048 1050 1049 if (!rc)
+1 -1
drivers/power/power_supply_sysfs.c
··· 30 30 31 31 #define POWER_SUPPLY_ATTR(_name) \ 32 32 { \ 33 - .attr = { .name = #_name, .mode = 0444, .owner = THIS_MODULE }, \ 33 + .attr = { .name = #_name, .mode = 0444 }, \ 34 34 .show = power_supply_show_property, \ 35 35 .store = NULL, \ 36 36 }
-1
drivers/rtc/rtc-cmos.c
··· 592 592 .attr = { 593 593 .name = "nvram", 594 594 .mode = S_IRUGO | S_IWUSR, 595 - .owner = THIS_MODULE, 596 595 }, 597 596 598 597 .read = cmos_nvram_read,
-1
drivers/rtc/rtc-ds1305.c
··· 606 606 static struct bin_attribute nvram = { 607 607 .attr.name = "nvram", 608 608 .attr.mode = S_IRUGO | S_IWUSR, 609 - .attr.owner = THIS_MODULE, 610 609 .read = ds1305_nvram_read, 611 610 .write = ds1305_nvram_write, 612 611 .size = DS1305_NVRAM_LEN,
-1
drivers/rtc/rtc-ds1307.c
··· 551 551 .attr = { 552 552 .name = "nvram", 553 553 .mode = S_IRUGO | S_IWUSR, 554 - .owner = THIS_MODULE, 555 554 }, 556 555 557 556 .read = ds1307_nvram_read,
-1
drivers/rtc/rtc-ds1511.c
··· 481 481 .attr = { 482 482 .name = "nvram", 483 483 .mode = S_IRUGO | S_IWUGO, 484 - .owner = THIS_MODULE, 485 484 }, 486 485 .size = DS1511_RAM_MAX, 487 486 .read = ds1511_nvram_read,
-1
drivers/rtc/rtc-m48t59.c
··· 360 360 .attr = { 361 361 .name = "nvram", 362 362 .mode = S_IRUGO | S_IWUSR, 363 - .owner = THIS_MODULE, 364 363 }, 365 364 .read = m48t59_nvram_read, 366 365 .write = m48t59_nvram_write,
-1
drivers/rtc/rtc-stk17ta8.c
··· 280 280 .attr = { 281 281 .name = "nvram", 282 282 .mode = S_IRUGO | S_IWUSR, 283 - .owner = THIS_MODULE, 284 283 }, 285 284 .size = RTC_OFFSET, 286 285 .read = stk17ta8_nvram_read,
-3
drivers/scsi/arcmsr/arcmsr_attr.c
··· 189 189 .attr = { 190 190 .name = "mu_read", 191 191 .mode = S_IRUSR , 192 - .owner = THIS_MODULE, 193 192 }, 194 193 .size = 1032, 195 194 .read = arcmsr_sysfs_iop_message_read, ··· 198 199 .attr = { 199 200 .name = "mu_write", 200 201 .mode = S_IWUSR, 201 - .owner = THIS_MODULE, 202 202 }, 203 203 .size = 1032, 204 204 .write = arcmsr_sysfs_iop_message_write, ··· 207 209 .attr = { 208 210 .name = "mu_clear", 209 211 .mode = S_IWUSR, 210 - .owner = THIS_MODULE, 211 212 }, 212 213 .size = 1, 213 214 .write = arcmsr_sysfs_iop_message_clear,
-1
drivers/w1/slaves/w1_ds2760.c
··· 80 80 .attr = { 81 81 .name = "w1_slave", 82 82 .mode = S_IRUGO, 83 - .owner = THIS_MODULE, 84 83 }, 85 84 .size = DS2760_DATA_SIZE, 86 85 .read = w1_ds2760_read_bin,
+3 -2
include/linux/sysfs.h
··· 21 21 struct module; 22 22 23 23 /* FIXME 24 - * The *owner field is no longer used, but leave around 25 - * until the tree gets cleaned up fully. 24 + * The *owner field is no longer used. 25 + * x86 tree has been cleaned up. The owner 26 + * attribute is still left for other arches. 26 27 */ 27 28 struct attribute { 28 29 const char *name;