mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com,
	rafael@kernel.org, dietmar.eggemann@arm.com
Subject: Re: [PATCH 1/3] thermal: cpufreq_cooling: Use a copy of local ops for each cooling device
Date: Mon, 13 Jun 2022 12:23:25 +0100	[thread overview]
Message-ID: <675ccf44-872d-904c-af6c-672c8afd405e@arm.com> (raw)
In-Reply-To: <20220613105311.jdyjubid4jrgofwu@vireshk-i7>



On 6/13/22 11:53, Viresh Kumar wrote:
> On 13-06-22, 11:37, Lukasz Luba wrote:
>> Hi Viresh,
>>
>> Thank you for the ACKs in the other patches and suggestion in this one.
>>
>> On 6/13/22 10:16, Viresh Kumar wrote:
>>> On 10-06-22, 11:03, Lukasz Luba wrote:
>>>> It is very unlikely that one CPU cluster would have the EM and some other
>>>> won't have it (because EM registration failed or DT lacks needed entry).
>>>> Although, we should avoid modifying global variable with callbacks anyway.
>>>> Redesign this and add safety for such situation.
>>>>
>>>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>>>> ---
>>>>    drivers/thermal/cpufreq_cooling.c | 16 +++++++++++++---
>>>>    1 file changed, 13 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
>>>> index b8151d95a806..e33183785fac 100644
>>>> --- a/drivers/thermal/cpufreq_cooling.c
>>>> +++ b/drivers/thermal/cpufreq_cooling.c
>>>> @@ -554,7 +554,12 @@ __cpufreq_cooling_register(struct device_node *np,
>>>>    	/* max_level is an index, not a counter */
>>>>    	cpufreq_cdev->max_level = i - 1;
>>>> -	cooling_ops = &cpufreq_cooling_ops;
>>>> +	cooling_ops = kmemdup(&cpufreq_cooling_ops, sizeof(*cooling_ops),
>>>> +			      GFP_KERNEL);
>>>
>>> I don't like the way we are duplicating the ops here. Instead of this it would
>>> be better to add the OPs field in the cooling device structure and fill its
>>> fields from here. The ops structure will be allocated with the cooling device
>>> itself.
>>>
>>
>> I think I know what you mean. Make sense. There are quite a few
>> different cooling types of devices which are using the API
>> thermal_of_cooling_device_register() with the custom 'ops'. We
>> probably don't want to disturb that well working drivers and ecosystem.
> 
> I was just suggesting to update "struct cpufreq_cooling_device" :)
> 
> This is what I was, wrongly, referring to as cooling device.
> 
> I should have written the exact structure name instead, my bad.
> 

No worries. Thanks, I'll send a v2 with these changes.

      reply	other threads:[~2022-06-13 13:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10 10:03 Lukasz Luba
2022-06-10 10:03 ` [PATCH 2/3] thermal: cpufreq_cooling : Refactor thermal_power_cpu_get_power Lukasz Luba
2022-06-13  9:41   ` Viresh Kumar
2022-06-10 10:03 ` [PATCH 3/3] thermal: cpufreq_cooling: Update outdated comments Lukasz Luba
2022-06-13  9:42   ` Viresh Kumar
2022-06-13  9:16 ` [PATCH 1/3] thermal: cpufreq_cooling: Use a copy of local ops for each cooling device Viresh Kumar
2022-06-13 10:37   ` Lukasz Luba
2022-06-13 10:53     ` Viresh Kumar
2022-06-13 11:23       ` Lukasz Luba [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=675ccf44-872d-904c-af6c-672c8afd405e@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=viresh.kumar@linaro.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

all inboxes | Powered by JetHome®