Commit d45e7823baf655ced91c7987fb4ba9aae990ad6d
Committed by
Linus Torvalds
1 parent
b8f6f97552
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: Doug Thompson <dougthompson@xmission.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 7 additions and 7 deletions Side-by-side Diff
drivers/edac/edac_core.h
... | ... | @@ -634,7 +634,8 @@ |
634 | 634 | char *edac_block_name, unsigned nr_blocks, |
635 | 635 | unsigned offset_value, |
636 | 636 | struct edac_dev_sysfs_block_attribute *block_attributes, |
637 | - unsigned nr_attribs); | |
637 | + unsigned nr_attribs, | |
638 | + int device_index); | |
638 | 639 | |
639 | 640 | /* The offset value can be: |
640 | 641 | * -1 indicating no offset value |
... | ... | @@ -806,8 +807,7 @@ |
806 | 807 | /* |
807 | 808 | * edac_device APIs |
808 | 809 | */ |
809 | -extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev, | |
810 | - int dev_idx); | |
810 | +extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev); | |
811 | 811 | extern struct edac_device_ctl_info *edac_device_del_device(struct device *dev); |
812 | 812 | extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, |
813 | 813 | int inst_nr, int block_nr, const char *msg); |
drivers/edac/edac_device.c
... | ... | @@ -67,7 +67,8 @@ |
67 | 67 | char *edac_device_name, unsigned nr_instances, |
68 | 68 | char *edac_block_name, unsigned nr_blocks, |
69 | 69 | unsigned offset_value, /* zero, 1, or other based offset */ |
70 | - struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib) | |
70 | + struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib, | |
71 | + int device_index) | |
71 | 72 | { |
72 | 73 | struct edac_device_ctl_info *dev_ctl; |
73 | 74 | struct edac_device_instance *dev_inst, *inst; |
... | ... | @@ -145,6 +146,7 @@ |
145 | 146 | pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL; |
146 | 147 | |
147 | 148 | /* Begin storing the information into the control info structure */ |
149 | + dev_ctl->dev_idx = device_index; | |
148 | 150 | dev_ctl->nr_instances = nr_instances; |
149 | 151 | dev_ctl->instances = dev_inst; |
150 | 152 | dev_ctl->pvt_info = pvt; |
151 | 153 | |
152 | 154 | |
... | ... | @@ -441,18 +443,16 @@ |
441 | 443 | * edac_device global list and create sysfs entries associated with |
442 | 444 | * edac_device structure. |
443 | 445 | * @edac_device: pointer to the edac_device structure to be added to the list |
444 | - * @edac_idx: A unique numeric identifier to be assigned to the | |
445 | 446 | * 'edac_device' structure. |
446 | 447 | * |
447 | 448 | * Return: |
448 | 449 | * 0 Success |
449 | 450 | * !0 Failure |
450 | 451 | */ |
451 | -int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) | |
452 | +int edac_device_add_device(struct edac_device_ctl_info *edac_dev) | |
452 | 453 | { |
453 | 454 | debugf0("%s()\n", __func__); |
454 | 455 | |
455 | - edac_dev->dev_idx = edac_idx; | |
456 | 456 | #ifdef CONFIG_EDAC_DEBUG |
457 | 457 | if (edac_debug_level >= 3) |
458 | 458 | edac_device_dump_device(edac_dev); |