All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: [PATCH] parisc: Convert parisc_requires_coherency() to static branch
Date: Fri, 18 Mar 2022 23:46:32 +0100	[thread overview]
Message-ID: <20220318224632.132721-1-deller@gmx.de> (raw)

Optimize the parisc_requires_coherency() macro to use a static branch.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 arch/parisc/include/asm/processor.h | 5 +++--
 arch/parisc/kernel/processor.c      | 7 +++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h
index 006364212795..9fc80a77b46a 100644
--- a/arch/parisc/include/asm/processor.h
+++ b/arch/parisc/include/asm/processor.h
@@ -11,6 +11,7 @@

 #ifndef __ASSEMBLY__
 #include <linux/threads.h>
+#include <linux/jump_label.h>

 #include <asm/assembly.h>
 #include <asm/prefetch.h>
@@ -281,8 +282,8 @@ extern unsigned long __get_wchan(struct task_struct *p);
  * with different data, whether clean or not) to operate
  */
 #ifdef CONFIG_PA8X00
-extern int _parisc_requires_coherency;
-#define parisc_requires_coherency()	_parisc_requires_coherency
+DECLARE_STATIC_KEY_TRUE(_parisc_requires_coherency);
+#define parisc_requires_coherency() static_branch_likely(&_parisc_requires_coherency)
 #else
 #define parisc_requires_coherency()	(0)
 #endif
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index 1b6129e7d776..ccaf075d0750 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -32,8 +32,7 @@
 struct system_cpuinfo_parisc boot_cpu_data __ro_after_init;
 EXPORT_SYMBOL(boot_cpu_data);
 #ifdef CONFIG_PA8X00
-int _parisc_requires_coherency __ro_after_init;
-EXPORT_SYMBOL(_parisc_requires_coherency);
+DEFINE_STATIC_KEY_TRUE(_parisc_requires_coherency);
 #endif

 DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data);
@@ -284,8 +283,8 @@ void __init collect_boot_cpu_data(void)
 	boot_cpu_data.family_name = cpu_name_version[boot_cpu_data.cpu_type][1];

 #ifdef CONFIG_PA8X00
-	_parisc_requires_coherency = (boot_cpu_data.cpu_type == mako) ||
-				(boot_cpu_data.cpu_type == mako2);
+	if ((boot_cpu_data.cpu_type != mako) && (boot_cpu_data.cpu_type != mako2))
+		static_branch_disable(&_parisc_requires_coherency);
 #endif

 	if (pdc_model_platform_info(orig_prod_num, current_prod_num, serial_no) == PDC_OK) {
--
2.35.1


                 reply	other threads:[~2022-03-18 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220318224632.132721-1-deller@gmx.de \
    --to=deller@gmx.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=linux-parisc@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.