thermal/core: Make cooling device state change private
Subsystems (2)
PATCH 1/1 thermal/core: Make cooling device state change private
The change of the cooling device state should be used by the governor or at least by the core code, not by the drivers themselves.
Remove the API usage and move the function declaration to the internal headers.
--- drivers/hwmon/pwm-fan.c | 1 - drivers/thermal/thermal_core.h | 2 ++ include/linux/thermal.h | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-)
drivers/hwmon/pwm-fan.c +0 -1
@@ -378,7 +378,6 @@ static int pwm_fan_probe(struct platform_device *pdev)return ret; } ctx->cdev = cdev; -thermal_cdev_update (cdev); }return 0 ;
drivers/thermal/thermal_core.h +2 -0
@@ -65,6 +65,8 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) cdev->ops->power2state; } +void thermal_cdev_update (struct thermal_cooling_device *); +/** * struct thermal_trip - representation of a point in temperature domain * @np: pointer to struct device_node that this trip point was created from
include/linux/thermal.h +0 -3
@@ -390,7 +390,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);int thermal_zone_get_slope (struct thermal_zone_device *tz);int thermal_zone_get_offset (struct thermal_zone_device *tz); -void thermal_cdev_update (struct thermal_cooling_device *);void thermal_notify_framework (struct thermal_zone_device *,int );int thermal_zone_device_enable (struct thermal_zone_device *tz);int thermal_zone_device_disable (struct thermal_zone_device *tz);
@@ -437,8 +436,6 @@ static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) {return -ENODEV ; } -static inline void thermal_cdev_update (struct thermal_cooling_device *cdev) -{ }static inline void thermal_notify_framework (struct thermal_zone_device *tz,int trip) { }
Signature · 1 line
2.17.1
Quoted 7 lines · Daniel Lezcano
The change of the cooling device state should be used by the governor or at least by the core code, not by the drivers themselves.
Remove the API usage and move the function declaration to the internal headers.
Signed-off-by Daniel Lezcano <[email protected]>
Quoted 53 lines
--- drivers/hwmon/pwm-fan.c | 1 - drivers/thermal/thermal_core.h | 2 ++ include/linux/thermal.h | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-)drivers/hwmon/pwm-fan.c +0
-1@@ -378,7 +378,6 @@ static int pwm_fan_probe(struct platform_device *pdev)return ret; } ctx->cdev = cdev; -thermal_cdev_update (cdev); }return 0 ;drivers/thermal/thermal_core.h +2
-0@@ -65,6 +65,8 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) cdev->ops->power2state; } +void thermal_cdev_update (struct thermal_cooling_device *); +/** * struct thermal_trip - representation of a point in temperature domain * @np: pointer to struct device_node that this trip point was created from include/linux/thermal.h +0
-3@@ -390,7 +390,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);int thermal_zone_get_slope (struct thermal_zone_device *tz);int thermal_zone_get_offset (struct thermal_zone_device *tz); -void thermal_cdev_update (struct thermal_cooling_device *);void thermal_notify_framework (struct thermal_zone_device *,int );int thermal_zone_device_enable (struct thermal_zone_device *tz);int thermal_zone_device_disable (struct thermal_zone_device *tz);@@ -437,8 +436,6 @@ static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) {return -ENODEV ; } -static inline void thermal_cdev_update (struct thermal_cooling_device *cdev) -{ }static inline void thermal_notify_framework (struct thermal_zone_device *tz,int trip) { }
kernel test robot
build botI love your patch! Yet something to improve:
Hi Daniel,
I love your patch! Yet something to improve:
[auto build test ERROR on hwmon/hwmon-next]
[also build test ERROR on linus/master v5.11-rc3 next-20210111] [cannot apply to thermal/next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Daniel-Lezcano/thermal-core-Make-cooling-device-state-change-private/20210111-221657 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: openrisc-randconfig-r002-20210111 (attached as .config) compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/7e1231d27217f86cbadf3800d61cbe74a29f913d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Lezcano/thermal-core-Make-cooling-device-state-change-private/20210111-221657 git checkout 7e1231d27217f86cbadf3800d61cbe74a29f913d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/thermal/khadas_mcu_fan.c: In function 'khadas_mcu_fan_probe':
>> drivers/thermal/khadas_mcu_fan.c:103:2: error: implicit declaration of function 'thermal_cdev_update'; did you mean 'thermal_zone_device_update'? [-Werror=implicit-function-declaration]
103 | thermal_cdev_update(cdev);
| ^~~~~~~~~~~~~~~~~~~
| thermal_zone_device_updatecc1: some warnings being treated as errors
vim +103 drivers/thermal/khadas_mcu_fan.c
5772717e59b9fbdc Neil Armstrong 2020-06-24 78
5772717e59b9fbdc Neil Armstrong 2020-06-24 79 static int khadas_mcu_fan_probe(struct platform_device *pdev)
5772717e59b9fbdc Neil Armstrong 2020-06-24 80 {
5772717e59b9fbdc Neil Armstrong 2020-06-24 81 struct khadas_mcu *mcu = dev_get_drvdata(pdev->dev.parent);
5772717e59b9fbdc Neil Armstrong 2020-06-24 82 struct thermal_cooling_device *cdev;
5772717e59b9fbdc Neil Armstrong 2020-06-24 83 struct device *dev = &pdev->dev;
5772717e59b9fbdc Neil Armstrong 2020-06-24 84 struct khadas_mcu_fan_ctx *ctx;
5772717e59b9fbdc Neil Armstrong 2020-06-24 85 int ret;
5772717e59b9fbdc Neil Armstrong 2020-06-24 86
5772717e59b9fbdc Neil Armstrong 2020-06-24 87 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
5772717e59b9fbdc Neil Armstrong 2020-06-24 88 if (!ctx)
5772717e59b9fbdc Neil Armstrong 2020-06-24 89 return -ENOMEM;
5772717e59b9fbdc Neil Armstrong 2020-06-24 90 ctx->mcu = mcu;
5772717e59b9fbdc Neil Armstrong 2020-06-24 91 platform_set_drvdata(pdev, ctx);
5772717e59b9fbdc Neil Armstrong 2020-06-24 92
5772717e59b9fbdc Neil Armstrong 2020-06-24 93 cdev = devm_thermal_of_cooling_device_register(dev->parent,
5772717e59b9fbdc Neil Armstrong 2020-06-24 94 dev->parent->of_node, "khadas-mcu-fan", ctx,
5772717e59b9fbdc Neil Armstrong 2020-06-24 95 &khadas_mcu_fan_cooling_ops);
5772717e59b9fbdc Neil Armstrong 2020-06-24 96 if (IS_ERR(cdev)) {
5772717e59b9fbdc Neil Armstrong 2020-06-24 97 ret = PTR_ERR(cdev);
5772717e59b9fbdc Neil Armstrong 2020-06-24 98 dev_err(dev, "Failed to register khadas-mcu-fan as cooling device: %d\n",
5772717e59b9fbdc Neil Armstrong 2020-06-24 99 ret);
5772717e59b9fbdc Neil Armstrong 2020-06-24 100 return ret;
5772717e59b9fbdc Neil Armstrong 2020-06-24 101 }
5772717e59b9fbdc Neil Armstrong 2020-06-24 102 ctx->cdev = cdev;
5772717e59b9fbdc Neil Armstrong 2020-06-24 @103 thermal_cdev_update(cdev);
5772717e59b9fbdc Neil Armstrong 2020-06-24 104
5772717e59b9fbdc Neil Armstrong 2020-06-24 105 return 0;
5772717e59b9fbdc Neil Armstrong 2020-06-24 106 }
5772717e59b9fbdc Neil Armstrong 2020-06-24 107 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org