Skip to contentSkip to conversation

thermal: fix thermal_cooling_device_register() prototype

PATCH Applied Arnd Bergmann 3 participants 3 messages Jul 22, 2021 – Sep 9, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: fix thermal_cooling_device_register() prototype

From: Arnd Bergmann <[email protected]>

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")
---
 include/linux/thermal.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/thermal.h +3 -2
index d296f3b88fb9..8050d929a5b4 100644
@@ -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,
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw

Good job.

Quoted 17 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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,
| ~~~~~~^~~~

Quoted 5 lines

Change the dummy helper functions to have the same arguments as the normal version.

Fixes f991de53a8ab ("thermal: make device_register's type argument const")
Quoted 27 lines

---
include/linux/thermal.h | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/thermal.h +0 -0
index d296f3b88fb9..8050d929a5b4 100644
@@ -404,12 +404,13 @@ static inline void thermal_zone_device_unregister(
 	struct thermal_zone_device *tz)
 { }

static inline struct thermal_cooling_device *

include/linux/thermal.h +1 -1
-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,

include/linux/thermal.h +2 -1
-	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,

Signature · 1 line
2.29.2
#2 lore raw

[thermal: thermal/next] thermal/core: Fix thermal_cooling_device_register() prototype

In reply to Arnd Bergmann
The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     fb83610762dd5927212aa62a468dd3b756b57a88
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//fb83610762dd5927212aa62a468dd3b756b57a88
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Thu, 22 Jul 2021 11:06:44 +02:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Sat, 14 Aug 2021 15:40:26 +02:00

thermal/core: Fix thermal_cooling_device_register() prototype

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")
---
 include/linux/thermal.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/thermal.h +3 -2
index d296f3b..8050d92 100644
@@ -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,