From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Zhang, Rui" <rui.zhang@intel.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"amitk@kernel.org" <amitk@kernel.org>
Subject: Re: [PATCH 3/5] thermal/core: Remove unneeded mutex_destroy()
Date: Thu, 19 Jan 2023 17:39:29 +0100 [thread overview]
Message-ID: <54674d67-7be3-0abc-4252-e7f4158f56f2@linaro.org> (raw)
In-Reply-To: <CAJZ5v0icp3nH+3-timEh2o8kxXpe4O2uMdJ8pSwe8fmY_OW4zA@mail.gmail.com>
On 19/01/2023 16:05, Rafael J. Wysocki wrote:
> On Thu, Jan 19, 2023 at 3:13 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> On 19/01/2023 14:24, Rafael J. Wysocki wrote:
>>> On Thu, Jan 19, 2023 at 1:48 PM Daniel Lezcano
>>> <daniel.lezcano@linaro.org> wrote:
>>>>
>>>> On 19/01/2023 13:11, Rafael J. Wysocki wrote:
>>>>> On Thu, Jan 19, 2023 at 10:30 AM Daniel Lezcano
>>>>> <daniel.lezcano@linaro.org> wrote:
>>>>>>
>>>>>> On 19/01/2023 08:41, Zhang, Rui wrote:
>>>>>>> On Wed, 2023-01-18 at 22:11 +0100, Daniel Lezcano wrote:
>>>>>>>> If the thermal framework fails to initialize, the mutex can be used
>>>>>>>> by
>>>>>>>> the different functions registering a thermal zone anyway.
>>>>>>>
>>>>>>> Hmm, even with no governors and unregistered thermal sysfs class?
>>>>>>>
>>>>>>> IMO, thermal APIs for registering a thermal_zone/cooling_device should
>>>>>>> yield early if thermal_init fails.
>>>>>>> For other APIs that relies on a valid
>>>>>>> thermal_zone_device/thermal_cooling_device pointer, nothing needs to
>>>>>>> be changed.
>>>>>>>
>>>>>>> what do you think?
>>>>>>
>>>>>> I think you are right.
>>>>>>
>>>>>> It would be nice if we can check if the thermal class is registered and
>>>>>> bail out if not. But there is no function to check that AFAICS.
>>>>>>
>>>>>> Alternatively we can convert the thermal class static structure to a
>>>>>> pointer and set it to NULL in case of error in thermal_init() ?
>>>>>
>>>>> It doesn't matter if this is a NULL pointer or a static object that's
>>>>> clearly marked as unused.
>>>>
>>>> Without introducing another global variable, is it possible to know if
>>>> the class is used or not ?
>>>
>>> If thermal_class.p is cleared to NULL on class_register() failures in
>>> thermal_init() (unfortunately, the driver core doesn't do that, but
>>> maybe it should - let me cut a patch for that), then it can be used
>>> for that.
>>
>> It should be in class_unregister() too, right ?
>>
>> And is it possible to add a class_is_registered() ? in order to prevent
>> accessing class structure internals ?
>
> I suppose so.
>
> And we'd like it to be used some places like
> thermal_zone_device_register_with_trips(), wouldn't we?
Yes, in thermal_zone_device_register_with_trips() and
thermal_cooling_device_register().
--
<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
next prev parent reply other threads:[~2023-01-19 16:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 21:11 [PATCH 1/5] thermal/core: Fix unregistering netlink at thermal init time Daniel Lezcano
2023-01-18 21:11 ` [PATCH 2/5] thermal/core: Remove unneeded ida_destroy() Daniel Lezcano
2023-01-18 21:11 ` [PATCH 3/5] thermal/core: Remove unneeded mutex_destroy() Daniel Lezcano
2023-01-19 7:41 ` Zhang, Rui
2023-01-19 9:30 ` Daniel Lezcano
2023-01-19 12:11 ` Rafael J. Wysocki
2023-01-19 12:48 ` Daniel Lezcano
2023-01-19 13:24 ` Rafael J. Wysocki
2023-01-19 14:13 ` Daniel Lezcano
2023-01-19 15:05 ` Rafael J. Wysocki
2023-01-19 16:39 ` Daniel Lezcano [this message]
2023-01-19 17:21 ` Rafael J. Wysocki
2023-01-20 14:09 ` Zhang, Rui
2023-01-20 14:13 ` Rafael J. Wysocki
2023-01-18 21:11 ` [PATCH 4/5] thermal/core: Move the thermal trip code to a dedicated file Daniel Lezcano
2023-01-19 2:39 ` kernel test robot
2023-01-19 7:24 ` Zhang, Rui
2023-01-18 21:11 ` [PATCH 5/5] thermal/core: Sort the trip points when registering a thermal zone Daniel Lezcano
2023-01-19 7:22 ` Zhang, Rui
2023-01-19 10:25 ` Daniel Lezcano
2023-01-19 16:50 ` Zhang, Rui
2023-01-19 13:28 ` [PATCH 1/5] thermal/core: Fix unregistering netlink at thermal init time Rafael J. Wysocki
2023-01-19 13:40 ` Daniel Lezcano
2023-01-19 13:45 ` Rafael J. Wysocki
2023-01-19 14:07 ` Daniel Lezcano
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=54674d67-7be3-0abc-4252-e7f4158f56f2@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.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
all inboxes | Powered by JetHome®