Re: [PATCH v1] thermal: core: Do not fail cdev registration because of invalid initial state

From: Rafael J. Wysocki
Date: Thu Jun 06 2024 - 11:52:52 EST


On Thu, Jun 6, 2024 at 5:46 PM Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> wrote:
>
> On 06/06/2024 17:15, Rafael J. Wysocki wrote:
>
> [ ... ]
>
> > OK, so arguably the driver could set the initial state of the cooling
> > device to 0. That may or may not be the right thing to do depending
> > on the thermal state of the system at the moment. Then it would need
> > to wait for the governor to pick up a more suitable state for it or
> > leave it at 0. This could address the particular case at hand.
> >
> > However, should the core fail the cooling device registration if it
> > gets an error from .get_cur_state() to start with? It didn't do that
> > before. Indeed, it didn't even call .get_cur_state() then in the
> > first place. Moreover, the current state of the cooling device is not
> > even needed to register it except for the initialization of the debug
> > code for that cooling device, so why fail the registration of it?
>
> Indeed, the simpler way would be to not register the debugfs if we can't
> get the initial cooling device state, with a message, so the driver
> responsible of that will appear and hopefully encourage someone to fix it.

OK, that can be done.