Devicetree
 help / color / mirror / Atom feed
* [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings
@ 2026-10-21 13:42 Daniel Lezcano
  2026-10-21 13:48 ` Rafael J. Wysocki (Intel)
  2026-10-21 14:30 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Lezcano @ 2026-10-21 13:42 UTC (permalink / raw)
  To: rafael, daniel.lezcano, robh, krzk+dt, conor+dt
  Cc: rui.zhang, lukasz.luba, linux-pm, devicetree, linux-kernel

THERMAL_NO_LIMIT is defined separately in the thermal core and the DT
bindings, using different expressions for the same no-limit sentinel.

Define it as 0xffffffff in the DT bindings header and include that
header from linux/thermal.h. Remove the duplicate kernel definition so
both interfaces use the same unsigned 32-bit value while preserving
the existing DT encoding.

Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
---
 include/dt-bindings/thermal/thermal.h | 2 +-
 include/linux/thermal.h               | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/dt-bindings/thermal/thermal.h b/include/dt-bindings/thermal/thermal.h
index bc7babb1a67c..018f75febb9f 100644
--- a/include/dt-bindings/thermal/thermal.h
+++ b/include/dt-bindings/thermal/thermal.h
@@ -10,7 +10,7 @@
 #define _DT_BINDINGS_THERMAL_THERMAL_H
 
 /* On cooling devices upper and lower limits */
-#define THERMAL_NO_LIMIT		(~0)
+#define THERMAL_NO_LIMIT		0xffffffff /* ~0U */
 
 #endif
 
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 083b4f533933..a6f635f0e1f8 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -17,12 +17,11 @@
 #include <linux/workqueue.h>
 #include <uapi/linux/thermal.h>
 
+#include <dt-bindings/thermal/thermal.h>
+
 /* invalid cooling state */
 #define THERMAL_CSTATE_INVALID -1UL
 
-/* No upper/lower limit requirement */
-#define THERMAL_NO_LIMIT	((u32)~0)
-
 /* Default weight of a bound cooling device */
 #define THERMAL_WEIGHT_DEFAULT 0
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings
  2026-10-21 13:42 [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings Daniel Lezcano
@ 2026-10-21 13:48 ` Rafael J. Wysocki (Intel)
  2026-10-21 14:47   ` Daniel Lezcano
  2026-10-21 14:30 ` Krzysztof Kozlowski
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-10-21 13:48 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: rafael, robh, krzk+dt, conor+dt, rui.zhang, lukasz.luba, linux-pm,
	devicetree, linux-kernel

On Wed, Oct 21, 2026 at 3:43 PM Daniel Lezcano
<daniel.lezcano@oss.qualcomm.com> wrote:
>
> THERMAL_NO_LIMIT is defined separately in the thermal core and the DT
> bindings, using different expressions for the same no-limit sentinel.
>
> Define it as 0xffffffff in the DT bindings header and include that
> header from linux/thermal.h. Remove the duplicate kernel definition so
> both interfaces use the same unsigned 32-bit value while preserving
> the existing DT encoding.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>

But THERMAL_NO_LIMIT is also used by the core on systems without DT,
so why is defining it in DT bindings not confusing?

> ---
>  include/dt-bindings/thermal/thermal.h | 2 +-
>  include/linux/thermal.h               | 5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/include/dt-bindings/thermal/thermal.h b/include/dt-bindings/thermal/thermal.h
> index bc7babb1a67c..018f75febb9f 100644
> --- a/include/dt-bindings/thermal/thermal.h
> +++ b/include/dt-bindings/thermal/thermal.h
> @@ -10,7 +10,7 @@
>  #define _DT_BINDINGS_THERMAL_THERMAL_H
>
>  /* On cooling devices upper and lower limits */
> -#define THERMAL_NO_LIMIT               (~0)
> +#define THERMAL_NO_LIMIT               0xffffffff /* ~0U */
>
>  #endif
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 083b4f533933..a6f635f0e1f8 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -17,12 +17,11 @@
>  #include <linux/workqueue.h>
>  #include <uapi/linux/thermal.h>
>
> +#include <dt-bindings/thermal/thermal.h>
> +
>  /* invalid cooling state */
>  #define THERMAL_CSTATE_INVALID -1UL
>
> -/* No upper/lower limit requirement */
> -#define THERMAL_NO_LIMIT       ((u32)~0)
> -
>  /* Default weight of a bound cooling device */
>  #define THERMAL_WEIGHT_DEFAULT 0
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings
  2026-10-21 13:42 [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings Daniel Lezcano
  2026-10-21 13:48 ` Rafael J. Wysocki (Intel)
@ 2026-10-21 14:30 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-10-21 14:30 UTC (permalink / raw)
  To: Daniel Lezcano, rafael, robh, krzk+dt, conor+dt
  Cc: rui.zhang, lukasz.luba, linux-pm, devicetree, linux-kernel

On 21/10/2026 15:42, Daniel Lezcano wrote:
> THERMAL_NO_LIMIT is defined separately in the thermal core and the DT
> bindings, using different expressions for the same no-limit sentinel.
> 
> Define it as 0xffffffff in the DT bindings header and include that
> header from linux/thermal.h. Remove the duplicate kernel definition so
> both interfaces use the same unsigned 32-bit value while preserving
> the existing DT encoding.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> ---
>  include/dt-bindings/thermal/thermal.h | 2 +-
>  include/linux/thermal.h               | 5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/include/dt-bindings/thermal/thermal.h b/include/dt-bindings/thermal/thermal.h
> index bc7babb1a67c..018f75febb9f 100644
> --- a/include/dt-bindings/thermal/thermal.h
> +++ b/include/dt-bindings/thermal/thermal.h
> @@ -10,7 +10,7 @@
>  #define _DT_BINDINGS_THERMAL_THERMAL_H
>  
>  /* On cooling devices upper and lower limits */
> -#define THERMAL_NO_LIMIT		(~0)
> +#define THERMAL_NO_LIMIT		0xffffffff /* ~0U */

This should be actually separate patch, as we expect usually of bindings.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings
  2026-10-21 13:48 ` Rafael J. Wysocki (Intel)
@ 2026-10-21 14:47   ` Daniel Lezcano
  2026-10-21 14:57     ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2026-10-21 14:47 UTC (permalink / raw)
  To: Rafael J. Wysocki (Intel)
  Cc: robh, krzk+dt, conor+dt, rui.zhang, lukasz.luba, linux-pm,
	devicetree, linux-kernel

On 10/21/26 15:48, Rafael J. Wysocki (Intel) wrote:
> On Wed, Oct 21, 2026 at 3:43 PM Daniel Lezcano
> <daniel.lezcano@oss.qualcomm.com> wrote:
>>
>> THERMAL_NO_LIMIT is defined separately in the thermal core and the DT
>> bindings, using different expressions for the same no-limit sentinel.
>>
>> Define it as 0xffffffff in the DT bindings header and include that
>> header from linux/thermal.h. Remove the duplicate kernel definition so
>> both interfaces use the same unsigned 32-bit value while preserving
>> the existing DT encoding.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> 
> But THERMAL_NO_LIMIT is also used by the core on systems without DT,
> so why is defining it in DT bindings not confusing?

Yes, you are right. I missed ACPI relies on the THERMAL_NO_LIMIT default 
for the cooling spec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings
  2026-10-21 14:47   ` Daniel Lezcano
@ 2026-10-21 14:57     ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-10-21 14:57 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Rafael J. Wysocki (Intel), robh, krzk+dt, conor+dt, rui.zhang,
	lukasz.luba, linux-pm, devicetree, linux-kernel

On Wed, Oct 21, 2026 at 4:47 PM Daniel Lezcano
<daniel.lezcano@oss.qualcomm.com> wrote:
>
> On 10/21/26 15:48, Rafael J. Wysocki (Intel) wrote:
> > On Wed, Oct 21, 2026 at 3:43 PM Daniel Lezcano
> > <daniel.lezcano@oss.qualcomm.com> wrote:
> >>
> >> THERMAL_NO_LIMIT is defined separately in the thermal core and the DT
> >> bindings, using different expressions for the same no-limit sentinel.
> >>
> >> Define it as 0xffffffff in the DT bindings header and include that
> >> header from linux/thermal.h. Remove the duplicate kernel definition so
> >> both interfaces use the same unsigned 32-bit value while preserving
> >> the existing DT encoding.
> >>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> >
> > But THERMAL_NO_LIMIT is also used by the core on systems without DT,
> > so why is defining it in DT bindings not confusing?
>
> Yes, you are right. I missed ACPI relies on the THERMAL_NO_LIMIT default
> for the cooling spec

Well, in principle not just ACPI, but anyone whose .should_bind()
leaves the struct cooling_spec as is.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-21 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 13:42 [PATCH] thermal: Share THERMAL_NO_LIMIT between kernel and DT bindings Daniel Lezcano
2026-10-21 13:48 ` Rafael J. Wysocki (Intel)
2026-10-21 14:47   ` Daniel Lezcano
2026-10-21 14:57     ` Rafael J. Wysocki (Intel)
2026-10-21 14:30 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox