diff mbox series

[v2,3/3] acpi: processor_perflib: extend X86 dependency

Message ID 20241011061948.3211423-3-arnd@kernel.org (mailing list archive)
State New
Headers show
Series [v2,1/3] acpi: make EC support compile-time conditional | expand

Commit Message

Arnd Bergmann Oct. 11, 2024, 6:18 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The majority of the processor_perflib code is only used by cpufreq
drivers on the x86 architecture and makes no sense without the
x86 SMI interactions that rely on I/O port access.

Replace the existing #ifdef checks with one that covers all of the
code that is only used by x86 drivers, saving a little bit
of kernel code size on other architectures.

There is likely more code under CONFIG_ACPI_PROCESSOR that falls
into this category, but changing those would require a larger
rework.

Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This is not needed for correctness, only as a small optimization.
---
 drivers/acpi/processor_perflib.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

kernel test robot Oct. 12, 2024, 10:38 p.m. UTC | #1
Hi Arnd,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus groeck-staging/hwmon-next soc/for-next linus/master v6.12-rc2 next-20241011]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/acpi-allow-building-without-CONFIG_HAS_IOPORT/20241011-142245
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20241011061948.3211423-3-arnd%40kernel.org
patch subject: [PATCH v2 3/3] acpi: processor_perflib: extend X86 dependency
config: riscv-allmodconfig (https://download.01.org/0day-ci/archive/20241013/202410130611.9S3HzhgF-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 70e0a7e7e6a8541bcc46908c592eed561850e416)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241013/202410130611.9S3HzhgF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410130611.9S3HzhgF-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/acpi/processor_perflib.c:27:21: warning: unused variable 'performance_mutex' [-Wunused-variable]
      27 | static DEFINE_MUTEX(performance_mutex);
         |                     ^~~~~~~~~~~~~~~~~
   include/linux/mutex.h:112:15: note: expanded from macro 'DEFINE_MUTEX'
     112 |         struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
         |                      ^~~~~~~~~
   1 warning generated.


vim +/performance_mutex +27 drivers/acpi/processor_perflib.c

^1da177e4c3f41 Linus Torvalds   2005-04-16  26  
65c19bbd28cba5 Arjan van de Ven 2006-04-27 @27  static DEFINE_MUTEX(performance_mutex);
^1da177e4c3f41 Linus Torvalds   2005-04-16  28
diff mbox series

Patch

diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 4265814c74f8..9a959a963a79 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -209,6 +209,7 @@  void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
 	}
 }
 
+#ifdef CONFIG_X86
 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
 {
 	int result = 0;
@@ -267,7 +268,6 @@  static int acpi_processor_get_performance_control(struct acpi_processor *pr)
 	return result;
 }
 
-#ifdef CONFIG_X86
 /*
  * Some AMDs have 50MHz frequency multiples, but only provide 100MHz rounding
  * in their ACPI data. Calculate the real values and fix up the _PSS data.
@@ -298,9 +298,6 @@  static void amd_fixup_frequency(struct acpi_processor_px *px, int i)
 			px->core_frequency = (100 * (fid + 8)) >> did;
 	}
 }
-#else
-static void amd_fixup_frequency(struct acpi_processor_px *px, int i) {};
-#endif
 
 static int acpi_processor_get_performance_states(struct acpi_processor *pr)
 {
@@ -440,13 +437,11 @@  int acpi_processor_get_performance_info(struct acpi_processor *pr)
 	 * the BIOS is older than the CPU and does not know its frequencies
 	 */
  update_bios:
-#ifdef CONFIG_X86
 	if (acpi_has_method(pr->handle, "_PPC")) {
 		if(boot_cpu_has(X86_FEATURE_EST))
 			pr_warn(FW_BUG "BIOS needs update for CPU "
 			       "frequency support\n");
 	}
-#endif
 	return result;
 }
 EXPORT_SYMBOL_GPL(acpi_processor_get_performance_info);
@@ -788,3 +783,4 @@  void acpi_processor_unregister_performance(unsigned int cpu)
 	mutex_unlock(&performance_mutex);
 }
 EXPORT_SYMBOL(acpi_processor_unregister_performance);
+#endif