devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: John Madieu <john.madieu.xa@bp.renesas.com>,
	"geert+renesas@glider.be" <geert+renesas@glider.be>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>
Cc: "magnus.damm@gmail.com" <magnus.damm@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"john.madieu@gmail.com" <john.madieu@gmail.com>,
	"rui.zhang@intel.com" <rui.zhang@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"lukasz.luba@arm.com" <lukasz.luba@arm.com>
Subject: Re: [External] : RE: Re : [PATCH v5 3/5] thermal: renesas: rzg3e: Add thermal driver for the Renesas RZ/G3E SoC
Date: Fri, 4 Apr 2025 18:36:02 +0530	[thread overview]
Message-ID: <13cc72b7-735a-472c-9d5a-9d2e403e69f6@oracle.com> (raw)
In-Reply-To: <OSBPR01MB2775B41C98F595C162E8924BFFAF2@OSBPR01MB2775.jpnprd01.prod.outlook.com>

Hi John,

On 03-04-2025 00:52, John Madieu wrote:
> Hi Alok,
> 
>> -----Original Message-----
>> From: ALOK TIWARI <alok.a.tiwari@oracle.com>
>> Sent: Tuesday, April 1, 2025 8:24 PM
>> To: John Madieu <john.madieu.xa@bp.renesas.com>; geert+renesas@glider.be;
>> conor+dt@kernel.org; krzk+dt@kernel.org; robh@kernel.org;
>> rafael@kernel.org; daniel.lezcano@linaro.org
>> Subject: Re : [PATCH v5 3/5] thermal: renesas: rzg3e: Add thermal driver
>> for the Renesas RZ/G3E SoC
>>
>> Hi John,
>>
>> Thanks for your reply.
>>
>> On 01-04-2025 17:35, John Madieu wrote:
>>> Hi Alok,
>>>
>>> Thanks for your feedback.
>>>
>>>> -----Original Message-----
>>>> From: ALOK TIWARI <alok.a.tiwari@oracle.com>
>>>> Sent: Monday, March 31, 2025 8:11 PM
>>>> To: John Madieu <john.madieu.xa@bp.renesas.com>;
>>>> geert+renesas@glider.be;
>>>> conor+dt@kernel.org; krzk+dt@kernel.org; robh@kernel.org;
>>>> rafael@kernel.org; daniel.lezcano@linaro.org
>>>> Subject: Re : [PATCH v5 3/5] thermal: renesas: rzg3e: Add thermal
>>>> driver for the Renesas RZ/G3E SoC
>>>>
>>>>
>>>>
>>>> On 31-03-2025 03:19, John Madieu wrote:
>>>>> The RZ/G3E SoC integrates a Temperature Sensor Unit (TSU) block
>>
>>>>> +static int rzg3e_thermal_change_mode(struct thermal_zone_device *tz,
>>>>> +				     enum thermal_device_mode mode) {
>>>>> +	struct rzg3e_thermal_priv *priv = thermal_zone_device_priv(tz);
>>>>> +
>>>>> +	if (mode == THERMAL_DEVICE_DISABLED)
>>>>> +		rzg3e_thermal_hw_disable(priv);
>>>>> +	else
>>>>> +		rzg3e_thermal_hw_enable(priv);
>>>>> +
>>>>> +	priv->mode = mode;
>>>>> +	return 0;
>>>>> +}
>>>>> +
>>>> always return 0 here ? what, if (!priv) return -EINVAL; ?
>>>
>>> priv cannot be NULL here, guaranteed from probe().
>>> Returning 0 here is expected by the thermal framework to notify ops
>>> success.
>>>
>>
>> I agreed. priv cannot be NULL.
>> It appears that return 0 is deliberate in this case. can we add Meaningful
>> comment which help to code readability.
>>
> 
> This is a standard tzd ops, which expects 0 to be returned
> for disabling/enabling success. This is how it's implemented
> in every Thermal driver I've gone through in the -next tree.
> 
>> not sure if user call ioctl(fd, THERMAL_IOC_SET_MODE, 2) and it returns
>> 0 with thermal enable.
>> that create possibility to thermal_core call thermal_notify_tz_disable if
>> any case
>>
> Am I missing something ?
> 

That's fine. it is not supporting ioctl.
usually thermal core driver do check if(mode == THERMAL_DEVICE_ENABLED) 
condition, else part is by-default.
as it is supporting only enable/disable case from 
/sys/class/thermal/thermal_zone0/mode. it does not create any issue.
LGTM.

>>>>> +static const struct thermal_zone_device_ops rzg3e_tz_ops = {
>>>>> +	.get_temp = rzg3e_thermal_get_temp,
>>>>> +	.set_trips = rzg3e_thermal_set_trips,
>>>>> +	.change_mode = rzg3e_thermal_change_mode, };
>>>> other renesas driver defined as rzg2l_tz_of_ops, can be used similar
>>>> one rzg3e_tz_of_ops for consistency!
>>>
>>> Thanks for pointing it out. Makes sense. Will double check and update
>>> accordingly.
>>>
>>>>> +
>>>>> +static int rzg3e_thermal_probe(struct platform_device *pdev) {
>>>>> +	struct device *dev = &pdev->dev;
>>>>> +	struct rzg3e_thermal_priv *priv;
>>>>> +	struct reset_control *rstc;
>>>>
> Regards,
> John


  reply	other threads:[~2025-04-04 13:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-30 21:49 [PATCH v5 0/5] thermal: renesas: Add support fot RZ/G3E John Madieu
2025-03-30 21:49 ` [PATCH v5 1/5] soc: renesas: rz-sysc: add syscon/regmap support John Madieu
2025-03-31  6:08   ` Biju Das
2025-04-02 20:58     ` John Madieu
2025-04-03  8:03   ` Claudiu Beznea
2025-04-03 13:22     ` John Madieu
2025-03-30 21:49 ` [PATCH v5 2/5] dt-bindings: thermal: r9a09g047-tsu: Document the TSU unit John Madieu
2025-03-30 21:49 ` [PATCH v5 3/5] thermal: renesas: rzg3e: Add thermal driver for the Renesas RZ/G3E SoC John Madieu
2025-03-31 18:10   ` Re : " ALOK TIWARI
2025-03-31 18:20     ` Biju Das
2025-04-01 12:05     ` John Madieu
2025-04-01 18:23       ` ALOK TIWARI
2025-04-02 19:22         ` John Madieu
2025-04-04 13:06           ` ALOK TIWARI [this message]
2025-04-04 13:06           ` ALOK TIWARI
2025-03-30 21:49 ` [PATCH v5 4/5] arm64: dts: renesas: r9a09g047: Add TSU node John Madieu
2025-03-30 21:49 ` [PATCH v5 5/5] arm64: defconfig: Enable the Renesas RZ/G3E thermal driver John Madieu

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=13cc72b7-735a-472c-9d5a-9d2e403e69f6@oracle.com \
    --to=alok.a.tiwari@oracle.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=john.madieu.xa@bp.renesas.com \
    --cc=john.madieu@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=magnus.damm@gmail.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sboyd@kernel.org \
    /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).