Re: [PATCH V4 8/8] cpufreq: Add Rust based cpufreq-dt driver

From: Danilo Krummrich
Date: Tue Jul 16 2024 - 11:15:44 EST


On Thu, Jul 11, 2024 at 06:34:22PM +0200, Greg KH wrote:
> On Thu, Jul 11, 2024 at 06:12:08PM +0200, Danilo Krummrich wrote:
> > On Thu, Jul 11, 2024 at 04:37:50PM +0200, Greg KH wrote:
> > > On Thu, Jul 11, 2024 at 03:21:31PM +0200, Danilo Krummrich wrote:
> > > > (2) You require drivers to always implement a "dummy" struct platform_device,
> > > > there is platform_device_register_simple() for that purpose.
> > >
> > > No, NEVER do that. platform devices are only for real platform devices,
> > > do not abuse that interface any more than it already is.
> >
> > I thought we're talking about cases like [1] or [2], but please correct me if
> > those are considered abusing the platform bus as well.
> >
> > (Those drivers read the CPU OF nodes, instead of OF nodes that represent a
> > separate device.)
> >
> > [1] https://elixir.bootlin.com/linux/latest/source/drivers/cpuidle/cpuidle-riscv-sbi.c#L586
> > [2] https://elixir.bootlin.com/linux/latest/source/drivers/cpuidle/cpuidle-psci.c#L441
>
> Yes, these are abuses of that and should be virtual devices as they have
> nothing to do with the platform bus.

For those drivers, wouldn't it be better if proper devices would be derived from
the CPU OF nodes directly? This seems to be a common problem for cpuidle and
cpufreq drivers.

But it's quite a while ago I dealt with such drivers, maybe there are reasons
not to do so.

Anyway, using a virtual device for those seems a bit wrong to me.

- Danilo