Re: [PATCH 5/8] thermal:cpu cooling:tegra: Provide deferred probing for tegra driver

From: Thierry Reding
Date: Mon Nov 17 2014 - 08:18:16 EST


On Mon, Nov 17, 2014 at 01:51:42PM +0100, Lukasz Majewski wrote:
> Hi Thierry,
>
> > On Fri, Nov 14, 2014 at 12:24:37PM +0100, Lukasz Majewski wrote:
> > > Hi Mikko,
> > >
> > > > Tested-by: Mikko Perttunen <mikko.perttunen@xxxxxxxx>
> > >
> > > Thanks for testing.
> > >
> > > >
> > > > One potential issue I can see is that if the cpufreq driver fails
> > > > to probe then you'll never get the thermal driver either. For
> > > > example, Tegra124 currently has no cpufreq driver, so if
> > > > CONFIG_CPU_THERMAL was enabled, then the soctherm driver would
> > > > never be able to probe.
> > >
> > > Yes, this is a potential issue. However, this option in
> > > tegra_defconfig is by default disabled when thermal is enabled.
> >
> > Not everybody uses tegra_defconfig for their kernel builds. In fact
> > I'd imagine that the majority of kernels use a variant of
> > multi_v7_defconfig and therefore CPU_THERMAL might get enabled
> > irrespective of any Tegra support.
>
> I see your point.
>
> >
> > I think a better solution would be to add this check only when proper
> > support for CPU frequency based cooling is added. That is, when a call
> > to cpufreq_cooling_register() (or a variant thereof) is added.
>
> For the above reason the code is only compiled in when user enable
> CONFIG_CPU_THERMAL.

Like I said, CPU_THERMAL is a kernel-wide configuration option and not
tied to the specific SoC. Therefore if an SoC, say Exynos, gains full
support for cooling via cpufreq then somebody may decide to enable the
CPU_THERMAL option in multi_v7_defconfig. At that point every thermal
driver that you're patching in this way but for which no cpufreq driver
is registered will indefinitely defer probing.

So I see two options:

1) make sure that we defer probing only on devices where a cpufreq
driver is available
2) not rely on deferred probing at all but allow a cooling device to
be registered after the thermal driver has finished probing

1) seems impossible to do because cpufreq simply doesn't provide enough
infrastructure to deal with that situation.

Thierry

Attachment: pgpOmB29CM5Og.pgp
Description: PGP signature