Support building tegra124-cpufreq as a module
Subsystems (2)
v3 cover Support building tegra124-cpufreq as a module
This adds remove and exit routines that were not previously needed when this was only available builtin. It also converts use of an unexported function to a more sane alternative.
---
Changes in v3:
- In patch 1, set cpufreq_dt_pdev to an error after unregister on fail
to prevent a potential double unregister on remove
- In patch 2, clean up clocks on exit
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Replace patch 1 with a patch to not use the unexported function
- Update patch 2 to add remove and exit routines
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Aaron Kling (2):
cpufreq: tegra124: Remove use of disable_cpufreq
cpufreq: tegra124: Allow building as a module
drivers/cpufreq/Kconfig.arm | 2 +- drivers/cpufreq/tegra124-cpufreq.c | 46 +++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-)
---
base-commit: 91e5bfe317d8f8471fbaa3e70cf66cae1314a516
change-id: 20250401-tegra124-cpufreq-fd944fdce62c
Best regards,
Signature · 1 line
Aaron Kling <[email protected]>
PATCH v3 1/2 cpufreq: tegra124: Remove use of disable_cpufreq
Instead, unregister the cpufreq device for this fatal fail case.
--- drivers/cpufreq/tegra124-cpufreq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/cpufreq/tegra124-cpufreq.c +4 -1
@@ -168,7 +168,10 @@ static int __maybe_unused tegra124_cpufreq_resume(struct device *dev) disable_dfll:clk_disable_unprepare (priv->dfll_clk); disable_cpufreq: -disable_cpufreq (); +if (!IS_ERR (priv->cpufreq_dt_pdev)) { +platform_device_unregister (priv->cpufreq_dt_pdev); + priv->cpufreq_dt_pdev =ERR_PTR (-ENODEV ); + }return err; }
Signature · 1 line
2.48.1
PATCH v3 2/2 cpufreq: tegra124: Allow building as a module
In reply to Aaron KlingThis requires three changes:
* A soft dependency on cpufreq-dt as this driver only handles power management and cpufreq-dt does the real operations
* Adding a remove routine to remove the cpufreq-dt device
* Adding a exit routine to handle cleaning up the driver
--- drivers/cpufreq/Kconfig.arm | 2 +- drivers/cpufreq/tegra124-cpufreq.c | 41 ++++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 5 deletions(-)
drivers/cpufreq/Kconfig.arm +1 -1
@@ -238,7 +238,7 @@ config ARM_TEGRA20_CPUFREQ This adds the CPUFreq driver support for Tegra20/30 SOCs. config ARM_TEGRA124_CPUFREQ - bool "Tegra124 CPUFreq support" + tristate "Tegra124 CPUFreq support" depends on ARCH_TEGRA || COMPILE_TEST depends on CPUFREQ_DT default y
drivers/cpufreq/tegra124-cpufreq.c +37 -4
76 lines not on this page · raw message
Signature · 1 line
2.48.1
Viresh Kumar
maintainerRe: [PATCH v3 2/2] cpufreq: tegra124: Allow building as a module
Quoted 1 line · On 21-04-25, 12:33, Aaron Kling via B4 Relay wrote:
+static void
__exittegra_cpufreq_module_exit(void)
Shouldn't name be tegra_cpufreq_exit() ? Just like tegra_cpufreq_init().
drivers/cpufreq/tegra124-cpufreq.c static int __init tegra_cpufreq_init(void) · line 239
Quoted 10 lines
drivers/cpufreq/tegra124-cpufreq.c +10
-0+{ +struct tegra124_cpufreq_priv *priv; + +if (platform_device && !IS_ERR (platform_device)) { + priv =dev_get_drvdata (&platform_device->dev); + +clk_put (priv->pllp_clk); +clk_put (priv->pllx_clk); +clk_put (priv->dfll_clk); +clk_put (priv->cpu_clk);
Shouldn't this be done from remove() as the resources were acquired in probe() ? tegra_cpufreq_exit() should only revert what's done by tegra_cpufreq_init().
Signature · 1 line
viresh