mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hpe.com>
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 <toshi.kani@hpe.com>
Subject: [PATCH v3 4/5] EDAC: add edac_get_owner() to check MC owner
Date: Fri, 18 Aug 2017 13:46:43 -0600	[thread overview]
Message-ID: <20170818194644.14538-5-toshi.kani@hpe.com> (raw)
In-Reply-To: <20170818194644.14538-1-toshi.kani@hpe.com>

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 <toshi.kani@hpe.com>
Suggested-by: Borislav Petkov <bp@alien8.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
---
 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.
  *

  parent reply	other threads:[~2017-08-18 19:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 19:46 [PATCH v3 0/5] enable ghes_edac on selected platforms Toshi Kani
2017-08-18 19:46 ` [PATCH v3 1/5] ACPI / blacklist: add acpi_match_platform_list() Toshi Kani
2017-08-21 11:27   ` Borislav Petkov
2017-08-21 12:25     ` Rafael J. Wysocki
2017-08-21 13:20       ` [PATCH] ACPICA: Check whether ACPI is disabled before getting a table Borislav Petkov
2017-08-21 13:30         ` Rafael J. Wysocki
2017-08-21 15:34           ` Borislav Petkov
2017-09-03  0:43         ` kbuild test robot
2017-08-21 16:41     ` [PATCH v3 1/5] ACPI / blacklist: add acpi_match_platform_list() Kani, Toshimitsu
2017-08-21 17:04       ` Borislav Petkov
2017-08-21 17:23         ` Kani, Toshimitsu
2017-08-21 17:36           ` Borislav Petkov
2017-08-21 20:31             ` Rafael J. Wysocki
2017-08-21 21:06               ` Kani, Toshimitsu
2017-08-21 21:49                 ` Rafael J. Wysocki
2017-08-21 22:21                   ` Kani, Toshimitsu
2017-08-21 22:26                     ` Rafael J. Wysocki
2017-08-18 19:46 ` [PATCH v3 2/5] intel_pstate: convert to use acpi_match_platform_list() Toshi Kani
2017-08-21 17:53   ` Srinivas Pandruvada
2017-08-23 15:46   ` Borislav Petkov
2017-08-23 15:56     ` Kani, Toshimitsu
2017-08-18 19:46 ` [PATCH v3 3/5] ghes_edac: add platform check to enable ghes_edac Toshi Kani
2017-08-23 16:20   ` Borislav Petkov
2017-08-23 20:46     ` Rafael J. Wysocki
2017-08-24  7:54       ` Borislav Petkov
2017-08-18 19:46 ` Toshi Kani [this message]
2017-08-18 19:46 ` [PATCH v3 5/5] edac drivers: add MC owner check in init Toshi Kani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170818194644.14538-5-toshi.kani@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=bp@alien8.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®