Re: [PATCH v4 2/2] cpufreq: tegra124: Allow building as a module

Viresh Kumar
2025-05-19T10:26:32Z

On 14-05-25, 11:31, Jon Hunter wrote:
> > +static void tegra124_cpufreq_remove(struct platform_device *pdev)
> > +{
> > + struct tegra124_cpufreq_priv *priv = dev_get_drvdata(&pdev->dev);
> > +
> > + if (!IS_ERR(priv->cpufreq_dt_pdev)) {
> > + platform_device_unregister(priv->cpufreq_dt_pdev);
> > + priv->cpufreq_dt_pdev = ERR_PTR(-ENODEV);
> > + }
> > +
> > + clk_put(priv->pllp_clk);
> > + clk_put(priv->pllx_clk);
> > + clk_put(priv->dfll_clk);
> > + clk_put(priv->cpu_clk);
>
>
> If we use devm_clk_get() in probe, then we should be able to avoid this.

Not sure if we can do that. The clks belong to the CPU device, while
the devm_* functions are using &pdev->dev. The CPU device never goes
away and so the resources won't get freed if we use devm for the CPU
device.

--
viresh