From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Icenowy Zheng <zhengxingda@iscas.ac.cn>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Mark Brown <broonie@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, Icenowy Zheng <uwu@icenowy.me>
Subject: Re: [PATCH RESEND RESEND] thermal/of: support thermal zones w/o trips subnode
Date: Wed, 16 Aug 2023 12:04:59 +0200 [thread overview]
Message-ID: <47417e4b-f230-7182-5cb5-c76b34b635c0@linaro.org> (raw)
In-Reply-To: <20230722122534.2279689-1-zhengxingda@iscas.ac.cn>
On 22/07/2023 14:25, Icenowy Zheng wrote:
> From: Icenowy Zheng <uwu@icenowy.me>
>
> Although the current device tree binding of thermal zones require the
> trips subnode, the binding in kernel v5.15 does not require it, and many
> device trees shipped with the kernel, for example,
> allwinner/sun50i-a64.dtsi and mediatek/mt8183-kukui.dtsi in ARM64, still
> comply to the old binding and contain no trips subnode.
>
> Allow the code to successfully register thermal zones w/o trips subnode
> for DT binding compatibility now.
>
> Furtherly, the inconsistency between DTs and bindings should be resolved
> by either adding empty trips subnode or dropping the trips subnode
> requirement.
>
> Fixes: d0c75fa2c17f ("thermal/of: Initialize trip points separately")
> Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> ---
>
> Unfortunately the code gets dropped by mailing lists again and again...
>
> Sorry for the disturbance.
>
> drivers/thermal/thermal_of.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 6fb14e521197..2c76df847e84 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -127,15 +127,17 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
>
> trips = of_get_child_by_name(np, "trips");
> if (!trips) {
> - pr_err("Failed to find 'trips' node\n");
> - return ERR_PTR(-EINVAL);
> + pr_debug("Failed to find 'trips' node\n");
> + *ntrips = 0;
set ntrips at the beginning of the function.
> + return NULL;
return ERR_PTR(-ENXIO);
> }
>
> count = of_get_child_count(trips);
> if (!count) {
> - pr_err("No trip point defined\n");
> - ret = -EINVAL;
> - goto out_of_node_put;
> + pr_debug("No trip point defined\n");
> + of_node_put(trips);
> + *ntrips = 0;
> + return NULL;
Why not keep goto out_of_node_put ?
> }
>
> tt = kzalloc(sizeof(*tt) * count, GFP_KERNEL);
> @@ -519,7 +521,10 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
The function should check the return value of thermal_of_trips_init()
If this one returns -ENXIO, it should pr_warn().
> of_ops->bind = thermal_of_bind;
> of_ops->unbind = thermal_of_unbind;
>
> - mask = GENMASK_ULL((ntrips) - 1, 0);
> + if (ntrips)
> + mask = GENMASK_ULL((ntrips) - 1, 0);
> + else
> + mask = 0;
mask = ntrips ? GENMASK_ULL((ntrips) - 1, 0) : 0;
> tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips,
> mask, data, of_ops, tzp,
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
prev parent reply other threads:[~2023-08-16 10:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 12:25 [PATCH RESEND RESEND] thermal/of: support thermal zones w/o trips subnode Icenowy Zheng
2023-07-22 20:11 ` Mark Brown
2023-07-23 10:12 ` Daniel Lezcano
2023-07-23 15:05 ` Mark Brown
2023-07-24 2:35 ` Icenowy Zheng
2023-07-24 4:25 ` Chen-Yu Tsai
2023-07-25 4:01 ` Icenowy Zheng
2023-08-01 14:10 ` Icenowy Zheng
2023-08-16 10:04 ` Daniel Lezcano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47417e4b-f230-7182-5cb5-c76b34b635c0@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=broonie@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=rui.zhang@intel.com \
--cc=uwu@icenowy.me \
--cc=zhengxingda@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).