summaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc.c
diff options
context:
space:
mode:
authorYazen Ghannam <Yazen.Ghannam@amd.com>2017-01-27 18:24:21 +0100
committerBorislav Petkov <bp@suse.de>2017-01-28 14:36:47 +0100
commitd7fc9d77acb8651e5fcb77df71dfd11fcf1f08ba (patch)
tree8b425f989437a0ff7e535dfb46b889441fbb1cba /drivers/edac/edac_mc.c
parentEDAC, amd64: Remove unused printing macros (diff)
downloadlinux-d7fc9d77acb8651e5fcb77df71dfd11fcf1f08ba.tar.xz
linux-d7fc9d77acb8651e5fcb77df71dfd11fcf1f08ba.zip
EDAC: Add routine to check if MC devices list is empty
We need to know if any MC devices have been allocated. Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1485537863-2707-7-git-send-email-Yazen.Ghannam@amd.com [ Prettify text. ] Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac/edac_mc.c')
-rw-r--r--drivers/edac/edac_mc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 750891ea07de..e5573c56b15e 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -453,6 +453,20 @@ void edac_mc_free(struct mem_ctl_info *mci)
}
EXPORT_SYMBOL_GPL(edac_mc_free);
+bool edac_has_mcs(void)
+{
+ bool ret;
+
+ mutex_lock(&mem_ctls_mutex);
+
+ ret = list_empty(&mc_devices);
+
+ mutex_unlock(&mem_ctls_mutex);
+
+ return !ret;
+}
+EXPORT_SYMBOL_GPL(edac_has_mcs);
+
/* Caller must hold mem_ctls_mutex */
static struct mem_ctl_info *__find_mci_by_dev(struct device *dev)
{