diff mbox

[v3,1/2] acpi: thermal: initialize tz_enabled to 1

Message ID 20170703080040.13750-1-enric.balletbo@collabora.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Enric Balletbo i Serra July 3, 2017, 8 a.m. UTC
From: Sameer Nanda <snanda@chromium.org>

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@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
Changes since v2:
 - Zhang Rui: 
   - Make sure tz->tz_enabled is set properly before registering the zone.

Changes since v1:
 - This patch is new from v1 [1]

 [1] https://patchwork.kernel.org/patch/9804229/

 drivers/acpi/thermal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Rafael J. Wysocki July 3, 2017, 9:08 p.m. UTC | #1
On Mon, Jul 3, 2017 at 10:00 AM, Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
> From: Sameer Nanda <snanda@chromium.org>
>
> 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@chromium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> Changes since v2:
>  - Zhang Rui:
>    - Make sure tz->tz_enabled is set properly before registering the zone.
>
> Changes since v1:
>  - This patch is new from v1 [1]
>
>  [1] 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 1d0417b..cd0fe92 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);
> --

Rui,

Can I just apply this, or do I need to work for a thermal core update?
 In the latter case, can you take care of this one too, please?

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zhang Rui July 4, 2017, 1:43 a.m. UTC | #2
On Mon, 2017-07-03 at 23:08 +0200, Rafael J. Wysocki wrote:
> On Mon, Jul 3, 2017 at 10:00 AM, Enric Balletbo i Serra
> <enric.balletbo@collabora.com> wrote:
> > 
> > From: Sameer Nanda <snanda@chromium.org>
> > 
> > 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@chromium.org>
> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com
> > >
> > ---
> > Changes since v2:
> >  - Zhang Rui:
> >    - Make sure tz->tz_enabled is set properly before registering
> > the zone.
> > 
> > Changes since v1:
> >  - This patch is new from v1 [1]
> > 
> >  [1] 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 1d0417b..cd0fe92 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);
> > --
> Rui,
> 
> Can I just apply this, or do I need to work for a thermal core
> update?
>  In the latter case, can you take care of this one too, please?
> 
Yes, I will take both of the patches.

thanks,
rui

> Thanks,
> Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Enric Balletbo Serra Dec. 20, 2017, 11:27 a.m. UTC | #3
Hi Rui,

2017-07-04 3:43 GMT+02:00 Zhang Rui <rui.zhang@intel.com>:
> On Mon, 2017-07-03 at 23:08 +0200, Rafael J. Wysocki wrote:
>> On Mon, Jul 3, 2017 at 10:00 AM, Enric Balletbo i Serra
>> <enric.balletbo@collabora.com> wrote:
>> >
>> > From: Sameer Nanda <snanda@chromium.org>
>> >
>> > 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@chromium.org>
>> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com
>> > >
>> > ---
>> > Changes since v2:
>> >  - Zhang Rui:
>> >    - Make sure tz->tz_enabled is set properly before registering
>> > the zone.
>> >
>> > Changes since v1:
>> >  - This patch is new from v1 [1]
>> >
>> >  [1] 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 1d0417b..cd0fe92 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);
>> > --
>> Rui,
>>
>> Can I just apply this, or do I need to work for a thermal core
>> update?
>>  In the latter case, can you take care of this one too, please?
>>
> Yes, I will take both of the patches.
>

Long time since I posted these patches but didn't land, I'm not sure
if you're waiting an action from me. Are fine ? Do you want me to
rebase it on top of mainline and resend?

Thanks,
 Enric

> thanks,
> rui
>
>> Thanks,
>> Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 1d0417b..cd0fe92 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);