Re: [RESEND PATCH v3 1/2] acpi: thermal: initialize tz_enabled to 1

From: Zhang Rui
Date: Tue Feb 27 2018 - 22:06:30 EST


On Tue, 2018-02-27 at 17:17 +0100, Rafael J. Wysocki wrote:
> On Mon, Feb 26, 2018 at 3:41 PM, Enric Balletbo i Serra
> <enric.balletbo@xxxxxxxxxxxxx> wrote:
> >
> > From: Sameer Nanda <snanda@xxxxxxxxxxxx>
> >
> > In the acpi_thermal_add path, acpi_thermal_get_info gets called
> > before
> > acpi_thermal_register_thermal_zone.ÂÂSince tz_enabled was getting
> > set to
> > 1 only in acpi_thermal_register_thermal_zone, acpi_thermal_get_info
> > ended up disabling thermal polling.
> >
> > Moved setting of tz_enabled to 1 into acpi_thermal_add itself.
> >
> > Signed-off-by: Sameer Nanda <snanda@xxxxxxxxxxxx>
> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@xxxxxxxxxxxxx
> > >
> > ---
> > That's another attempt to land these to patches that were sent long
> > time
> > ago but never got merged, although, apparently, there is no issue
> > with
> > it. Latest discussion about these here:
> >
> > Âhttps://www.mail-archive.com/linux-kernel@xxxxxxxxxxxxxxx/msg14360
> > 81.html
> I can apply this one, but the other one has to go in through the
> Rui's tree.
>
No, the patch set was queued in my tree and then dropped.

This is because, the second patch makes the assumption that the soc
thermal driver .get_mode() must reflect the real thermal zone status
upon the thermal zone registration, but this is not true after checking
some of the driver code.

To apply patch 2/2, extra effort, which checks and fixes all the
thermal drivers one by one, is needed. It would be nice if someone can
do this, or else I will work on this, but some time later.

thanks,
rui
> >
> > Changes in v3:
> > - [1/2] Make sure tz->tz_enabled is set properly before registering
> > the
> > Â zone (Zhang Rui)
> >
> > Changes in v2:
> > - [1/2] This patch is new from v1
> > Â (https://patchwork.kernel.org/patch/9804229/)
> >
> > Âdrivers/acpi/thermal.c | 3 +--
> > Â1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> > index 551b71a24b85..1d8f185e96c6 100644
> > --- a/drivers/acpi/thermal.c
> > +++ b/drivers/acpi/thermal.c
> > @@ -930,8 +930,6 @@ static int
> > acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
> > ÂÂÂÂÂÂÂÂif (ACPI_FAILURE(status))
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -ENODEV;
> >
> > -ÂÂÂÂÂÂÂtz->tz_enabled = 1;
> > -
> > ÂÂÂÂÂÂÂÂdev_info(&tz->device->dev, "registered as
> > thermal_zone%d\n",
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂtz->thermal_zone->id);
> > ÂÂÂÂÂÂÂÂreturn 0;
> > @@ -1088,6 +1086,7 @@ static int acpi_thermal_add(struct
> > acpi_device *device)
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -ENOMEM;
> >
> > ÂÂÂÂÂÂÂÂtz->device = device;
> > +ÂÂÂÂÂÂÂtz->tz_enabled = 1;
> > ÂÂÂÂÂÂÂÂstrcpy(tz->name, device->pnp.bus_id);
> > ÂÂÂÂÂÂÂÂstrcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
> > ÂÂÂÂÂÂÂÂstrcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
> > --
> > 2.16.1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-
> > acpi" in
> > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > More majordomo info atÂÂhttp://vger.kernel.org/majordomo-info.html