From: Guenter Roeck <linux@roeck-us.net>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
netdev@vger.kernel.org, linux-wireless@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-renesas-soc@vger.kernel.org,
linux-rockchip@lists.infradead.org,
"Emmanuel Grumbach" <emmanuel.grumbach@intel.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
"Vishal Kulkarni" <vishal@chelsio.com>,
"Luca Coelho" <luciano.coelho@intel.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
kernel@collabora.com, "Fabio Estevam" <festevam@gmail.com>,
"Amit Kucheria" <amit.kucheria@verdurent.com>,
"Chunyan Zhang" <zhang.lyra@gmail.com>,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Allison Randal" <allison@lohutok.net>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Darren Hart" <dvhart@infradead.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Gayatri Kammela" <gayatri.kammela@intel.com>,
"Len Brown" <lenb@kernel.org>,
"Johannes Berg" <johannes.berg@intel.com>,
"Intel Linux Wireless" <linuxwifi@intel.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Ido Schimmel" <idosch@mellanox.com>,
"Baolin Wang" <baolin.wang7@gmail.com>,
"Jiri Pirko" <jiri@mellanox.com>,
"Orson Zhai" <orsonzhai@gmail.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Kalle Valo" <kvalo@codeaurora.org>,
"Support Opensource" <support.opensource@diasemi.com>,
"Enrico Weigelt" <info@metux.net>,
"Peter Kaestle" <peter@piie.net>,
"Sebastian Reichel" <sre@kernel.org>,
"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Shawn Guo" <shawnguo@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
"Andy Shevchenko" <andy@infradead.org>
Subject: Re: [PATCH v4 04/11] thermal: Store device mode in struct thermal_zone_device
Date: Fri, 29 May 2020 12:08:46 -0700 [thread overview]
Message-ID: <3776b295-eb43-ce3c-0d9a-c923a3bd5ffd@roeck-us.net> (raw)
In-Reply-To: <a0c0310f-9870-47be-4ca3-c07e41c380fc@collabora.com>
On 5/29/20 10:21 AM, Andrzej Pietrasiewicz wrote:
> Hi again,
>
> W dniu 29.05.2020 o 18:08, Andrzej Pietrasiewicz pisze:
>> Hi Guenter,
>>
>> W dniu 29.05.2020 o 17:42, Guenter Roeck pisze:
>>> On Thu, May 28, 2020 at 09:20:44PM +0200, Andrzej Pietrasiewicz wrote:
>>>> Prepare for eliminating get_mode().
>>>>
>>> Might be worthwhile to explain (not only in the subject) what you are
>>> doing here.
>>>
>>>> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
>>>> ---
>>>> drivers/acpi/thermal.c | 18 ++++++----------
>>>> .../ethernet/mellanox/mlxsw/core_thermal.c | 21 +++++++------------
>>>> drivers/platform/x86/acerhdf.c | 15 ++++++-------
>>>> drivers/thermal/da9062-thermal.c | 6 ++----
>>>> drivers/thermal/imx_thermal.c | 17 +++++++--------
>>>> .../intel/int340x_thermal/int3400_thermal.c | 12 +++--------
>>>> .../thermal/intel/intel_quark_dts_thermal.c | 16 +++++++-------
>>>> drivers/thermal/thermal_of.c | 10 +++------
>>>
>>> After this patch is applied on top of the thermal 'testing' branch,
>>> there are still local instances of thermal_device_mode in
>>> drivers/thermal/st/stm_thermal.c
>>> drivers/thermal/ti-soc-thermal/ti-thermal-common.c
>>>
>>> If there is a reason not to replace those, it might make sense to explain
>>> it here.
>>>
>>
>> My understanding is that these two are sensor devices which are "plugged"
>> into their "parent" thermal zone device. The latter is the "proper" tzd.
>> They both use thermal_zone_of_device_ops instead of thermal_zone_device_ops.
>> The former doesn't even have get_mode(). The thermal core, when it calls
>> get_mode(), operates on the "parent" thermal zone devices.
>>
>> Consequently, the drivers you mention use their "mode" members for
>> their private purpose, not for the purpose of storing the "parent"
>> thermal zone device mode.
>>
>
> Let me also say it differently.
>
> Both drivers which you mention use devm_thermal_zone_of_sensor_register().
> It calls thermal_zone_of_sensor_register(), which "will search the list of
> thermal zones described in device tree and look for the zone that refer to
> the sensor device pointed by @dev->of_node as temperature providers. For
> the zone pointing to the sensor node, the sensor will be added to the DT
> thermal zone device." When a match is found thermal_zone_of_add_sensor()
> is invoked, which (using thermal_zone_get_zone_by_name()) iterates over
> all registered thermal_zone_devices. The one eventually found will be
> returned and propagated to the original caller of
> devm_thermal_zone_of_sensor_register(). The state of this returned
> device is managed elsewhere (in that device's struct tzd). The "mode"
> member you are referring to is thus unrelated.
>
Quite confusing, especially since the ti-soc driver doesn't seem to use
the variable at all after setting it, and the stm_thermal driver uses it
to reflect power status associated with suspend/resume. So, yes, I agree
this is fine.
Thanks,
Guenter
> Regards,
>
> Andrzej
next prev parent reply other threads:[~2020-05-29 19:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-29 15:42 [PATCH v4 04/11] thermal: Store device mode in struct thermal_zone_device Guenter Roeck
2020-05-29 16:08 ` Andrzej Pietrasiewicz
2020-05-29 17:21 ` Andrzej Pietrasiewicz
2020-05-29 19:08 ` Guenter Roeck [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-06-02 15:00 Guenter Roeck
2020-05-29 19:09 Guenter Roeck
[not found] <Message-ID: <4493c0e4-51aa-3907-810c-74949ff27ca4@samsung.com>
2020-05-28 19:20 ` [PATCH v4 00/11] Stop monitoring disabled devices Andrzej Pietrasiewicz
2020-05-28 19:20 ` [PATCH v4 04/11] thermal: Store device mode in struct thermal_zone_device Andrzej Pietrasiewicz
2020-06-24 9:40 ` Bartlomiej Zolnierkiewicz
2020-06-01 11:36 ` Peter Kästle
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=3776b295-eb43-ce3c-0d9a-c923a3bd5ffd@roeck-us.net \
--to=linux@roeck-us.net \
--cc=allison@lohutok.net \
--cc=amit.kucheria@verdurent.com \
--cc=andrzej.p@collabora.com \
--cc=andy@infradead.org \
--cc=b.zolnierkie@samsung.com \
--cc=baolin.wang7@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=davem@davemloft.net \
--cc=dvhart@infradead.org \
--cc=emmanuel.grumbach@intel.com \
--cc=festevam@gmail.com \
--cc=gayatri.kammela@intel.com \
--cc=heiko@sntech.de \
--cc=idosch@mellanox.com \
--cc=info@metux.net \
--cc=jiri@mellanox.com \
--cc=johannes.berg@intel.com \
--cc=kernel@collabora.com \
--cc=kernel@pengutronix.de \
--cc=kvalo@codeaurora.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linuxwifi@intel.com \
--cc=luciano.coelho@intel.com \
--cc=miquel.raynal@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=orsonzhai@gmail.com \
--cc=peter@piie.net \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=sre@kernel.org \
--cc=support.opensource@diasemi.com \
--cc=tglx@linutronix.de \
--cc=vishal@chelsio.com \
--cc=zhang.lyra@gmail.com \
/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).