All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] x86/microcode: move @microcode_mutex definition near usage
Date: Fri, 24 Mar 2023 11:47:20 +0000	[thread overview]
Message-ID: <20230324114720.1756466-1-john.ogness@linutronix.de> (raw)

If CONFIG_MICROCODE_LATE_LOADING is not enabled, the compiler warns:

'microcode_mutex' defined but not used

Since reload_store() is the only function using this mutex, move the
mutex definititon there. Then it is also within the #ifdef block for
CONFIG_MICROCODE_LATE_LOADING.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
 arch/x86/kernel/cpu/microcode/core.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 7a329e561354..e7b8f7ad105d 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -49,20 +49,6 @@ bool initrd_gone;
 
 LIST_HEAD(microcode_cache);
 
-/*
- * Synchronization.
- *
- * All non cpu-hotplug-callback call sites use:
- *
- * - microcode_mutex to synchronize with each other;
- * - cpus_read_lock/unlock() to synchronize with
- *   the cpu-hotplug-callback call sites.
- *
- * We guarantee that only a single cpu is being
- * updated at any particular moment of time.
- */
-static DEFINE_MUTEX(microcode_mutex);
-
 struct ucode_cpu_info		ucode_cpu_info[NR_CPUS];
 
 struct cpu_info_ctx {
@@ -465,6 +451,20 @@ static int microcode_reload_late(void)
 	return ret;
 }
 
+/*
+ * Synchronization.
+ *
+ * All non cpu-hotplug-callback call sites use:
+ *
+ * - microcode_mutex to synchronize with each other;
+ * - cpus_read_lock/unlock() to synchronize with
+ *   the cpu-hotplug-callback call sites.
+ *
+ * We guarantee that only a single cpu is being
+ * updated at any particular moment of time.
+ */
+static DEFINE_MUTEX(microcode_mutex);
+
 static ssize_t reload_store(struct device *dev,
 			    struct device_attribute *attr,
 			    const char *buf, size_t size)

base-commit: 1e760fa3596e8c7f08412712c168288b79670d78
-- 
2.30.2


             reply	other threads:[~2023-03-24 11:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 11:47 John Ogness [this message]
2023-03-24 12:00 ` [PATCH] x86/microcode: move @microcode_mutex definition near usage Borislav Petkov
2023-03-24 13:11   ` John Ogness
2023-03-24 15:19     ` Borislav Petkov
2023-03-24 16:33       ` John Ogness
2023-03-24 16:44         ` Borislav Petkov
2023-07-12 14:09     ` John B. Wyatt IV

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=20230324114720.1756466-1-john.ogness@linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.