thermal/of: Move OF code where it belongs to
Daniel Lezcano
maintainerPATCH 1/1 thermal/of: Move OF code where it belongs to
From: Daniel Lezcano <[email protected]>
The functions:
- thermal_of_cooling_device_register()
- devm_thermal_of_cooling_device_register()
are related to thermal-of but they are implemented in thermal-core. Move these functions to the right file.
Pure move patch.
No functional change intended.
--- drivers/thermal/thermal_core.c | 75 +--------------------------------- drivers/thermal/thermal_core.h | 5 +++ drivers/thermal/thermal_of.c | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 74 deletions(-)
drivers/thermal/thermal_core.c +1 -74
@@ -1054,7 +1054,7 @@ static void thermal_cooling_device_init_complete(struct thermal_cooling_device ** Return: a pointer to the created struct thermal_cooling_device or an * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ -static struct thermal_cooling_device * +struct thermal_cooling_device *__thermal_cooling_device_register (struct device_node *np,const char *type,void *devdata,const struct thermal_cooling_device_ops *ops)
@@ -1162,79 +1162,6 @@ thermal_cooling_device_register(const char *type, void *devdata, }EXPORT_SYMBOL_GPL (thermal_cooling_device_register); -/** -* thermal_of_cooling_device_register() - register an OF thermal cooling device -* @np: a pointer to a device tree node. -* @type: the thermal cooling device type. -* @devdata: device private data. -* @ops: standard thermal cooling devices callbacks. -* -* This function will register a cooling device with device tree node reference. -* This interface function adds a new thermal cooling device (fan/processor/...) -* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself -* to all the thermal zone devices registered at the same time. -* -* Return: a pointer to the created struct thermal_cooling_device or an -* ERR_PTR. Caller must check return value with IS_ERR*() helpers. -*/ -struct thermal_cooling_device * -thermal_of_cooling_device_register (struct device_node *np, -const char *type,void *devdata, -const struct thermal_cooling_device_ops *ops) -{ -return __thermal_cooling_device_register (np, type, devdata, ops); -} -EXPORT_SYMBOL_GPL (thermal_of_cooling_device_register); - -static void thermal_cooling_device_release (struct device *dev,void *res) -{ -thermal_cooling_device_unregister ( - *(struct thermal_cooling_device **)res); -} - -/** -* devm_thermal_of_cooling_device_register() - register an OF thermal cooling -* device -* @dev: a valid struct device pointer of a sensor device. -* @np: a pointer to a device tree node. -* @type: the thermal cooling device type. -* @devdata: device private data. -* @ops: standard thermal cooling devices callbacks. -* -* This function will register a cooling device with device tree node reference. -* This interface function adds a new thermal cooling device (fan/processor/...) -* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself -* to all the thermal zone devices registered at the same time. -* -* Return: a pointer to the created struct thermal_cooling_device or an -* ERR_PTR. Caller must check return value with IS_ERR*() helpers. -*/ -struct thermal_cooling_device * -devm_thermal_of_cooling_device_register (struct device *dev, -struct device_node *np, -const char *type,void *devdata, -const struct thermal_cooling_device_ops *ops) -{ -struct thermal_cooling_device **ptr, *tcd; - - ptr =devres_alloc (thermal_cooling_device_release,sizeof (*ptr), -GFP_KERNEL ); -if (!ptr) -return ERR_PTR (-ENOMEM ); - - tcd =__thermal_cooling_device_register (np, type, devdata, ops); -if (IS_ERR (tcd)) { -devres_free (ptr); -return tcd; - } - - *ptr = tcd; -devres_add (dev, ptr); - -return tcd; -} -EXPORT_SYMBOL_GPL (devm_thermal_of_cooling_device_register); -static bool thermal_cooling_device_present (struct thermal_cooling_device *cdev) {struct thermal_cooling_device *pos =NULL ;
drivers/thermal/thermal_core.h +5 -0
@@ -269,6 +269,11 @@ void thermal_zone_device_critical_shutdown(struct thermal_zone_device *tz);void thermal_governor_update_tz (struct thermal_zone_device *tz,enum thermal_notify_event reason); +struct thermal_cooling_device * +__thermal_cooling_device_register (struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops); +/* Helpers */ #define for_each_trip_desc (__tz, __td) \ for (__td = __tz->trips; __td - __tz->trips < __tz->num_trips; __td++)
drivers/thermal/thermal_of.c +72 -0
75 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 202 lines · Daniel Lezcano
From: Daniel Lezcano <[email protected]>
The functions:
-thermal_of_cooling_device_register()
-devm_thermal_of_cooling_device_register()are related to thermal-of but they are implemented in thermal-core. Move these functions to the right file.
Pure move patch.
No functional change intended.
Signed-off-by Daniel Lezcano <[email protected]>Signed-off-by Daniel Lezcano <[email protected]>--- drivers/thermal/thermal_core.c | 75 +--------------------------------- drivers/thermal/thermal_core.h | 5 +++ drivers/thermal/thermal_of.c | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 74 deletions(-)drivers/thermal/thermal_core.c +1
-74@@ -1054,7 +1054,7 @@ static void thermal_cooling_device_init_complete(struct thermal_cooling_device ** Return: a pointer to the created struct thermal_cooling_device or an * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ -static struct thermal_cooling_device * +struct thermal_cooling_device *__thermal_cooling_device_register (struct device_node *np,const char *type,void *devdata,const struct thermal_cooling_device_ops *ops)@@ -1162,79 +1162,6 @@ thermal_cooling_device_register(const char *type, void *devdata, }EXPORT_SYMBOL_GPL (thermal_cooling_device_register); -/** -* thermal_of_cooling_device_register() - register an OF thermal cooling device -* @np: a pointer to a device tree node. -* @type: the thermal cooling device type. -* @devdata: device private data. -* @ops: standard thermal cooling devices callbacks. -* -* This function will register a cooling device with device tree node reference. -* This interface function adds a new thermal cooling device (fan/processor/...) -* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself -* to all the thermal zone devices registered at the same time. -* -* Return: a pointer to the created struct thermal_cooling_device or an -* ERR_PTR. Caller must check return value with IS_ERR*() helpers. -*/ -struct thermal_cooling_device * -thermal_of_cooling_device_register (struct device_node *np, -const char *type,void *devdata, -const struct thermal_cooling_device_ops *ops) -{ -return __thermal_cooling_device_register (np, type, devdata, ops); -} -EXPORT_SYMBOL_GPL (thermal_of_cooling_device_register); - -static void thermal_cooling_device_release (struct device *dev,void *res) -{ -thermal_cooling_device_unregister ( - *(struct thermal_cooling_device **)res); -} - -/** -* devm_thermal_of_cooling_device_register() - register an OF thermal cooling -* device -* @dev: a valid struct device pointer of a sensor device. -* @np: a pointer to a device tree node. -* @type: the thermal cooling device type. -* @devdata: device private data. -* @ops: standard thermal cooling devices callbacks. -* -* This function will register a cooling device with device tree node reference. -* This interface function adds a new thermal cooling device (fan/processor/...) -* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself -* to all the thermal zone devices registered at the same time. -* -* Return: a pointer to the created struct thermal_cooling_device or an -* ERR_PTR. Caller must check return value with IS_ERR*() helpers. -*/ -struct thermal_cooling_device * -devm_thermal_of_cooling_device_register (struct device *dev, -struct device_node *np, -const char *type,void *devdata, -const struct thermal_cooling_device_ops *ops) -{ -struct thermal_cooling_device **ptr, *tcd; - - ptr =devres_alloc (thermal_cooling_device_release,sizeof (*ptr), -GFP_KERNEL ); -if (!ptr) -return ERR_PTR (-ENOMEM ); - - tcd =__thermal_cooling_device_register (np, type, devdata, ops); -if (IS_ERR (tcd)) { -devres_free (ptr); -return tcd; - } - - *ptr = tcd; -devres_add (dev, ptr); - -return tcd; -} -EXPORT_SYMBOL_GPL (devm_thermal_of_cooling_device_register); -static bool thermal_cooling_device_present (struct thermal_cooling_device *cdev) {struct thermal_cooling_device *pos =NULL ;drivers/thermal/thermal_core.h +5
-0@@ -269,6 +269,11 @@ void thermal_zone_device_critical_shutdown(struct thermal_zone_device *tz);void thermal_governor_update_tz (struct thermal_zone_device *tz,enum thermal_notify_event reason); +struct thermal_cooling_device * +__thermal_cooling_device_register (struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops); +/* Helpers */ #define for_each_trip_desc (__tz, __td) \ for (__td = __tz->trips; __td - __tz->trips < __tz->num_trips; __td++)drivers/thermal/thermal_of.c +63
-0@@ -510,3 +510,75 @@ void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_dev devm_thermal_of_zone_match, tz)); }EXPORT_SYMBOL_GPL (devm_thermal_of_zone_unregister); + +/** +* thermal_of_cooling_device_register() - register an OF thermal cooling device +* @np: a pointer to a device tree node. +* @type: the thermal cooling device type. +* @devdata: device private data. +* @ops: standard thermal cooling devices callbacks. +* +* This function will register a cooling device with device tree node reference. +* This interface function adds a new thermal cooling device (fan/processor/...) +* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself +* to all the thermal zone devices registered at the same time. +* +* Return: a pointer to the created struct thermal_cooling_device or an +* ERR_PTR. Caller must check return value with IS_ERR*() helpers. +*/ +struct thermal_cooling_device * +thermal_of_cooling_device_register (struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops) +{ +return __thermal_cooling_device_register (np, type, devdata, ops); +} +EXPORT_SYMBOL_GPL (thermal_of_cooling_device_register); + +static void thermal_cooling_device_release (struct device *dev,void *res) +{ +thermal_cooling_device_unregister (*(struct thermal_cooling_device **)res); +} + +/** +* devm_thermal_of_cooling_device_register() - register an OF thermal cooling +* device +* @dev: a valid struct device pointer of a sensor device. +* @np: a pointer to a device tree node. +* @type: the thermal cooling device type. +* @devdata: device private data. +* @ops: standard thermal cooling devices callbacks. +* +* This function will register a cooling device with device tree node reference. +* This interface function adds a new thermal cooling device (fan/processor/...) +* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself +* to all the thermal zone devices registered at the same time. +* +* Return: a pointer to the created struct thermal_cooling_device or an +* ERR_PTR. Caller must check return value with IS_ERR*() helpers. +*/ +struct thermal_cooling_device * +devm_thermal_of_cooling_device_register (struct device *dev, +struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops) +{ +struct thermal_cooling_device **ptr, *tcd; + + ptr =devres_alloc (thermal_cooling_device_release,sizeof (*ptr), +GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM ); + + tcd =__thermal_cooling_device_register (np, type, devdata, ops); +if (IS_ERR (tcd)) { +devres_free (ptr);
drivers/thermal/thermal_of.c void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_dev
Quoted 10 lines
drivers/thermal/thermal_of.c +9
-1+return tcd; + } + + *ptr = tcd; +devres_add (dev, ptr); + +return tcd; +} +EXPORT_SYMBOL_GPL (devm_thermal_of_cooling_device_register); --
Applied as 7.1 material, thanks!
Rafael J. Wysocki
maintainerQuoted 208 lines · Rafael J. Wysocki
Quoted 206 lines · Daniel Lezcano
From: Daniel Lezcano <[email protected]>
The functions:
-thermal_of_cooling_device_register()
-devm_thermal_of_cooling_device_register()are related to thermal-of but they are implemented in thermal-core. Move these functions to the right file.
Pure move patch.
No functional change intended.
Signed-off-by Daniel Lezcano <[email protected]>Signed-off-by Daniel Lezcano <[email protected]>--- drivers/thermal/thermal_core.c | 75 +--------------------------------- drivers/thermal/thermal_core.h | 5 +++ drivers/thermal/thermal_of.c | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 74 deletions(-)drivers/thermal/thermal_core.c +1
-74@@ -1054,7 +1054,7 @@ static void thermal_cooling_device_init_complete(struct thermal_cooling_device ** Return: a pointer to the created struct thermal_cooling_device or an * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ -static struct thermal_cooling_device * +struct thermal_cooling_device *__thermal_cooling_device_register (struct device_node *np,const char *type,void *devdata,const struct thermal_cooling_device_ops *ops)@@ -1162,79 +1162,6 @@ thermal_cooling_device_register(const char *type, void *devdata, }EXPORT_SYMBOL_GPL (thermal_cooling_device_register); -/** -* thermal_of_cooling_device_register() - register an OF thermal cooling device -* @np: a pointer to a device tree node. -* @type: the thermal cooling device type. -* @devdata: device private data. -* @ops: standard thermal cooling devices callbacks. -* -* This function will register a cooling device with device tree node reference. -* This interface function adds a new thermal cooling device (fan/processor/...) -* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself -* to all the thermal zone devices registered at the same time. -* -* Return: a pointer to the created struct thermal_cooling_device or an -* ERR_PTR. Caller must check return value with IS_ERR*() helpers. -*/ -struct thermal_cooling_device * -thermal_of_cooling_device_register (struct device_node *np, -const char *type,void *devdata, -const struct thermal_cooling_device_ops *ops) -{ -return __thermal_cooling_device_register (np, type, devdata, ops); -} -EXPORT_SYMBOL_GPL (thermal_of_cooling_device_register); - -static void thermal_cooling_device_release (struct device *dev,void *res) -{ -thermal_cooling_device_unregister ( - *(struct thermal_cooling_device **)res); -} - -/** -* devm_thermal_of_cooling_device_register() - register an OF thermal cooling -* device -* @dev: a valid struct device pointer of a sensor device. -* @np: a pointer to a device tree node. -* @type: the thermal cooling device type. -* @devdata: device private data. -* @ops: standard thermal cooling devices callbacks. -* -* This function will register a cooling device with device tree node reference. -* This interface function adds a new thermal cooling device (fan/processor/...) -* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself -* to all the thermal zone devices registered at the same time. -* -* Return: a pointer to the created struct thermal_cooling_device or an -* ERR_PTR. Caller must check return value with IS_ERR*() helpers. -*/ -struct thermal_cooling_device * -devm_thermal_of_cooling_device_register (struct device *dev, -struct device_node *np, -const char *type,void *devdata, -const struct thermal_cooling_device_ops *ops) -{ -struct thermal_cooling_device **ptr, *tcd; - - ptr =devres_alloc (thermal_cooling_device_release,sizeof (*ptr), -GFP_KERNEL ); -if (!ptr) -return ERR_PTR (-ENOMEM ); - - tcd =__thermal_cooling_device_register (np, type, devdata, ops); -if (IS_ERR (tcd)) { -devres_free (ptr); -return tcd; - } - - *ptr = tcd; -devres_add (dev, ptr); - -return tcd; -} -EXPORT_SYMBOL_GPL (devm_thermal_of_cooling_device_register); -static bool thermal_cooling_device_present (struct thermal_cooling_device *cdev) {struct thermal_cooling_device *pos =NULL ;drivers/thermal/thermal_core.h +5
-0@@ -269,6 +269,11 @@ void thermal_zone_device_critical_shutdown(struct thermal_zone_device *tz);void thermal_governor_update_tz (struct thermal_zone_device *tz,enum thermal_notify_event reason); +struct thermal_cooling_device * +__thermal_cooling_device_register (struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops); +/* Helpers */ #define for_each_trip_desc (__tz, __td) \ for (__td = __tz->trips; __td - __tz->trips < __tz->num_trips; __td++)drivers/thermal/thermal_of.c +67
-0@@ -510,3 +510,75 @@ void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_dev devm_thermal_of_zone_match, tz)); }EXPORT_SYMBOL_GPL (devm_thermal_of_zone_unregister); + +/** +* thermal_of_cooling_device_register() - register an OF thermal cooling device +* @np: a pointer to a device tree node. +* @type: the thermal cooling device type. +* @devdata: device private data. +* @ops: standard thermal cooling devices callbacks. +* +* This function will register a cooling device with device tree node reference. +* This interface function adds a new thermal cooling device (fan/processor/...) +* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself +* to all the thermal zone devices registered at the same time. +* +* Return: a pointer to the created struct thermal_cooling_device or an +* ERR_PTR. Caller must check return value with IS_ERR*() helpers. +*/ +struct thermal_cooling_device * +thermal_of_cooling_device_register (struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops) +{ +return __thermal_cooling_device_register (np, type, devdata, ops); +} +EXPORT_SYMBOL_GPL (thermal_of_cooling_device_register); + +static void thermal_cooling_device_release (struct device *dev,void *res) +{ +thermal_cooling_device_unregister (*(struct thermal_cooling_device **)res); +} + +/** +* devm_thermal_of_cooling_device_register() - register an OF thermal cooling +* device +* @dev: a valid struct device pointer of a sensor device. +* @np: a pointer to a device tree node. +* @type: the thermal cooling device type. +* @devdata: device private data. +* @ops: standard thermal cooling devices callbacks. +* +* This function will register a cooling device with device tree node reference. +* This interface function adds a new thermal cooling device (fan/processor/...) +* to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself +* to all the thermal zone devices registered at the same time. +* +* Return: a pointer to the created struct thermal_cooling_device or an +* ERR_PTR. Caller must check return value with IS_ERR*() helpers. +*/ +struct thermal_cooling_device * +devm_thermal_of_cooling_device_register (struct device *dev, +struct device_node *np, +const char *type,void *devdata, +const struct thermal_cooling_device_ops *ops) +{ +struct thermal_cooling_device **ptr, *tcd; + + ptr =devres_alloc (thermal_cooling_device_release,sizeof (*ptr), +GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM ); + + tcd =__thermal_cooling_device_register (np, type, devdata, ops); +if (IS_ERR (tcd)) { +devres_free (ptr); +return tcd; + } + + *ptr = tcd;
Quoted 8 lines
drivers/thermal/thermal_of.c void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_dev
Quoted 6 lines
drivers/thermal/thermal_of.c +5
-1+devres_add (dev, ptr); + +return tcd; +} +EXPORT_SYMBOL_GPL (devm_thermal_of_cooling_device_register); --Applied as 7.1 material, thanks!
And dropped because of a build issue introduced by it: