Message ID | 20250420-tegra124-cpufreq-v1-2-0a47fe126091@gmail.com |
---|---|
State | New |
Headers | show |
Series | Support building tegra124-cpufreq as a module | expand |
On 20-04-25, 15:42, Aaron Kling via B4 Relay wrote: > From: Aaron Kling <webgeek1234@gmail.com> > > This requires a soft dependency on cpufreq-dt as this driver only > handles power management and cpufreq-dt does the real operations. Other > than that, this works fine as a module, so allow building as such. > > Signed-off-by: Aaron Kling <webgeek1234@gmail.com> > --- > drivers/cpufreq/Kconfig.arm | 2 +- > drivers/cpufreq/tegra124-cpufreq.c | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm > index 4f9cb943d945c244eb2b29f543d14df6cac4e5d4..625f6fbdaaf5fd774e3b0bb996eb7ce980da41ee 100644 > --- a/drivers/cpufreq/Kconfig.arm > +++ b/drivers/cpufreq/Kconfig.arm > @@ -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 > diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c > index 514146d98bca2d8aa59980a14dff3487cd8045f6..9e46b53487fafdc1e9e95e765b9b490d9c95f2c6 100644 > --- a/drivers/cpufreq/tegra124-cpufreq.c > +++ b/drivers/cpufreq/tegra124-cpufreq.c > @@ -211,5 +211,7 @@ static int __init tegra_cpufreq_init(void) > } > module_init(tegra_cpufreq_init); > > +MODULE_SOFTDEP("pre: cpufreq-dt"); > MODULE_AUTHOR("Tuomas Tynkkynen <ttynkkynen@nvidia.com>"); > MODULE_DESCRIPTION("cpufreq driver for NVIDIA Tegra124"); > +MODULE_LICENSE("GPL"); Can you try inserting/removing/and inserting the driver again ? I believe it will lead to some failures as no cleanup is being done by the driver.
On Mon, Apr 21, 2025 at 12:58 AM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On 21-04-25, 00:52, Aaron Kling wrote: > > lsmod lists the module as "[permanent]" and if I try to rmmod the > > module, the command throws 'device or resource busy'. > > Ahh, I thought kernel will give error on double insertion instead. But > it looks like we keep some sort of refcount for the devices registered > by the driver and don't let it unload. This situation piqued my interest since I was unfamiliar with the permanent flag in lsmod. And I found this stackoverflow answer [0] that explained it. If no module_exit is defined, the module cannot be removed. > > Anyway, if you want it to be a module, then it must unload as well I > guess. > > You need to do the reverse of tegra_cpufreq_init() from module_exit to > get it working I guess. I will look into adding an exit for v2. Sincerely, Aaron [0] https://stackoverflow.com/a/33464275
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 4f9cb943d945c244eb2b29f543d14df6cac4e5d4..625f6fbdaaf5fd774e3b0bb996eb7ce980da41ee 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -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 diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c index 514146d98bca2d8aa59980a14dff3487cd8045f6..9e46b53487fafdc1e9e95e765b9b490d9c95f2c6 100644 --- a/drivers/cpufreq/tegra124-cpufreq.c +++ b/drivers/cpufreq/tegra124-cpufreq.c @@ -211,5 +211,7 @@ static int __init tegra_cpufreq_init(void) } module_init(tegra_cpufreq_init); +MODULE_SOFTDEP("pre: cpufreq-dt"); MODULE_AUTHOR("Tuomas Tynkkynen <ttynkkynen@nvidia.com>"); MODULE_DESCRIPTION("cpufreq driver for NVIDIA Tegra124"); +MODULE_LICENSE("GPL");