[PATCH 45/62] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on dynamic attributes

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg Kroah-Hartman
Date: Tuesday, March 2, 2010 - 4:28 pm

From: Eric W. Biederman <ebiederm@xmission.com>

These are the non-static sysfs attributes that exist on
my test machine.  Fix them to use sysfs_attr_init or
sysfs_bin_attr_init as appropriate.   It simply requires
making a sysfs attribute present to see this.  So this
is a little bit tedious but otherwise not too bad.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c |    1 +
 drivers/acpi/system.c            |    2 ++
 drivers/pci/pci-sysfs.c          |    5 +++++
 kernel/params.c                  |    1 +
 4 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index a8aacd4..28cba46 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2044,6 +2044,7 @@ static __init void mce_init_banks(void)
 		struct mce_bank *b = &mce_banks[i];
 		struct sysdev_attribute *a = &b->attr;
 
+		sysfs_attr_init(&a->attr);
 		a->attr.name	= b->attrname;
 		snprintf(b->attrname, ATTR_LEN, "bank%d", i);
 
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index a206a12..743f244 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -101,6 +101,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
 	struct acpi_table_header *header = NULL;
 	struct acpi_table_attr *attr = NULL;
 
+	sysfs_attr_init(&table_attr->attr.attr);
 	if (table_header->signature[0] != '\0')
 		memcpy(table_attr->name, table_header->signature,
 			ACPI_NAME_SIZE);
@@ -475,6 +476,7 @@ void acpi_irq_stats_init(void)
 			goto fail;
 		strncpy(name, buffer, strlen(buffer) + 1);
 
+		sysfs_attr_init(&counter_attrs[i].attr);
 		counter_attrs[i].attr.name = name;
 		counter_attrs[i].attr.mode = 0644;
 		counter_attrs[i].show = counter_show;
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 807224e..9fa183c 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -642,6 +642,7 @@ void pci_create_legacy_files(struct pci_bus *b)
 	if (!b->legacy_io)
 		goto kzalloc_err;
 
+	sysfs_bin_attr_init(&b->legacy_io);
 	b->legacy_io->attr.name = "legacy_io";
 	b->legacy_io->size = 0xffff;
 	b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
@@ -654,6 +655,7 @@ void pci_create_legacy_files(struct pci_bus *b)
 		goto legacy_io_err;
 
 	/* Allocated above after the legacy_io struct */
+	sysfs_bin_attr_init(&b->legacy_mem);
 	b->legacy_mem = b->legacy_io + 1;
 	b->legacy_mem->attr.name = "legacy_mem";
 	b->legacy_mem->size = 1024*1024;
@@ -800,6 +802,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
 	if (res_attr) {
 		char *res_attr_name = (char *)(res_attr + 1);
 
+		sysfs_bin_attr_init(res_attr);
 		if (write_combine) {
 			pdev->res_attr_wc[num] = res_attr;
 			sprintf(res_attr_name, "resource%d_wc", num);
@@ -972,6 +975,7 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev)
 		if (!attr)
 			return -ENOMEM;
 
+		sysfs_bin_attr_init(attr);
 		attr->size = dev->vpd->len;
 		attr->attr.name = "vpd";
 		attr->attr.mode = S_IRUSR | S_IWUSR;
@@ -1038,6 +1042,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 			retval = -ENOMEM;
 			goto err_resource_files;
 		}
+		sysfs_bin_attr_init(attr);
 		attr->size = rom_size;
 		attr->attr.name = "rom";
 		attr->attr.mode = S_IRUSR;
diff --git a/kernel/params.c b/kernel/params.c
index 4e27762..a60ebed 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -517,6 +517,7 @@ static __modinit int add_sysfs_param(struct module_kobject *mk,
 	new->grp.attrs = attrs;
 
 	/* Tack new one on the end. */
+	sysfs_attr_init(&new->attrs[num].mattr.attr);
 	new->attrs[num].param = kp;
 	new->attrs[num].mattr.show = param_attr_show;
 	new->attrs[num].mattr.store = param_attr_store;
-- 
1.7.0.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] driver core patches for 2.6.33-git, Greg KH, (Tue Mar 2, 4:09 pm)
[PATCH 01/62] kobject-example: Spelling fixes., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 02/62] kset-example: Spelling fixes., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 03/62] Driver core: add platform_create_bundle() helper, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 04/62] driver core: make platform_device_id table const, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 05/62] sysdev: Pass attribute in sysdev_class attri ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 06/62] sysdev: Convert node driver class attributes ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 07/62] sysdev: Convert cpu driver sysdev class attr ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 08/62] sysfs: Add sysfs_add/remove_files utility fu ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 09/62] sysfs: Add attribute array to sysdev classes, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 10/62] sysdev: Convert node driver, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 11/62] sysdev: Use sysdev_class attribute arrays in ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 12/62] sysdev: Add sysdev_create/remove_files, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 13/62] sysdev: Fix type of sysdev class attribute i ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 14/62] sysdev: fix missing s390 conversion, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 15/62] driver-core: Add attribute argument to class ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 16/62] driver core: Add class_attr_string for simpl ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 17/62] driver core: Convert some drivers to CLASS_A ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 18/62] Driver-Core: devtmpfs - reset inode permissi ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 19/62] Driver-Core: devtmpfs - remove EXPERIMENTAL ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 20/62] Driver-Core: disable /sbin/hotplug by default, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 21/62] Driver-Core: require valid action string in ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 22/62] sysfs: Cache the last sysfs_dirent to improv ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 23/62] driver-core: firmware_class: remove base.h h ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 24/62] kobject: Constify struct kset_uevent_ops, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 25/62] HOWTO: Updates on subsystem trees, patchwork ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 26/62] sysdev: fix up the probe/release attributes, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 27/62] Driver core: Constify struct sysfs_ops in st ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 28/62] Driver core: make struct platform_driver.id_ ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 29/62] platform-drivers: move probe to .devinit.tex ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 30/62] platform-drivers: move probe to .devinit.tex ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 32/62] x86: move hp-wmi's probe function to .devini ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 33/62] i2c: move i2c_omap's probe function to .devi ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 34/62] w1: move omap_hdq's probe function to .devin ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 35/62] media: move omap24xxcam's probe function to ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 36/62] auxdisplay: move cfag12864bfb's probe functi ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 38/62] UIO: Add a driver for Hilscher netX-based fi ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 39/62] UIO: minor Kconfig fixes, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 40/62] UIO: Remove SMX Cryptengine driver, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 41/62] Driver core: Fix first line of kernel-doc fo ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 42/62] sysfs: Remove sysfs_get/put_active_two, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 43/62] sysfs: Only take active references on attrib ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 44/62] sysfs: Use one lockdep class per sysfs attri ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 45/62] sysfs: Use sysfs_attr_init and sysfs_bin_att ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 46/62] sysfs: Document sysfs_attr_init and sysfs_bi ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 47/62] sysfs: Use sysfs_attr_init and sysfs_bin_att ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 48/62] sysfs: windfarm: init sysfs attributes, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 49/62] sysfs: Serialize updates to the vfs inode, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 50/62] sysfs: Pack sysfs_dirent more tightly., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 51/62] sysfs: Implement sysfs_rename_link, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 52/62] driver core: Use sysfs_rename_link in device ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 53/62] sysfs: Pass super_block to sysfs_get_inode, Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 54/62] sysfs: Kill unused sysfs_sb variable., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 56/62] msi-laptop: Support standard ec 66/62 comman ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 57/62] msi-laptop: Add threeg sysfs file for suppor ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 58/62] msi-laptop: Support some MSI 3G netbook that ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 59/62] msi-laptop: Add resume method for set the SC ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 60/62] msi-laptop: Detect 3G device exists by stand ..., Greg Kroah-Hartman, (Tue Mar 2, 4:28 pm)
[PATCH 61/62] msi-laptop: depends on RFKILL, Greg Kroah-Hartman, (Tue Mar 2, 4:29 pm)
[PATCH 62/62] sysfs: fix for thinko with sysfs_bin_attr_init(), Greg Kroah-Hartman, (Tue Mar 2, 4:29 pm)
Re: [PATCH 61/62] msi-laptop: depends on RFKILL, Dmitry Torokhov, (Tue Mar 2, 11:09 pm)
Re: [GIT PATCH] driver core patches for 2.6.33-git, Linus Torvalds, (Mon Mar 8, 10:28 am)