public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Greg Kroah-Hartman" <gregkh@suse.de>,
	"Américo Wang" <xiyou.wangcong@gmail.com>,
	"Tejun Heo <tj@kernel.org> Neil Brown" <neilb@suse.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on dynamic attributes
Date: Mon, 15 Feb 2010 18:38:16 +0800	[thread overview]
Message-ID: <20100215103816.GK12076@hack.private> (raw)
In-Reply-To: <m1d40bwe5i.fsf_-_@fess.ebiederm.org>

On Thu, Feb 11, 2010 at 03:23:05PM -0800, Eric W. Biederman wrote:
>
>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>


Based on previous patches,

Acked-by: WANG Cong <xiyou.wangcong@gmail.com>

But it seems there are still some cases missed, e.g. the one
reported by John. We can fix them when they appear.

Thanks!

>---
> 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 d112829..a50fd08 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 c5df94e..6fbcbea 100644
>--- a/drivers/pci/pci-sysfs.c
>+++ b/drivers/pci/pci-sysfs.c
>@@ -640,6 +640,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;
>@@ -652,6 +653,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;
>@@ -798,6 +800,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);
>@@ -970,6 +973,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;
>@@ -1036,6 +1040,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 cf1b691..5bf6deb 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.6.5.2.143.g8cc62
>

-- 
Live like a child, think like the god.
 

  parent reply	other threads:[~2010-02-15 10:35 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10  1:09 [PATCH] sysfs: differentiate between locking links and non-links Neil Brown
2010-02-10  1:21 ` David Rientjes
2010-02-10  1:56   ` Américo Wang
2010-02-10  3:05     ` David Rientjes
2010-02-10  3:14       ` Américo Wang
2010-02-10  3:19         ` David Rientjes
2010-02-10  3:33           ` Américo Wang
2010-02-10  2:08 ` Américo Wang
2010-02-10  2:19   ` Tejun Heo
2010-02-10  3:12     ` Américo Wang
2010-02-10  8:03     ` Eric W. Biederman
2010-02-10 10:39       ` Tejun Heo
2010-02-10 18:25         ` Eric W. Biederman
2010-02-10 23:05           ` Greg KH
2010-02-11  1:31             ` Eric W. Biederman
2010-02-11  2:10               ` Tejun Heo
2010-02-11 18:08                 ` Eric W. Biederman
2010-02-12  0:59                   ` Tejun Heo
2010-02-12  1:20                     ` Eric W. Biederman
2010-02-12  1:20                     ` Eric W. Biederman
2010-02-12  2:16                       ` Tejun Heo
2010-02-11 23:13                 ` [PATCH 0/4] Better sysfs lockdep Eric W. Biederman
2010-02-11 23:14                   ` [PATCH 1/4] sysfs: Remove sysfs_get/put_active_two Eric W. Biederman
2010-02-11 23:20                     ` [PATCH 2/4] sysfs: Only take active references on attributes Eric W. Biederman
2010-02-11 23:21                       ` [PATCH 3/4] sysfs: Use one lockdep class per sysfs attribute Eric W. Biederman
2010-02-11 23:23                         ` [PATCH 4/4] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on dynamic attributes Eric W. Biederman
2010-02-11 23:42                           ` Greg KH
2010-02-12 12:47                             ` [PATCH] sysfs: Document sysfs_attr_init and sysfs_bin_attr_init Eric W. Biederman
2010-02-12 21:41                               ` [PATCH] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on module dynamic attributes Eric W. Biederman
2010-02-15 10:38                           ` Américo Wang [this message]
2010-02-15 12:53                             ` [PATCH 4/4] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on " Eric W. Biederman
2010-02-15 10:35                         ` [PATCH 3/4] sysfs: Use one lockdep class per sysfs attribute Américo Wang
2010-02-15  7:27                       ` [PATCH 2/4] sysfs: Only take active references on attributes Américo Wang
2010-02-15  8:15                         ` Américo Wang
2010-02-15  8:31                           ` Américo Wang
2010-02-15 10:11                           ` Eric W. Biederman
2010-02-15  7:03                     ` [PATCH 1/4] sysfs: Remove sysfs_get/put_active_two Américo Wang
2010-02-11 23:18                   ` Eric W. Biederman
2010-02-11 23:17                 ` [PATCH 0/4] Better sysfs lockdep Eric W. Biederman
2010-02-11 23:43                   ` Greg KH
2010-02-10 23:54           ` [PATCH] sysfs: differentiate between locking links and non-links Tejun Heo
2010-02-11  0:38             ` Eric W. Biederman
2010-02-10 17:36 ` Eric W. Biederman
2010-02-10 17:55   ` Dmitry Torokhov
2010-02-10 23:06 ` Greg KH
2010-02-11 21:42   ` Eric W. Biederman
2010-02-11 22:32     ` Greg KH
2010-02-11 22:47       ` Eric W. Biederman
2010-02-17 22:38         ` Greg KH
2010-02-18  0:39           ` Neil Brown
2010-02-18  1:01             ` Eric W. Biederman
2010-02-18  1:12               ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100215103816.GK12076@hack.private \
    --to=xiyou.wangcong@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox