mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	kernel@pengutronix.de, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] thermal: core: constify params in thermal_zone_device_register
Date: Mon, 10 Jul 2023 21:21:51 +0200	[thread overview]
Message-ID: <fa3d706a-57e9-9ca6-9d7d-a7a2b62960e1@pengutronix.de> (raw)
In-Reply-To: <CAJZ5v0h6_jzOBxhmd2b8WL5nVOvZ03AD5fzdtc9ACXGiCKEmOw@mail.gmail.com>

Hello,

On 10.07.23 19:33, Rafael J. Wysocki wrote:
> On Sat, Jul 8, 2023 at 1:27 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>>
>> Since commit 3d439b1a2ad3 ("thermal/core: Alloc-copy-free the thermal zone
>> parameters structure"), thermal_zone_device_register() allocates a copy
>> of the tzp argument and callers need not explicitly manage its lifetime.
>>
>> This means the function no longer cares about the parameter being
>> mutable, so constify it.
>>
>> No functional change.
>>
>> Fixes: 3d439b1a2ad3 ("thermal/core: Alloc-copy-free the thermal zone parameters structure")
> 
> Why is this particular patch regarded as a fix?

That the prototype wasn't adjust in aforementioned commit is IMO an oversight,
so this commit fixes that. As the commit is already referenced in the commit
message body, I don't mind dropping the Fixes: line. Please let me know if
I should resend.

Cheers,
Ahmad

>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  drivers/thermal/thermal_core.c | 4 ++--
>>  include/linux/thermal.h        | 6 +++---
>>  2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
>> index 842f678c1c3e..cc2b5e81c620 100644
>> --- a/drivers/thermal/thermal_core.c
>> +++ b/drivers/thermal/thermal_core.c
>> @@ -1203,7 +1203,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp);
>>  struct thermal_zone_device *
>>  thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *trips, int num_trips, int mask,
>>                                         void *devdata, struct thermal_zone_device_ops *ops,
>> -                                       struct thermal_zone_params *tzp, int passive_delay,
>> +                                       const struct thermal_zone_params *tzp, int passive_delay,
>>                                         int polling_delay)
>>  {
>>         struct thermal_zone_device *tz;
>> @@ -1371,7 +1371,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips);
>>
>>  struct thermal_zone_device *thermal_zone_device_register(const char *type, int ntrips, int mask,
>>                                                          void *devdata, struct thermal_zone_device_ops *ops,
>> -                                                        struct thermal_zone_params *tzp, int passive_delay,
>> +                                                        const struct thermal_zone_params *tzp, int passive_delay,
>>                                                          int polling_delay)
>>  {
>>         return thermal_zone_device_register_with_trips(type, NULL, ntrips, mask,
>> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
>> index 87837094d549..dee66ade89a0 100644
>> --- a/include/linux/thermal.h
>> +++ b/include/linux/thermal.h
>> @@ -301,14 +301,14 @@ int thermal_acpi_critical_trip_temp(struct acpi_device *adev, int *ret_temp);
>>  #ifdef CONFIG_THERMAL
>>  struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
>>                 void *, struct thermal_zone_device_ops *,
>> -               struct thermal_zone_params *, int, int);
>> +               const struct thermal_zone_params *, int, int);
>>
>>  void thermal_zone_device_unregister(struct thermal_zone_device *);
>>
>>  struct thermal_zone_device *
>>  thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int, int,
>>                                         void *, struct thermal_zone_device_ops *,
>> -                                       struct thermal_zone_params *, int, int);
>> +                                       const struct thermal_zone_params *, int, int);
>>
>>  void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
>>  const char *thermal_zone_device_type(struct thermal_zone_device *tzd);
>> @@ -348,7 +348,7 @@ void thermal_zone_device_critical(struct thermal_zone_device *tz);
>>  static inline struct thermal_zone_device *thermal_zone_device_register(
>>         const char *type, int trips, int mask, void *devdata,
>>         struct thermal_zone_device_ops *ops,
>> -       struct thermal_zone_params *tzp,
>> +       const struct thermal_zone_params *tzp,
>>         int passive_delay, int polling_delay)
>>  { return ERR_PTR(-ENODEV); }
>>  static inline void thermal_zone_device_unregister(
>> --
>> 2.39.2
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


  reply	other threads:[~2023-07-10 19:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08 11:27 Ahmad Fatoum
2023-07-08 11:27 ` [PATCH 2/2] thermal: of: fix double-free on unregistration Ahmad Fatoum
2023-07-11 18:05   ` Rafael J. Wysocki
2023-07-13 12:52     ` Daniel Lezcano
2023-07-10 17:33 ` [PATCH 1/2] thermal: core: constify params in thermal_zone_device_register Rafael J. Wysocki
2023-07-10 19:21   ` Ahmad Fatoum [this message]
2023-07-13 12:55 ` Daniel Lezcano
2023-07-20 18:58   ` Rafael J. Wysocki

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=fa3d706a-57e9-9ca6-9d7d-a7a2b62960e1@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=kernel@pengutronix.de \
    --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®