LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] thermal: fix thermal_cooling_device_register() prototype
@ 2021-07-22 9:06 Arnd Bergmann
2021-07-26 14:00 ` Jean-François Dagenais
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-07-22 9:06 UTC (permalink / raw)
To: Zhang Rui, Daniel Lezcano, Matthias Brugger, Jean-Francois Dagenais
Cc: Arnd Bergmann, Amit Kucheria, Lukasz Luba, Thara Gopinath,
linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek
From: Arnd Bergmann <arnd@arndb.de>
There are two pairs of declarations for thermal_cooling_device_register()
and thermal_of_cooling_device_register(), and only one set was changed
in a recent patch, so the other one now causes a compile-time warning:
drivers/net/wireless/mediatek/mt76/mt7915/init.c: In function 'mt7915_thermal_init':
drivers/net/wireless/mediatek/mt76/mt7915/init.c:134:48: error: passing argument 1 of 'thermal_cooling_device_register' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
134 | cdev = thermal_cooling_device_register(wiphy_name(wiphy), phy,
| ^~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/mediatek/mt76/mt7915/init.c:7:
include/linux/thermal.h:407:39: note: expected 'char *' but argument is of type 'const char *'
407 | thermal_cooling_device_register(char *type, void *devdata,
| ~~~~~~^~~~
Change the dummy helper functions to have the same arguments as the
normal version.
Fixes: f991de53a8ab ("thermal: make device_register's type argument const")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/thermal.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index d296f3b88fb9..8050d929a5b4 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -404,12 +404,13 @@ static inline void thermal_zone_device_unregister(
struct thermal_zone_device *tz)
{ }
static inline struct thermal_cooling_device *
-thermal_cooling_device_register(char *type, void *devdata,
+thermal_cooling_device_register(const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{ return ERR_PTR(-ENODEV); }
static inline struct thermal_cooling_device *
thermal_of_cooling_device_register(struct device_node *np,
- char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
+ const char *type, void *devdata,
+ const struct thermal_cooling_device_ops *ops)
{ return ERR_PTR(-ENODEV); }
static inline struct thermal_cooling_device *
devm_thermal_of_cooling_device_register(struct device *dev,
--
2.29.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: fix thermal_cooling_device_register() prototype
2021-07-22 9:06 [PATCH] thermal: fix thermal_cooling_device_register() prototype Arnd Bergmann
@ 2021-07-26 14:00 ` Jean-François Dagenais
0 siblings, 0 replies; 2+ messages in thread
From: Jean-François Dagenais @ 2021-07-26 14:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Zhang Rui, Daniel Lezcano, Matthias Brugger, Arnd Bergmann,
Amit Kucheria, Lukasz Luba, Thara Gopinath, linux-pm,
linux-kernel, linux-arm-kernel, linux-mediatek
Good job.
> On Jul 22, 2021, at 05:06, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> There are two pairs of declarations for thermal_cooling_device_register()
> and thermal_of_cooling_device_register(), and only one set was changed
> in a recent patch, so the other one now causes a compile-time warning:
>
> drivers/net/wireless/mediatek/mt76/mt7915/init.c: In function 'mt7915_thermal_init':
> drivers/net/wireless/mediatek/mt76/mt7915/init.c:134:48: error: passing argument 1 of 'thermal_cooling_device_register' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> 134 | cdev = thermal_cooling_device_register(wiphy_name(wiphy), phy,
> | ^~~~~~~~~~~~~~~~~
> In file included from drivers/net/wireless/mediatek/mt76/mt7915/init.c:7:
> include/linux/thermal.h:407:39: note: expected 'char *' but argument is of type 'const char *'
> 407 | thermal_cooling_device_register(char *type, void *devdata,
> | ~~~~~~^~~~
>
> Change the dummy helper functions to have the same arguments as the
> normal version.
>
> Fixes: f991de53a8ab ("thermal: make device_register's type argument const")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
> ---
> include/linux/thermal.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index d296f3b88fb9..8050d929a5b4 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -404,12 +404,13 @@ static inline void thermal_zone_device_unregister(
> struct thermal_zone_device *tz)
> { }
> static inline struct thermal_cooling_device *
> -thermal_cooling_device_register(char *type, void *devdata,
> +thermal_cooling_device_register(const char *type, void *devdata,
> const struct thermal_cooling_device_ops *ops)
> { return ERR_PTR(-ENODEV); }
> static inline struct thermal_cooling_device *
> thermal_of_cooling_device_register(struct device_node *np,
> - char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
> + const char *type, void *devdata,
> + const struct thermal_cooling_device_ops *ops)
> { return ERR_PTR(-ENODEV); }
> static inline struct thermal_cooling_device *
> devm_thermal_of_cooling_device_register(struct device *dev,
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-26 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 9:06 [PATCH] thermal: fix thermal_cooling_device_register() prototype Arnd Bergmann
2021-07-26 14:00 ` Jean-François Dagenais
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).