diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-02-04 11:48:55 +0100 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2015-02-23 13:09:39 +0100 |
commit | 2eace188f6ba54078db0bc055bb161a99877f2d3 (patch) | |
tree | 7d3d66368a5f6ff6669533b11ce1fbcd70e346e3 /drivers/edac | |
parent | EDAC: i7core: Return proper error codes for kzalloc() errors (diff) | |
download | linux-2eace188f6ba54078db0bc055bb161a99877f2d3.tar.xz linux-2eace188f6ba54078db0bc055bb161a99877f2d3.zip |
EDAC: i7core: Use static attribute groups for sysfs entries
... instead of manual device_create_file() and device_remove_file()
calls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ Add NULL terminator to i7core_dev_attrs[] caught by the build robot. ]
Reported-by: Huang Ying <ying.huang@intel.com>
Link: http://lkml.kernel.org/r/1423046938-18111-6-git-send-email-tiwai@suse.de
Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/i7core_edac.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 5da90ded54b6..01087a38da22 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c @@ -1157,24 +1157,21 @@ static DEVICE_ATTR(inject_eccmask, S_IRUGO | S_IWUSR, static DEVICE_ATTR(inject_enable, S_IRUGO | S_IWUSR, i7core_inject_enable_show, i7core_inject_enable_store); +static struct attribute *i7core_dev_attrs[] = { + &dev_attr_inject_section.attr, + &dev_attr_inject_type.attr, + &dev_attr_inject_eccmask.attr, + &dev_attr_inject_enable.attr, + NULL +}; + +ATTRIBUTE_GROUPS(i7core_dev); + static int i7core_create_sysfs_devices(struct mem_ctl_info *mci) { struct i7core_pvt *pvt = mci->pvt_info; int rc; - rc = device_create_file(&mci->dev, &dev_attr_inject_section); - if (rc < 0) - return rc; - rc = device_create_file(&mci->dev, &dev_attr_inject_type); - if (rc < 0) - return rc; - rc = device_create_file(&mci->dev, &dev_attr_inject_eccmask); - if (rc < 0) - return rc; - rc = device_create_file(&mci->dev, &dev_attr_inject_enable); - if (rc < 0) - return rc; - pvt->addrmatch_dev = kzalloc(sizeof(*pvt->addrmatch_dev), GFP_KERNEL); if (!pvt->addrmatch_dev) return -ENOMEM; @@ -1223,11 +1220,6 @@ static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci) edac_dbg(1, "\n"); - device_remove_file(&mci->dev, &dev_attr_inject_section); - device_remove_file(&mci->dev, &dev_attr_inject_type); - device_remove_file(&mci->dev, &dev_attr_inject_eccmask); - device_remove_file(&mci->dev, &dev_attr_inject_enable); - if (!pvt->is_registered) { put_device(pvt->chancounts_dev); device_del(pvt->chancounts_dev); @@ -2259,7 +2251,7 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev) enable_sdram_scrub_setting(mci); /* add this new MC control structure to EDAC's list of MCs */ - if (unlikely(edac_mc_add_mc(mci))) { + if (unlikely(edac_mc_add_mc_with_groups(mci, i7core_dev_groups))) { edac_dbg(0, "MC: failed edac_mc_add_mc()\n"); /* FIXME: perhaps some code should go here that disables error * reporting if we just enabled it |