From: Takashi Iwai <tiwai@suse.de>
To: linux-edac@vger.kernel.org
Cc: Doug Thompson <dougthompson@xmission.com>,
Borislav Petkov <bp@alien8.de>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/8] EDAC: mpc85xx: Use static attribute groups for sysfs entries
Date: Wed, 4 Feb 2015 11:48:56 +0100 [thread overview]
Message-ID: <1423046938-18111-7-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1423046938-18111-1-git-send-email-tiwai@suse.de>
... instead of manual device_create_file() and device_remove_file()
calls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/edac/mpc85xx_edac.c | 38 ++++++++------------------------------
1 file changed, 8 insertions(+), 30 deletions(-)
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index ffb1a9a15ccd..4b93a9062161 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -134,29 +134,14 @@ DEVICE_ATTR(inject_data_lo, S_IRUGO | S_IWUSR,
DEVICE_ATTR(inject_ctrl, S_IRUGO | S_IWUSR,
mpc85xx_mc_inject_ctrl_show, mpc85xx_mc_inject_ctrl_store);
-static int mpc85xx_create_sysfs_attributes(struct mem_ctl_info *mci)
-{
- int rc;
-
- rc = device_create_file(&mci->dev, &dev_attr_inject_data_hi);
- if (rc < 0)
- return rc;
- rc = device_create_file(&mci->dev, &dev_attr_inject_data_lo);
- if (rc < 0)
- return rc;
- rc = device_create_file(&mci->dev, &dev_attr_inject_ctrl);
- if (rc < 0)
- return rc;
+static struct attribute *mpc85xx_dev_attrs[] = {
+ &dev_attr_inject_data_hi.attr,
+ &dev_attr_inject_data_lo.attr,
+ &dev_attr_inject_ctrl.attr,
+ NULL
+};
- return 0;
-}
-
-static void mpc85xx_remove_sysfs_attributes(struct mem_ctl_info *mci)
-{
- device_remove_file(&mci->dev, &dev_attr_inject_data_hi);
- device_remove_file(&mci->dev, &dev_attr_inject_data_lo);
- device_remove_file(&mci->dev, &dev_attr_inject_ctrl);
-}
+ATTRIBUTE_GROUPS(mpc85xx_dev);
/**************************** PCI Err device ***************************/
#ifdef CONFIG_PCI
@@ -1106,13 +1091,7 @@ static int mpc85xx_mc_err_probe(struct platform_device *op)
/* clear all error bits */
out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT, ~0);
- if (edac_mc_add_mc(mci)) {
- edac_dbg(3, "failed edac_mc_add_mc()\n");
- goto err;
- }
-
- if (mpc85xx_create_sysfs_attributes(mci)) {
- edac_mc_del_mc(mci->pdev);
+ if (edac_mc_add_mc_with_groups(mci, mpc85xx_dev_groups)) {
edac_dbg(3, "failed edac_mc_add_mc()\n");
goto err;
}
@@ -1176,7 +1155,6 @@ static int mpc85xx_mc_err_remove(struct platform_device *op)
orig_ddr_err_disable);
out_be32(pdata->mc_vbase + MPC85XX_MC_ERR_SBE, orig_ddr_err_sbe);
- mpc85xx_remove_sysfs_attributes(mci);
edac_mc_del_mc(&op->dev);
edac_mc_free(mci);
return 0;
--
2.2.2
next prev parent reply other threads:[~2015-02-04 10:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 10:48 [PATCH 0/8] EDAC: Clean up device_create_file() & co Takashi Iwai
2015-02-04 10:48 ` [PATCH 1/8] EDAC: core: Use static attribute groups for managing sysfs entries Takashi Iwai
2015-02-04 10:48 ` [PATCH 2/8] EDAC: Allow to pass driver-specific attribute groups Takashi Iwai
2015-02-04 10:48 ` [PATCH 3/8] EDAC: amd64: Use static " Takashi Iwai
2015-02-04 10:48 ` [PATCH 4/8] EDAC: i7core: Return proper error codes for kzalloc() errors Takashi Iwai
2015-02-04 10:48 ` [PATCH 5/8] EDAC: i7core: Use static attribute groups for sysfs entries Takashi Iwai
2015-02-04 10:48 ` Takashi Iwai [this message]
2015-02-04 10:48 ` [PATCH 7/8] EDAC: octeon: " Takashi Iwai
2015-02-04 10:48 ` [PATCH 8/8] EDAC: highbank: " Takashi Iwai
2015-02-06 10:44 ` [PATCH 0/8] EDAC: Clean up device_create_file() & co Borislav Petkov
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=1423046938-18111-7-git-send-email-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=bp@alien8.de \
--cc=dougthompson@xmission.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
/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).