Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751687AbdHWXFT (ORCPT ); Wed, 23 Aug 2017 19:05:19 -0400 Received: from g2t2353.austin.hpe.com ([15.233.44.26]:56670 "EHLO g2t2353.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751005AbdHWXEr (ORCPT ); Wed, 23 Aug 2017 19:04:47 -0400 From: Toshi Kani To: rjw@rjwysocki.net, bp@alien8.de Cc: mchehab@kernel.org, tony.luck@intel.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Toshi Kani Subject: [PATCH v4 4/5] EDAC: add edac_get_owner() to check MC owner Date: Wed, 23 Aug 2017 16:54:46 -0600 Message-Id: <20170823225447.15608-5-toshi.kani@hpe.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170823225447.15608-1-toshi.kani@hpe.com> References: <20170823225447.15608-1-toshi.kani@hpe.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2054 Lines: 61 Only a single edac driver can be enabled for EDAC MC. When ghes_edac is enabled, a regular edac driver for the CPU type / platform still attempts to register itself and fails in edac_mc_add_mc(). Add edac_get_owner() so that regular edac drivers can check the owner of EDAC MC without calling edac_mc_add_mc(). Signed-off-by: Toshi Kani Suggested-by: Borislav Petkov Cc: Borislav Petkov Cc: Mauro Carvalho Chehab Cc: Tony Luck --- drivers/edac/edac_mc.c | 7 ++++++- drivers/edac/edac_mc.h | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 4800721..48193f5 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -53,7 +53,7 @@ static LIST_HEAD(mc_devices); * Used to lock EDAC MC to just one module, avoiding two drivers e. g. * apei/ghes and i7core_edac to be used at the same time. */ -static void const *edac_mc_owner; +static const char *edac_mc_owner; static struct bus_type mc_bus[EDAC_MAX_MCS]; @@ -701,6 +701,11 @@ struct mem_ctl_info *edac_mc_find(int idx) } EXPORT_SYMBOL(edac_mc_find); +const char *edac_get_owner(void) +{ + return edac_mc_owner; +} +EXPORT_SYMBOL_GPL(edac_get_owner); /* FIXME - should a warning be printed if no error detection? correction? */ int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci, diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index 5357800..4165e15 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -128,6 +128,14 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, unsigned sz_pvt); /** + * edac_get_owner - Return the owner's mod_name of EDAC MC + * + * Returns: + * Pointer to mod_name string when EDAC MC is owned. NULL otherwise. + */ +extern const char *edac_get_owner(void); + +/* * edac_mc_add_mc_with_groups() - Insert the @mci structure into the mci * global list and create sysfs entries associated with @mci structure. *