Skip to content

Commit

Permalink
Merge tag 'please-pull-bp-edac' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/ras/ras

Pull EDAC fix from Tony Luck:
 "Fix EDAC lockdep splat"

* tag 'please-pull-bp-edac' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  EDAC: Fix lockdep splat
  • Loading branch information
torvalds committed Jul 24, 2013
2 parents a474902 + 88d84ac commit 04012e3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
9 changes: 9 additions & 0 deletions drivers/edac/edac_mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ static LIST_HEAD(mc_devices);
*/
static void const *edac_mc_owner;

static struct bus_type mc_bus[EDAC_MAX_MCS];

unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
unsigned len)
{
Expand Down Expand Up @@ -723,6 +725,11 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
int ret = -EINVAL;
edac_dbg(0, "\n");

if (mci->mc_idx >= EDAC_MAX_MCS) {
pr_warn_once("Too many memory controllers: %d\n", mci->mc_idx);
return -ENODEV;
}

#ifdef CONFIG_EDAC_DEBUG
if (edac_debug_level >= 3)
edac_mc_dump_mci(mci);
Expand Down Expand Up @@ -762,6 +769,8 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
/* set load time so that error rate can be tracked */
mci->start_time = jiffies;

mci->bus = &mc_bus[mci->mc_idx];

if (edac_create_sysfs_mci_device(mci)) {
edac_mc_printk(mci, KERN_WARNING,
"failed to create sysfs device\n");
Expand Down
28 changes: 15 additions & 13 deletions drivers/edac/edac_mc_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
return -ENODEV;

csrow->dev.type = &csrow_attr_type;
csrow->dev.bus = &mci->bus;
csrow->dev.bus = mci->bus;
device_initialize(&csrow->dev);
csrow->dev.parent = &mci->dev;
csrow->mci = mci;
Expand Down Expand Up @@ -605,7 +605,7 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci,
dimm->mci = mci;

dimm->dev.type = &dimm_attr_type;
dimm->dev.bus = &mci->bus;
dimm->dev.bus = mci->bus;
device_initialize(&dimm->dev);

dimm->dev.parent = &mci->dev;
Expand Down Expand Up @@ -975,11 +975,13 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
* The memory controller needs its own bus, in order to avoid
* namespace conflicts at /sys/bus/edac.
*/
mci->bus.name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx);
if (!mci->bus.name)
mci->bus->name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx);
if (!mci->bus->name)
return -ENOMEM;
edac_dbg(0, "creating bus %s\n", mci->bus.name);
err = bus_register(&mci->bus);

edac_dbg(0, "creating bus %s\n", mci->bus->name);

err = bus_register(mci->bus);
if (err < 0)
return err;

Expand All @@ -988,7 +990,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
device_initialize(&mci->dev);

mci->dev.parent = mci_pdev;
mci->dev.bus = &mci->bus;
mci->dev.bus = mci->bus;
dev_set_name(&mci->dev, "mc%d", mci->mc_idx);
dev_set_drvdata(&mci->dev, mci);
pm_runtime_forbid(&mci->dev);
Expand All @@ -997,8 +999,8 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
err = device_add(&mci->dev);
if (err < 0) {
edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev));
bus_unregister(&mci->bus);
kfree(mci->bus.name);
bus_unregister(mci->bus);
kfree(mci->bus->name);
return err;
}

Expand Down Expand Up @@ -1064,8 +1066,8 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
}
fail2:
device_unregister(&mci->dev);
bus_unregister(&mci->bus);
kfree(mci->bus.name);
bus_unregister(mci->bus);
kfree(mci->bus->name);
return err;
}

Expand Down Expand Up @@ -1098,8 +1100,8 @@ void edac_unregister_sysfs(struct mem_ctl_info *mci)
{
edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev));
device_unregister(&mci->dev);
bus_unregister(&mci->bus);
kfree(mci->bus.name);
bus_unregister(mci->bus);
kfree(mci->bus->name);
}

static void mc_attr_release(struct device *dev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/edac/i5100_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ static int i5100_setup_debugfs(struct mem_ctl_info *mci)
if (!i5100_debugfs)
return -ENODEV;

priv->debugfs = debugfs_create_dir(mci->bus.name, i5100_debugfs);
priv->debugfs = debugfs_create_dir(mci->bus->name, i5100_debugfs);

if (!priv->debugfs)
return -ENOMEM;
Expand Down
7 changes: 6 additions & 1 deletion include/linux/edac.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ struct edac_raw_error_desc {
*/
struct mem_ctl_info {
struct device dev;
struct bus_type bus;
struct bus_type *bus;

struct list_head link; /* for global list of mem_ctl_info structs */

Expand Down Expand Up @@ -742,4 +742,9 @@ struct mem_ctl_info {
#endif
};

/*
* Maximum number of memory controllers in the coherent fabric.
*/
#define EDAC_MAX_MCS 16

#endif

0 comments on commit 04012e3

Please sign in to comment.