From: Takashi Iwai <tiwai@suse.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] drivers/base/node: Use device_create_files() and device_remove_files()
Date: Wed, 28 Jan 2015 21:46:14 +0100 [thread overview]
Message-ID: <1422477974-8369-3-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1422477974-8369-1-git-send-email-tiwai@suse.de>
Use the new helper functions to simplify the code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/base/node.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/base/node.c b/drivers/base/node.c
index a3b82e9c7f20..e567e7bde333 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -200,6 +200,16 @@ static ssize_t node_read_distance(struct device *dev,
}
static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL);
+static const struct device_attribute *node_dev_attrs[] = {
+ &dev_attr_cpumap,
+ &dev_attr_cpulist,
+ &dev_attr_meminfo,
+ &dev_attr_numastat,
+ &dev_attr_distance,
+ &dev_attr_vmstat,
+ NULL
+};
+
#ifdef CONFIG_HUGETLBFS
/*
* hugetlbfs per node attributes registration interface:
@@ -276,12 +286,7 @@ static int register_node(struct node *node, int num, struct node *parent)
error = device_register(&node->dev);
if (!error){
- device_create_file(&node->dev, &dev_attr_cpumap);
- device_create_file(&node->dev, &dev_attr_cpulist);
- device_create_file(&node->dev, &dev_attr_meminfo);
- device_create_file(&node->dev, &dev_attr_numastat);
- device_create_file(&node->dev, &dev_attr_distance);
- device_create_file(&node->dev, &dev_attr_vmstat);
+ device_create_files(&node->dev, node_dev_attrs);
hugetlb_register_node(node);
@@ -299,12 +304,7 @@ static int register_node(struct node *node, int num, struct node *parent)
*/
void unregister_node(struct node *node)
{
- device_remove_file(&node->dev, &dev_attr_cpumap);
- device_remove_file(&node->dev, &dev_attr_cpulist);
- device_remove_file(&node->dev, &dev_attr_meminfo);
- device_remove_file(&node->dev, &dev_attr_numastat);
- device_remove_file(&node->dev, &dev_attr_distance);
- device_remove_file(&node->dev, &dev_attr_vmstat);
+ device_remove_files(&node->dev, node_dev_attrs);
hugetlb_unregister_node(node); /* no-op, if memoryless node */
--
2.2.2
next prev parent reply other threads:[~2015-01-28 20:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-28 20:46 [PATCH 0/2] Add device_create_files() and device_remove_files() helpers Takashi Iwai
2015-01-28 20:46 ` [PATCH 1/2] driver core: " Takashi Iwai
2015-01-28 20:46 ` Takashi Iwai [this message]
2015-01-28 21:06 ` [PATCH 2/2] drivers/base/node: Use device_create_files() and device_remove_files() Greg Kroah-Hartman
2015-01-28 21:27 ` Takashi Iwai
2015-01-28 21:05 ` [PATCH 0/2] Add device_create_files() and device_remove_files() helpers Greg Kroah-Hartman
2015-01-28 21:26 ` Takashi Iwai
2015-01-28 21:34 ` Greg Kroah-Hartman
2015-01-28 22:18 ` Takashi Iwai
2015-01-28 22:28 ` Greg Kroah-Hartman
2015-01-28 23:11 ` Takashi Iwai
2015-01-30 4:26 ` Greg Kroah-Hartman
2015-01-30 16:31 ` Takashi Iwai
2015-02-07 10:10 ` Greg Kroah-Hartman
2015-02-08 8:41 ` Takashi Iwai
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=1422477974-8369-3-git-send-email-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).