diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-02-04 05:48:55 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2015-02-23 07:09:39 -0500 |
commit | 2eace188f6ba54078db0bc055bb161a99877f2d3 (patch) | |
tree | 7d3d66368a5f6ff6669533b11ce1fbcd70e346e3 /drivers/edac/i7core_edac.c | |
parent | e97d7e38162dc305b4734a316ca758a2bbd1fa6e (diff) |
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/i7core_edac.c')
-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, | |||
1157 | static DEVICE_ATTR(inject_enable, S_IRUGO | S_IWUSR, | 1157 | static DEVICE_ATTR(inject_enable, S_IRUGO | S_IWUSR, |
1158 | i7core_inject_enable_show, i7core_inject_enable_store); | 1158 | i7core_inject_enable_show, i7core_inject_enable_store); |
1159 | 1159 | ||
1160 | static struct attribute *i7core_dev_attrs[] = { | ||
1161 | &dev_attr_inject_section.attr, | ||
1162 | &dev_attr_inject_type.attr, | ||
1163 | &dev_attr_inject_eccmask.attr, | ||
1164 | &dev_attr_inject_enable.attr, | ||
1165 | NULL | ||
1166 | }; | ||
1167 | |||
1168 | ATTRIBUTE_GROUPS(i7core_dev); | ||
1169 | |||
1160 | static int i7core_create_sysfs_devices(struct mem_ctl_info *mci) | 1170 | static int i7core_create_sysfs_devices(struct mem_ctl_info *mci) |
1161 | { | 1171 | { |
1162 | struct i7core_pvt *pvt = mci->pvt_info; | 1172 | struct i7core_pvt *pvt = mci->pvt_info; |
1163 | int rc; | 1173 | int rc; |
1164 | 1174 | ||
1165 | rc = device_create_file(&mci->dev, &dev_attr_inject_section); | ||
1166 | if (rc < 0) | ||
1167 | return rc; | ||
1168 | rc = device_create_file(&mci->dev, &dev_attr_inject_type); | ||
1169 | if (rc < 0) | ||
1170 | return rc; | ||
1171 | rc = device_create_file(&mci->dev, &dev_attr_inject_eccmask); | ||
1172 | if (rc < 0) | ||
1173 | return rc; | ||
1174 | rc = device_create_file(&mci->dev, &dev_attr_inject_enable); | ||
1175 | if (rc < 0) | ||
1176 | return rc; | ||
1177 | |||
1178 | pvt->addrmatch_dev = kzalloc(sizeof(*pvt->addrmatch_dev), GFP_KERNEL); | 1175 | pvt->addrmatch_dev = kzalloc(sizeof(*pvt->addrmatch_dev), GFP_KERNEL); |
1179 | if (!pvt->addrmatch_dev) | 1176 | if (!pvt->addrmatch_dev) |
1180 | return -ENOMEM; | 1177 | return -ENOMEM; |
@@ -1223,11 +1220,6 @@ static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci) | |||
1223 | 1220 | ||
1224 | edac_dbg(1, "\n"); | 1221 | edac_dbg(1, "\n"); |
1225 | 1222 | ||
1226 | device_remove_file(&mci->dev, &dev_attr_inject_section); | ||
1227 | device_remove_file(&mci->dev, &dev_attr_inject_type); | ||
1228 | device_remove_file(&mci->dev, &dev_attr_inject_eccmask); | ||
1229 | device_remove_file(&mci->dev, &dev_attr_inject_enable); | ||
1230 | |||
1231 | if (!pvt->is_registered) { | 1223 | if (!pvt->is_registered) { |
1232 | put_device(pvt->chancounts_dev); | 1224 | put_device(pvt->chancounts_dev); |
1233 | device_del(pvt->chancounts_dev); | 1225 | device_del(pvt->chancounts_dev); |
@@ -2259,7 +2251,7 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev) | |||
2259 | enable_sdram_scrub_setting(mci); | 2251 | enable_sdram_scrub_setting(mci); |
2260 | 2252 | ||
2261 | /* add this new MC control structure to EDAC's list of MCs */ | 2253 | /* add this new MC control structure to EDAC's list of MCs */ |
2262 | if (unlikely(edac_mc_add_mc(mci))) { | 2254 | if (unlikely(edac_mc_add_mc_with_groups(mci, i7core_dev_groups))) { |
2263 | edac_dbg(0, "MC: failed edac_mc_add_mc()\n"); | 2255 | edac_dbg(0, "MC: failed edac_mc_add_mc()\n"); |
2264 | /* FIXME: perhaps some code should go here that disables error | 2256 | /* FIXME: perhaps some code should go here that disables error |
2265 | * reporting if we just enabled it | 2257 | * reporting if we just enabled it |