Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Takashi Iwai and committed by
Borislav Petkov
2eace188 e97d7e38

+11 -19
+11 -19
drivers/edac/i7core_edac.c
··· 1157 1157 static DEVICE_ATTR(inject_enable, S_IRUGO | S_IWUSR, 1158 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 1170 static int i7core_create_sysfs_devices(struct mem_ctl_info *mci) 1161 1171 { 1162 1172 struct i7core_pvt *pvt = mci->pvt_info; 1163 1173 int rc; 1164 - 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 1174 1178 1175 pvt->addrmatch_dev = kzalloc(sizeof(*pvt->addrmatch_dev), GFP_KERNEL); 1179 1176 if (!pvt->addrmatch_dev) ··· 1219 1222 struct i7core_pvt *pvt = mci->pvt_info; 1220 1223 1221 1224 edac_dbg(1, "\n"); 1222 - 1223 - device_remove_file(&mci->dev, &dev_attr_inject_section); 1224 - device_remove_file(&mci->dev, &dev_attr_inject_type); 1225 - device_remove_file(&mci->dev, &dev_attr_inject_eccmask); 1226 - device_remove_file(&mci->dev, &dev_attr_inject_enable); 1227 1225 1228 1226 if (!pvt->is_registered) { 1229 1227 put_device(pvt->chancounts_dev); ··· 2251 2259 enable_sdram_scrub_setting(mci); 2252 2260 2253 2261 /* add this new MC control structure to EDAC's list of MCs */ 2254 - if (unlikely(edac_mc_add_mc(mci))) { 2262 + if (unlikely(edac_mc_add_mc_with_groups(mci, i7core_dev_groups))) { 2255 2263 edac_dbg(0, "MC: failed edac_mc_add_mc()\n"); 2256 2264 /* FIXME: perhaps some code should go here that disables error 2257 2265 * reporting if we just enabled it