linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone
@ 2016-06-22  0:38 Kuninori Morimoto
  2016-06-23  0:35 ` Kuninori Morimoto
  2016-07-03  2:56 ` kbuild test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2016-06-22  0:38 UTC (permalink / raw)
  To: Zhang Rui
  Cc: edubezval, linux-kernel, linux-renesas-soc, linux-pm,
	yoshihiro.shimoda.uh, cm-hiep, bd-phuc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rcar-thermal is supporting both thermal_zone_of_sensor_register() and
thermal_zone_device_register(). But thermal_zone_of_sensor_register()
doesn't enable hwmon as default.
This patch enables it to keep compatibility

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
>> Zhang

I want to have Tested-by from Hiep or Phuc

 drivers/thermal/rcar_thermal.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 71a3392..4d07644 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -31,6 +31,8 @@
 #include <linux/spinlock.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define IDLE_INTERVAL	5000
 
 #define COMMON_STR	0x00
@@ -75,6 +77,8 @@ struct rcar_thermal_priv {
 #define rcar_priv_to_dev(priv)		((priv)->common->dev)
 #define rcar_has_irq_support(priv)	((priv)->common->base)
 #define rcar_id_to_shift(priv)		((priv)->id * 8)
+#define rcar_of_data(dev)		((unsigned long)of_device_get_match_data(dev))
+#define rcar_use_of_thermal(dev)	(rcar_of_data(dev) == USE_OF_THERMAL)
 
 #define USE_OF_THERMAL	1
 static const struct of_device_id rcar_thermal_dt_ids[] = {
@@ -416,6 +420,8 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 	rcar_thermal_for_each_priv(priv, common) {
 		rcar_thermal_irq_disable(priv);
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_use_of_thermal(dev))
+			thermal_remove_hwmon_sysfs(priv->zone);
 	}
 
 	pm_runtime_put(dev);
@@ -430,7 +436,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	struct rcar_thermal_priv *priv;
 	struct device *dev = &pdev->dev;
 	struct resource *res, *irq;
-	unsigned long of_data = (unsigned long)of_device_get_match_data(dev);
 	int mres = 0;
 	int i;
 	int ret = -ENODEV;
@@ -491,7 +496,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		if (ret < 0)
 			goto error_unregister;
 
-		if (of_data == USE_OF_THERMAL)
+		if (rcar_use_of_thermal(dev))
 			priv->zone = devm_thermal_zone_of_sensor_register(
 						dev, i, priv,
 						&rcar_thermal_zone_of_ops);
@@ -507,6 +512,17 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 			goto error_unregister;
 		}
 
+		if (rcar_use_of_thermal(dev)) {
+			/*
+			 * thermal_zone doesn't enable hwmon as default,
+			 * but, enable it here to keep compatible
+			 */
+			priv->zone->tzp->no_hwmon = false;
+			ret = thermal_add_hwmon_sysfs(priv->zone);
+			if (ret)
+				goto error_unregister;
+		}
+
 		rcar_thermal_irq_enable(priv);
 
 		list_move_tail(&priv->list, &common->head);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone
  2016-06-22  0:38 [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone Kuninori Morimoto
@ 2016-06-23  0:35 ` Kuninori Morimoto
  2016-07-03  2:56 ` kbuild test robot
  1 sibling, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2016-06-23  0:35 UTC (permalink / raw)
  To: Zhang Rui
  Cc: edubezval, linux-kernel, linux-renesas-soc, linux-pm,
	yoshihiro.shimoda.uh, cm-hiep, bd-phuc


Hi Zhang

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> rcar-thermal is supporting both thermal_zone_of_sensor_register() and
> thermal_zone_device_register(). But thermal_zone_of_sensor_register()
> doesn't enable hwmon as default.
> This patch enables it to keep compatibility
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> >> Zhang
> 
> I want to have Tested-by from Hiep or Phuc

I have got private reply from Phuc

Tested-by : Bui Duc Phuc ( Fukuda ) <bd-phuc@jinso.co.jp> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone
  2016-06-22  0:38 [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone Kuninori Morimoto
  2016-06-23  0:35 ` Kuninori Morimoto
@ 2016-07-03  2:56 ` kbuild test robot
  2016-07-04  0:31   ` [PATCH] thermal: hwmon: EXPORT_SYMBOL for thermal hwmon sysfs Kuninori Morimoto
  1 sibling, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2016-07-03  2:56 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: kbuild-all, Zhang Rui, edubezval, linux-kernel,
	linux-renesas-soc, linux-pm, yoshihiro.shimoda.uh, cm-hiep,
	bd-phuc

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

Hi,

[auto build test ERROR on thermal/next]
[also build test ERROR on v4.7-rc5 next-20160701]
[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/Kuninori-Morimoto/thermal-rcar-thermal-enable-hwmon-when-thermal_zone/20160622-083954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: s390-allmodconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=s390 

All errors (new ones prefixed by >>):

>> ERROR: "thermal_remove_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!
>> ERROR: "thermal_add_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!

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

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 41672 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] thermal: hwmon: EXPORT_SYMBOL for thermal hwmon sysfs
  2016-07-03  2:56 ` kbuild test robot
@ 2016-07-04  0:31   ` Kuninori Morimoto
  2016-07-04  6:49     ` Geert Uytterhoeven
  0 siblings, 1 reply; 6+ messages in thread
From: Kuninori Morimoto @ 2016-07-04  0:31 UTC (permalink / raw)
  To: Zhang Rui, edubezval
  Cc: linux-kernel, linux-renesas-soc, linux-pm, yoshihiro.shimoda.uh,
	cm-hiep, bd-phuc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

thermal_add_hwmon_sysfs()/thermal_remove_hwmon_sysfs() need
EXPORT_SYMBOL(). Otherwise we will have ERROR

>> ERROR: "thermal_remove_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!
>> ERROR: "thermal_add_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/thermal_hwmon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index 06fd2ed9..8eecba8 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -232,6 +232,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 
 	return result;
 }
+EXPORT_SYMBOL(thermal_add_hwmon_sysfs);
 
 void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
 {
@@ -270,3 +271,4 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
 	hwmon_device_unregister(hwmon->device);
 	kfree(hwmon);
 }
+EXPORT_SYMBOL(thermal_remove_hwmon_sysfs);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] thermal: hwmon: EXPORT_SYMBOL for thermal hwmon sysfs
  2016-07-04  0:31   ` [PATCH] thermal: hwmon: EXPORT_SYMBOL for thermal hwmon sysfs Kuninori Morimoto
@ 2016-07-04  6:49     ` Geert Uytterhoeven
  2016-07-04  6:58       ` Kuninori Morimoto
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2016-07-04  6:49 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Zhang Rui, edubezval, linux-kernel, linux-renesas-soc, linux-pm,
	yoshihiro.shimoda.uh, cm-hiep, PhucBui

Hi Morimoto-san,

On Mon, Jul 4, 2016 at 2:31 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> thermal_add_hwmon_sysfs()/thermal_remove_hwmon_sysfs() need
> EXPORT_SYMBOL(). Otherwise we will have ERROR
>
>>> ERROR: "thermal_remove_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!
>>> ERROR: "thermal_add_hwmon_sysfs" [drivers/thermal/rcar_thermal.ko] undefined!
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/thermal/thermal_hwmon.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> index 06fd2ed9..8eecba8 100644
> --- a/drivers/thermal/thermal_hwmon.c
> +++ b/drivers/thermal/thermal_hwmon.c
> @@ -232,6 +232,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
>
>         return result;
>  }
> +EXPORT_SYMBOL(thermal_add_hwmon_sysfs);

EXPORT_SYMBOL_GPL?
That seems to be prevalent in the thermal subsystem, except for a few cases
in cpu_cooling.c and thermal_helpers.c.

>  void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
>  {
> @@ -270,3 +271,4 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
>         hwmon_device_unregister(hwmon->device);
>         kfree(hwmon);
>  }
> +EXPORT_SYMBOL(thermal_remove_hwmon_sysfs);

EXPORT_SYMBOL_GPL?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] thermal: hwmon: EXPORT_SYMBOL for thermal hwmon sysfs
  2016-07-04  6:49     ` Geert Uytterhoeven
@ 2016-07-04  6:58       ` Kuninori Morimoto
  0 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2016-07-04  6:58 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Zhang Rui, edubezval, linux-kernel, linux-renesas-soc, linux-pm,
	yoshihiro.shimoda.uh, cm-hiep, PhucBui


Hi Geert

> > +EXPORT_SYMBOL(thermal_add_hwmon_sysfs);
> 
> EXPORT_SYMBOL_GPL?
> That seems to be prevalent in the thermal subsystem, except for a few cases
> in cpu_cooling.c and thermal_helpers.c.

Thanks.
Will fix in v2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-04  6:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22  0:38 [PATCH] thermal: rcar-thermal: enable hwmon when thermal_zone Kuninori Morimoto
2016-06-23  0:35 ` Kuninori Morimoto
2016-07-03  2:56 ` kbuild test robot
2016-07-04  0:31   ` [PATCH] thermal: hwmon: EXPORT_SYMBOL for thermal hwmon sysfs Kuninori Morimoto
2016-07-04  6:49     ` Geert Uytterhoeven
2016-07-04  6:58       ` Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).