[PATCH 2/2] thermal/of: Assume polling-delay(-passive) 0 when absent

Konrad Dybcio posted 2 patches 1 year, 11 months ago
[PATCH 2/2] thermal/of: Assume polling-delay(-passive) 0 when absent
Posted by Konrad Dybcio 1 year, 11 months ago
Currently, thermal zones associated with providers that have interrupts
for signaling hot/critical trips are required to set a polling-delay
of 0 to indicate no polling. This feels a bit backwards.

Change the code such that "no polling delay" also means "no polling".

Suggested-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/thermal/thermal_of.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 4d6c22e0ed85..61bbd42aa2cb 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -225,14 +225,18 @@ static int thermal_of_monitor_init(struct device_node *np, int *delay, int *pdel
 	int ret;
 
 	ret = of_property_read_u32(np, "polling-delay-passive", pdelay);
-	if (ret < 0) {
-		pr_err("%pOFn: missing polling-delay-passive property\n", np);
+	if (ret == -EINVAL) {
+		*pdelay = 0;
+	} else if (ret < 0) {
+		pr_err("%pOFn: Couldn't get polling-delay-passive: %d\n", np, ret);
 		return ret;
 	}
 
 	ret = of_property_read_u32(np, "polling-delay", delay);
-	if (ret < 0) {
-		pr_err("%pOFn: missing polling-delay property\n", np);
+	if (ret == -EINVAL) {
+		*delay = 0;
+	} else if (ret < 0) {
+		pr_err("%pOFn: Couldn't get polling-delay: %d\n", np, ret);
 		return ret;
 	}
 

-- 
2.40.1
Re: [PATCH 2/2] thermal/of: Assume polling-delay(-passive) 0 when absent
Posted by Dmitry Baryshkov 1 year, 9 months ago
On 25/01/2024 14:11, Konrad Dybcio wrote:
> Currently, thermal zones associated with providers that have interrupts
> for signaling hot/critical trips are required to set a polling-delay
> of 0 to indicate no polling. This feels a bit backwards.
> 
> Change the code such that "no polling delay" also means "no polling".
> 
> Suggested-by: Bjorn Andersson <andersson@kernel.org>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>   drivers/thermal/thermal_of.c | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry
Re: [PATCH 2/2] thermal/of: Assume polling-delay(-passive) 0 when absent
Posted by Bjorn Andersson 1 year, 10 months ago
On Thu, Jan 25, 2024 at 01:11:16PM +0100, Konrad Dybcio wrote:
> Currently, thermal zones associated with providers that have interrupts
> for signaling hot/critical trips are required to set a polling-delay
> of 0 to indicate no polling. This feels a bit backwards.
> 
> Change the code such that "no polling delay" also means "no polling".
> 
> Suggested-by: Bjorn Andersson <andersson@kernel.org>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Reviewed-by: Bjorn Andersson <andersson@kernel.org>

Regards,
Bjorn

> ---
>  drivers/thermal/thermal_of.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 4d6c22e0ed85..61bbd42aa2cb 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -225,14 +225,18 @@ static int thermal_of_monitor_init(struct device_node *np, int *delay, int *pdel
>  	int ret;
>  
>  	ret = of_property_read_u32(np, "polling-delay-passive", pdelay);
> -	if (ret < 0) {
> -		pr_err("%pOFn: missing polling-delay-passive property\n", np);
> +	if (ret == -EINVAL) {
> +		*pdelay = 0;
> +	} else if (ret < 0) {
> +		pr_err("%pOFn: Couldn't get polling-delay-passive: %d\n", np, ret);
>  		return ret;
>  	}
>  
>  	ret = of_property_read_u32(np, "polling-delay", delay);
> -	if (ret < 0) {
> -		pr_err("%pOFn: missing polling-delay property\n", np);
> +	if (ret == -EINVAL) {
> +		*delay = 0;
> +	} else if (ret < 0) {
> +		pr_err("%pOFn: Couldn't get polling-delay: %d\n", np, ret);
>  		return ret;
>  	}
>  
> 
> -- 
> 2.40.1
>