Re: [PATCH V2] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread kbuild test robot
Hi Anson,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on soc-thermal/next]
[also build test WARNING on v4.20-rc3 next-20181120]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Anson-Huang/thermal-imx-fix-for-dependency-on-cpu-freq/20181121-124056
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git 
next
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers//thermal/imx_thermal.c: In function 
'imx_thermal_unregister_legacy_cooling':
>> drivers//thermal/imx_thermal.c:685:1: warning: no return statement in 
>> function returning non-void [-Wreturn-type]
}
^

vim +685 drivers//thermal/imx_thermal.c

   680  
   681  static int imx_thermal_unregister_legacy_cooling(struct 
imx_thermal_data *data)
   682  {
   683  cpufreq_cooling_unregister(data->cdev);
   684  cpufreq_cpu_put(data->policy);
 > 685  }
   686  #else
   687  static inline int imx_thermal_register_legacy_cooling(struct 
imx_thermal_data *data)
   688  {
   689  return 0;
   690  }
   691  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH V2] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread kbuild test robot
Hi Anson,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on soc-thermal/next]
[also build test WARNING on v4.20-rc3 next-20181120]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Anson-Huang/thermal-imx-fix-for-dependency-on-cpu-freq/20181121-124056
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git 
next
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers//thermal/imx_thermal.c: In function 
'imx_thermal_unregister_legacy_cooling':
>> drivers//thermal/imx_thermal.c:685:1: warning: no return statement in 
>> function returning non-void [-Wreturn-type]
}
^

vim +685 drivers//thermal/imx_thermal.c

   680  
   681  static int imx_thermal_unregister_legacy_cooling(struct 
imx_thermal_data *data)
   682  {
   683  cpufreq_cooling_unregister(data->cdev);
   684  cpufreq_cpu_put(data->policy);
 > 685  }
   686  #else
   687  static inline int imx_thermal_register_legacy_cooling(struct 
imx_thermal_data *data)
   688  {
   689  return 0;
   690  }
   691  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH V2] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
The thermal driver is a standalone driver for monitoring SoC temperature
by enabling thermal sensor, so it can be enabled even when CONFIG_CPU_FREQ
is NOT set. So remove the dependency with CPU_THERMAL.

Introduce dummy function of legacy cooling register/unregister to make
thermal driver probe successfully when CONFIG_CPU_FREQ is NOT set.

Signed-off-by: Anson Huang 
---
changes since V1:
Introduce dummy function of legacy cooling register/unregister instead
of adding #define check in .probe function, handle error path correctly when
CONFIG_CPU_FREQ is NOT set.
 drivers/thermal/Kconfig   |  2 +-
 drivers/thermal/imx_thermal.c | 39 ++-
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 5422523..93bd3bb 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -212,7 +212,7 @@ config HISI_THERMAL
 
 config IMX_THERMAL
tristate "Temperature sensor driver for Freescale i.MX SoCs"
-   depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
+   depends on ARCH_MXC || COMPILE_TEST
depends on NVMEM || !NVMEM
depends on MFD_SYSCON
depends on OF
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 1566154..44e0154 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -648,15 +648,24 @@ static const struct of_device_id of_imx_thermal_match[] = 
{
 };
 MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
 
+#ifdef CONFIG_CPU_FREQ
 /*
  * Create cooling device in case no #cooling-cells property is available in
  * CPU node
  */
 static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
 {
-   struct device_node *np = of_get_cpu_node(data->policy->cpu, NULL);
+   struct device_node *np;
int ret;
 
+   data->policy = cpufreq_cpu_get(0);
+   if (!data->policy) {
+   pr_debug("%s: CPUFreq policy not found\n", __func__);
+   return -EPROBE_DEFER;
+   }
+
+   np = of_get_cpu_node(data->policy->cpu, NULL);
+
if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
data->cdev = cpufreq_cooling_register(data->policy);
if (IS_ERR(data->cdev)) {
@@ -669,6 +678,23 @@ static int imx_thermal_register_legacy_cooling(struct 
imx_thermal_data *data)
return 0;
 }
 
+static int imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
+{
+   cpufreq_cooling_unregister(data->cdev);
+   cpufreq_cpu_put(data->policy);
+}
+#else
+static inline int imx_thermal_register_legacy_cooling(struct imx_thermal_data 
*data)
+{
+   return 0;
+}
+
+static inline int imx_thermal_unregister_legacy_cooling(struct 
imx_thermal_data *data)
+{
+   return 0;
+}
+#endif
+
 static int imx_thermal_probe(struct platform_device *pdev)
 {
struct imx_thermal_data *data;
@@ -743,13 +769,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
 data->socdata->power_down_mask);
 
-   data->policy = cpufreq_cpu_get(0);
-   if (!data->policy) {
-   pr_debug("%s: CPUFreq policy not found\n", __func__);
-   return -EPROBE_DEFER;
-   }
-
ret = imx_thermal_register_legacy_cooling(data);
+   if (ret == -EPROBE_DEFER)
+   return ret;
if (ret) {
dev_err(>dev,
"failed to register cpufreq cooling device: %d\n", ret);
@@ -830,8 +852,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 clk_disable:
clk_disable_unprepare(data->thermal_clk);
 cpufreq_put:
-   cpufreq_cooling_unregister(data->cdev);
-   cpufreq_cpu_put(data->policy);
+   imx_thermal_unregister_legacy_cooling(data);
 
return ret;
 }
-- 
2.7.4



[PATCH V2] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
The thermal driver is a standalone driver for monitoring SoC temperature
by enabling thermal sensor, so it can be enabled even when CONFIG_CPU_FREQ
is NOT set. So remove the dependency with CPU_THERMAL.

Introduce dummy function of legacy cooling register/unregister to make
thermal driver probe successfully when CONFIG_CPU_FREQ is NOT set.

Signed-off-by: Anson Huang 
---
changes since V1:
Introduce dummy function of legacy cooling register/unregister instead
of adding #define check in .probe function, handle error path correctly when
CONFIG_CPU_FREQ is NOT set.
 drivers/thermal/Kconfig   |  2 +-
 drivers/thermal/imx_thermal.c | 39 ++-
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 5422523..93bd3bb 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -212,7 +212,7 @@ config HISI_THERMAL
 
 config IMX_THERMAL
tristate "Temperature sensor driver for Freescale i.MX SoCs"
-   depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
+   depends on ARCH_MXC || COMPILE_TEST
depends on NVMEM || !NVMEM
depends on MFD_SYSCON
depends on OF
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 1566154..44e0154 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -648,15 +648,24 @@ static const struct of_device_id of_imx_thermal_match[] = 
{
 };
 MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
 
+#ifdef CONFIG_CPU_FREQ
 /*
  * Create cooling device in case no #cooling-cells property is available in
  * CPU node
  */
 static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
 {
-   struct device_node *np = of_get_cpu_node(data->policy->cpu, NULL);
+   struct device_node *np;
int ret;
 
+   data->policy = cpufreq_cpu_get(0);
+   if (!data->policy) {
+   pr_debug("%s: CPUFreq policy not found\n", __func__);
+   return -EPROBE_DEFER;
+   }
+
+   np = of_get_cpu_node(data->policy->cpu, NULL);
+
if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
data->cdev = cpufreq_cooling_register(data->policy);
if (IS_ERR(data->cdev)) {
@@ -669,6 +678,23 @@ static int imx_thermal_register_legacy_cooling(struct 
imx_thermal_data *data)
return 0;
 }
 
+static int imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
+{
+   cpufreq_cooling_unregister(data->cdev);
+   cpufreq_cpu_put(data->policy);
+}
+#else
+static inline int imx_thermal_register_legacy_cooling(struct imx_thermal_data 
*data)
+{
+   return 0;
+}
+
+static inline int imx_thermal_unregister_legacy_cooling(struct 
imx_thermal_data *data)
+{
+   return 0;
+}
+#endif
+
 static int imx_thermal_probe(struct platform_device *pdev)
 {
struct imx_thermal_data *data;
@@ -743,13 +769,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
 data->socdata->power_down_mask);
 
-   data->policy = cpufreq_cpu_get(0);
-   if (!data->policy) {
-   pr_debug("%s: CPUFreq policy not found\n", __func__);
-   return -EPROBE_DEFER;
-   }
-
ret = imx_thermal_register_legacy_cooling(data);
+   if (ret == -EPROBE_DEFER)
+   return ret;
if (ret) {
dev_err(>dev,
"failed to register cpufreq cooling device: %d\n", ret);
@@ -830,8 +852,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 clk_disable:
clk_disable_unprepare(data->thermal_clk);
 cpufreq_put:
-   cpufreq_cooling_unregister(data->cdev);
-   cpufreq_cpu_put(data->policy);
+   imx_thermal_unregister_legacy_cooling(data);
 
return ret;
 }
-- 
2.7.4