diff mbox series

thermal/core: Make cooling device state change private

Message ID 20210111141320.15452-1-daniel.lezcano@linaro.org
State Superseded
Headers show
Series thermal/core: Make cooling device state change private | expand

Commit Message

Daniel Lezcano Jan. 11, 2021, 2:13 p.m. UTC
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 <daniel.lezcano@linaro.org>

---
 drivers/hwmon/pwm-fan.c        | 1 -
 drivers/thermal/thermal_core.h | 2 ++
 include/linux/thermal.h        | 3 ---
 3 files changed, 2 insertions(+), 4 deletions(-)

-- 
2.17.1

Comments

Guenter Roeck Jan. 11, 2021, 2:55 p.m. UTC | #1
On 1/11/21 6:13 AM, Daniel Lezcano wrote:
> 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 <daniel.lezcano@linaro.org>


Acked-by: Guenter Roeck <linux@roeck-us.net>


> ---

>  drivers/hwmon/pwm-fan.c        | 1 -

>  drivers/thermal/thermal_core.h | 2 ++

>  include/linux/thermal.h        | 3 ---

>  3 files changed, 2 insertions(+), 4 deletions(-)

> 

> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c

> index bdba2143021a..0b1159ceac9b 100644

> --- a/drivers/hwmon/pwm-fan.c

> +++ b/drivers/hwmon/pwm-fan.c

> @@ -378,7 +378,6 @@ static int pwm_fan_probe(struct platform_device *pdev)

>  			return ret;

>  		}

>  		ctx->cdev = cdev;

> -		thermal_cdev_update(cdev);

>  	}

>  

>  	return 0;

> diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h

> index 90f9a80c8b23..86b8cef7310e 100644

> --- a/drivers/thermal/thermal_core.h

> +++ b/drivers/thermal/thermal_core.h

> @@ -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

> diff --git a/include/linux/thermal.h b/include/linux/thermal.h

> index 1e686404951b..6ac7bb1d2b1f 100644

> --- a/include/linux/thermal.h

> +++ b/include/linux/thermal.h

> @@ -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 Jan. 11, 2021, 4:20 p.m. UTC | #2
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
Reported-by: kernel test robot <lkp@intel.com>

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_update
   cc1: 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@lists.01.org
diff mbox series

Patch

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index bdba2143021a..0b1159ceac9b 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -378,7 +378,6 @@  static int pwm_fan_probe(struct platform_device *pdev)
 			return ret;
 		}
 		ctx->cdev = cdev;
-		thermal_cdev_update(cdev);
 	}
 
 	return 0;
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 90f9a80c8b23..86b8cef7310e 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -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
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 1e686404951b..6ac7bb1d2b1f 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -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)
 { }