diff mbox series

[v2,1/3] cpufreq: Export acpu_cpufreq_exit for other drivers to call

Message ID 20220329015947.565-2-mario.limonciello@amd.com
State New
Headers show
Series Improve usability for amd-pstate | expand

Commit Message

Mario Limonciello March 29, 2022, 1:59 a.m. UTC
Currently, the only way to load an alternative cpufreq driver is to unload
acpi-cpufreq first.

Loosen that restriction to allow other kernel modules to unregister a
registered driver.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Export symbol instead of changing internals

 drivers/cpufreq/acpi-cpufreq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Huang Rui March 29, 2022, 5:47 a.m. UTC | #1
On Tue, Mar 29, 2022 at 09:59:45AM +0800, Limonciello, Mario wrote:
> Currently, the only way to load an alternative cpufreq driver is to unload
> acpi-cpufreq first.
> 
> Loosen that restriction to allow other kernel modules to unregister a
> registered driver.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Reviewed-by: Huang Rui <ray.huang@amd.com>

> ---
> v1->v2:
>  * Export symbol instead of changing internals
> 
>  drivers/cpufreq/acpi-cpufreq.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 3d514b82d055..92ac978c1c53 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -1033,7 +1033,7 @@ static int __init acpi_cpufreq_init(void)
>  	return ret;
>  }
>  
> -static void __exit acpi_cpufreq_exit(void)
> +void __exit acpi_cpufreq_exit(void)
>  {
>  	pr_debug("%s\n", __func__);
>  
> @@ -1043,6 +1043,7 @@ static void __exit acpi_cpufreq_exit(void)
>  
>  	free_acpi_perf_data();
>  }
> +EXPORT_SYMBOL_GPL(acpi_cpufreq_exit);
>  
>  module_param(acpi_pstate_strict, uint, 0644);
>  MODULE_PARM_DESC(acpi_pstate_strict,
> -- 
> 2.34.1
>
kernel test robot March 29, 2022, 6:22 a.m. UTC | #2
Hi Mario,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on v5.17 next-20220329]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/Improve-usability-for-amd-pstate/20220329-100211
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220329/202203291412.G3zBxLNx-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/86835efc7d91d9fc921d7d425b1fdab9c13feafb
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Mario-Limonciello/Improve-usability-for-amd-pstate/20220329-100211
        git checkout 86835efc7d91d9fc921d7d425b1fdab9c13feafb
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/cpufreq/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/cpufreq/acpi-cpufreq.c:1036:13: warning: no previous prototype for 'acpi_cpufreq_exit' [-Wmissing-prototypes]
    1036 | void __exit acpi_cpufreq_exit(void)
         |             ^~~~~~~~~~~~~~~~~


vim +/acpi_cpufreq_exit +1036 drivers/cpufreq/acpi-cpufreq.c

  1035	
> 1036	void __exit acpi_cpufreq_exit(void)
  1037	{
  1038		pr_debug("%s\n", __func__);
  1039	
  1040		acpi_cpufreq_boost_exit();
  1041	
  1042		cpufreq_unregister_driver(&acpi_cpufreq_driver);
  1043	
  1044		free_acpi_perf_data();
  1045	}
  1046	EXPORT_SYMBOL_GPL(acpi_cpufreq_exit);
  1047
diff mbox series

Patch

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 3d514b82d055..92ac978c1c53 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -1033,7 +1033,7 @@  static int __init acpi_cpufreq_init(void)
 	return ret;
 }
 
-static void __exit acpi_cpufreq_exit(void)
+void __exit acpi_cpufreq_exit(void)
 {
 	pr_debug("%s\n", __func__);
 
@@ -1043,6 +1043,7 @@  static void __exit acpi_cpufreq_exit(void)
 
 	free_acpi_perf_data();
 }
+EXPORT_SYMBOL_GPL(acpi_cpufreq_exit);
 
 module_param(acpi_pstate_strict, uint, 0644);
 MODULE_PARM_DESC(acpi_pstate_strict,