Skip to content

Commit

Permalink
EDAC: highbank: Use static attribute groups for sysfs entries
Browse files Browse the repository at this point in the history
... instead of manual device_create_file() and device_remove_file()
calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: http://lkml.kernel.org/r/1423046938-18111-9-git-send-email-tiwai@suse.de
Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
tiwai authored and Borislav Petkov committed Feb 23, 2015
1 parent 1bf06a0 commit fc7cc6b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/edac/highbank_mc_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ static ssize_t highbank_mc_inject_ctrl(struct device *dev,

static DEVICE_ATTR(inject_ctrl, S_IWUSR, NULL, highbank_mc_inject_ctrl);

static struct attribute *highbank_dev_attrs[] = {
&dev_attr_inject_ctrl.attr,
NULL
};

ATTRIBUTE_GROUPS(highbank_dev);

struct hb_mc_settings {
int err_offset;
int int_offset;
Expand Down Expand Up @@ -231,7 +238,7 @@ static int highbank_mc_probe(struct platform_device *pdev)
dimm->mtype = MEM_DDR3;
dimm->edac_mode = EDAC_SECDED;

res = edac_mc_add_mc(mci);
res = edac_mc_add_mc_with_groups(mci, highbank_dev_groups);
if (res < 0)
goto err;

Expand All @@ -243,8 +250,6 @@ static int highbank_mc_probe(struct platform_device *pdev)
goto err2;
}

device_create_file(&mci->dev, &dev_attr_inject_ctrl);

devres_close_group(&pdev->dev, NULL);
return 0;
err2:
Expand All @@ -259,7 +264,6 @@ static int highbank_mc_remove(struct platform_device *pdev)
{
struct mem_ctl_info *mci = platform_get_drvdata(pdev);

device_remove_file(&mci->dev, &dev_attr_inject_ctrl);
edac_mc_del_mc(&pdev->dev);
edac_mc_free(mci);
return 0;
Expand Down

0 comments on commit fc7cc6b

Please sign in to comment.