summaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_module.h
diff options
context:
space:
mode:
authorRobert Richter <rrichter@marvell.com>2020-02-12 13:03:40 +0100
committerBorislav Petkov <bp@suse.de>2020-02-17 12:32:44 +0100
commitbea1bfd5b7226ac7c3f93f76be89221f33222a34 (patch)
tree9d610167b176b5888e31074e0a70e3f82a7b393d /drivers/edac/edac_module.h
parent11a48a5a18c63fd7621bb050228cebf13566e4d8 (diff)
downloadlinux-bea1bfd5b7226ac7c3f93f76be89221f33222a34.tar.gz
linux-bea1bfd5b7226ac7c3f93f76be89221f33222a34.tar.xz
EDAC/mc: Change mci device removal to use put_device()
There are dimm and csrow devices linked to the mci device esp. to show up in sysfs. It must be granted that children devices are removed before its mci parent. Thus, the release functions must be called in the correct order and may not miss any child before releasing its parent. In the current implementation this is only granted by the correct order of release functions. A much better approach is to use put_device() that releases the device only after all users are gone. It is the recommended way to release a device and free its memory. The function uses the device's refcount and only frees it if there are no users of it anymore such as children. So implement a mci_release() function to remove mci devices, use put_device() to free them and early initialize the mci device right after its struct has been allocated. Change the release function so that it can be universally used no matter if the device is registered or not. Since subsequent dimm and csrow sysfs links are implemented as children devices, their refcounts will keep the parent mci device from being removed as long as sysfs entries exist and until all users have been unregistered in edac_remove_sysfs_mci_device(). Remove edac_unregister_sysfs() and merge mci sysfs removal into edac_remove_sysfs_mci_device(). There is only a single instance now that removes the sysfs entries. The function can now be used in the error paths for cleanup. Also, create device release functions for all involved devices (dev->release), remove device_type release functions (dev_type-> release) and also use dev->init_name instead of dev_set_name(). [ bp: Massage commit message and comments. ] Signed-off-by: Robert Richter <rrichter@marvell.com> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Aristeu Rozanski <aris@redhat.com> Link: https://lkml.kernel.org/r/20200212120340.4764-5-rrichter@marvell.com
Diffstat (limited to 'drivers/edac/edac_module.h')
-rw-r--r--drivers/edac/edac_module.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 388427d378b1..aa1f91688eb8 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -28,7 +28,6 @@ void edac_mc_sysfs_exit(void);
extern int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
const struct attribute_group **groups);
extern void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci);
-void edac_unregister_sysfs(struct mem_ctl_info *mci);
extern int edac_get_log_ue(void);
extern int edac_get_log_ce(void);
extern int edac_get_panic_on_ue(void);