Commit d45e7823 authored by Doug Thompson's avatar Doug Thompson Committed by Linus Torvalds

drivers/edac: fix edac_device init apis

Refactoring of sysfs code necessitated the refactoring of the
edac_device_alloc() and edac_device_add_device() apis, of moving the index
value to the alloc() function.  This patch alters the in tree drivers to
utilize this new api signature.

Having the index value performed later created a chicken-and-the-egg issue.
Moving it to the alloc() function allows for creating the necessary sysfs
entries with the proper index number

Cc: Alan Cox alan@lxorguk.ukuu.org.uk
Signed-off-by: default avatarDoug Thompson <dougthompson@xmission.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b8f6f975
...@@ -634,7 +634,8 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -634,7 +634,8 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info(
char *edac_block_name, unsigned nr_blocks, char *edac_block_name, unsigned nr_blocks,
unsigned offset_value, unsigned offset_value,
struct edac_dev_sysfs_block_attribute *block_attributes, struct edac_dev_sysfs_block_attribute *block_attributes,
unsigned nr_attribs); unsigned nr_attribs,
int device_index);
/* The offset value can be: /* The offset value can be:
* -1 indicating no offset value * -1 indicating no offset value
...@@ -806,8 +807,7 @@ extern void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci, unsigned int csrow, ...@@ -806,8 +807,7 @@ extern void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci, unsigned int csrow,
/* /*
* edac_device APIs * edac_device APIs
*/ */
extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev, extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev);
int dev_idx);
extern struct edac_device_ctl_info *edac_device_del_device(struct device *dev); extern struct edac_device_ctl_info *edac_device_del_device(struct device *dev);
extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
int inst_nr, int block_nr, const char *msg); int inst_nr, int block_nr, const char *msg);
......
...@@ -67,7 +67,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -67,7 +67,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
char *edac_device_name, unsigned nr_instances, char *edac_device_name, unsigned nr_instances,
char *edac_block_name, unsigned nr_blocks, char *edac_block_name, unsigned nr_blocks,
unsigned offset_value, /* zero, 1, or other based offset */ unsigned offset_value, /* zero, 1, or other based offset */
struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib) struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib,
int device_index)
{ {
struct edac_device_ctl_info *dev_ctl; struct edac_device_ctl_info *dev_ctl;
struct edac_device_instance *dev_inst, *inst; struct edac_device_instance *dev_inst, *inst;
...@@ -145,6 +146,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -145,6 +146,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL; pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL;
/* Begin storing the information into the control info structure */ /* Begin storing the information into the control info structure */
dev_ctl->dev_idx = device_index;
dev_ctl->nr_instances = nr_instances; dev_ctl->nr_instances = nr_instances;
dev_ctl->instances = dev_inst; dev_ctl->instances = dev_inst;
dev_ctl->pvt_info = pvt; dev_ctl->pvt_info = pvt;
...@@ -441,18 +443,16 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, ...@@ -441,18 +443,16 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
* edac_device global list and create sysfs entries associated with * edac_device global list and create sysfs entries associated with
* edac_device structure. * edac_device structure.
* @edac_device: pointer to the edac_device structure to be added to the list * @edac_device: pointer to the edac_device structure to be added to the list
* @edac_idx: A unique numeric identifier to be assigned to the
* 'edac_device' structure. * 'edac_device' structure.
* *
* Return: * Return:
* 0 Success * 0 Success
* !0 Failure * !0 Failure
*/ */
int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) int edac_device_add_device(struct edac_device_ctl_info *edac_dev)
{ {
debugf0("%s()\n", __func__); debugf0("%s()\n", __func__);
edac_dev->dev_idx = edac_idx;
#ifdef CONFIG_EDAC_DEBUG #ifdef CONFIG_EDAC_DEBUG
if (edac_debug_level >= 3) if (edac_debug_level >= 3)
edac_device_dump_device(edac_dev); edac_device_dump_device(edac_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment