linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 03/33] thermal/drivers/rockchip: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
@ 2022-07-10 21:23 ` Daniel Lezcano
  2022-07-10 21:23 ` [PATCH v1 04/33] thermal/drivers/uniphier: " Daniel Lezcano
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:23 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
	open list:ARM/Rockchip SoC support

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/rockchip_thermal.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index dc3a9c276a09..ea3abfb8e6c8 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1211,9 +1211,9 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev)
 	return IRQ_HANDLED;
 }
 
-static int rockchip_thermal_set_trips(void *_sensor, int low, int high)
+static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
 {
-	struct rockchip_thermal_sensor *sensor = _sensor;
+	struct rockchip_thermal_sensor *sensor = tz->devdata;
 	struct rockchip_thermal_data *thermal = sensor->thermal;
 	const struct rockchip_tsadc_chip *tsadc = thermal->chip;
 
@@ -1224,9 +1224,9 @@ static int rockchip_thermal_set_trips(void *_sensor, int low, int high)
 				     sensor->id, thermal->regs, high);
 }
 
-static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
+static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp)
 {
-	struct rockchip_thermal_sensor *sensor = _sensor;
+	struct rockchip_thermal_sensor *sensor = tz->devdata;
 	struct rockchip_thermal_data *thermal = sensor->thermal;
 	const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip;
 	int retval;
@@ -1239,7 +1239,7 @@ static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
 	return retval;
 }
 
-static const struct thermal_zone_of_device_ops rockchip_of_thermal_ops = {
+static struct thermal_zone_device_ops rockchip_of_thermal_ops = {
 	.get_temp = rockchip_thermal_get_temp,
 	.set_trips = rockchip_thermal_set_trips,
 };
@@ -1326,8 +1326,8 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
 
 	sensor->thermal = thermal;
 	sensor->id = id;
-	sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, id,
-					sensor, &rockchip_of_thermal_ops);
+	sensor->tzd = devm_thermal_of_zone_register(&pdev->dev, id, sensor,
+						    &rockchip_of_thermal_ops);
 	if (IS_ERR(sensor->tzd)) {
 		error = PTR_ERR(sensor->tzd);
 		dev_err(&pdev->dev, "failed to register sensor %d: %d\n",
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 04/33] thermal/drivers/uniphier: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
  2022-07-10 21:23 ` [PATCH v1 03/33] thermal/drivers/rockchip: Switch to new of API Daniel Lezcano
@ 2022-07-10 21:23 ` Daniel Lezcano
  2022-07-10 21:23 ` [PATCH v1 08/33] thermal/drivers/sun8i: " Daniel Lezcano
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:23 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Kunihiko Hayashi, Masami Hiramatsu,
	moderated list:ARM/UNIPHIER ARCHITECTURE

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/uniphier_thermal.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
index 4cae5561a2a3..2405e72fb5f9 100644
--- a/drivers/thermal/uniphier_thermal.c
+++ b/drivers/thermal/uniphier_thermal.c
@@ -187,9 +187,9 @@ static void uniphier_tm_disable_sensor(struct uniphier_tm_dev *tdev)
 	usleep_range(1000, 2000);	/* The spec note says at least 1ms */
 }
 
-static int uniphier_tm_get_temp(void *data, int *out_temp)
+static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_temp)
 {
-	struct uniphier_tm_dev *tdev = data;
+	struct uniphier_tm_dev *tdev = tz->devdata;
 	struct regmap *map = tdev->regmap;
 	int ret;
 	u32 temp;
@@ -204,7 +204,7 @@ static int uniphier_tm_get_temp(void *data, int *out_temp)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops uniphier_of_thermal_ops = {
+static struct thermal_zone_device_ops uniphier_of_thermal_ops = {
 	.get_temp = uniphier_tm_get_temp,
 };
 
@@ -289,8 +289,8 @@ static int uniphier_tm_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, tdev);
 
-	tdev->tz_dev = devm_thermal_zone_of_sensor_register(dev, 0, tdev,
-						&uniphier_of_thermal_ops);
+	tdev->tz_dev = devm_thermal_of_zone_register(dev, 0, tdev,
+						     &uniphier_of_thermal_ops);
 	if (IS_ERR(tdev->tz_dev)) {
 		dev_err(dev, "failed to register sensor device\n");
 		return PTR_ERR(tdev->tz_dev);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 08/33] thermal/drivers/sun8i: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
  2022-07-10 21:23 ` [PATCH v1 03/33] thermal/drivers/rockchip: Switch to new of API Daniel Lezcano
  2022-07-10 21:23 ` [PATCH v1 04/33] thermal/drivers/uniphier: " Daniel Lezcano
@ 2022-07-10 21:23 ` Daniel Lezcano
  2022-07-10 21:24 ` [PATCH v1 10/33] thermal/drivers/broadcom: " Daniel Lezcano
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:23 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/sun8i_thermal.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index d9cd23cbb671..d4e04c2c5135 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -108,9 +108,9 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev,
 		return -1590 * reg / 10 + 276000;
 }
 
-static int sun8i_ths_get_temp(void *data, int *temp)
+static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct tsensor *s = data;
+	struct tsensor *s = tz->devdata;
 	struct ths_device *tmdev = s->tmdev;
 	int val = 0;
 
@@ -135,7 +135,7 @@ static int sun8i_ths_get_temp(void *data, int *temp)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops ths_ops = {
+static struct thermal_zone_device_ops ths_ops = {
 	.get_temp = sun8i_ths_get_temp,
 };
 
@@ -468,10 +468,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
 		tmdev->sensor[i].tmdev = tmdev;
 		tmdev->sensor[i].id = i;
 		tmdev->sensor[i].tzd =
-			devm_thermal_zone_of_sensor_register(tmdev->dev,
-							     i,
-							     &tmdev->sensor[i],
-							     &ths_ops);
+			devm_thermal_of_zone_register(tmdev->dev,
+						      i,
+						      &tmdev->sensor[i],
+						      &ths_ops);
 		if (IS_ERR(tmdev->sensor[i].tzd))
 			return PTR_ERR(tmdev->sensor[i].tzd);
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 10/33] thermal/drivers/broadcom: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (2 preceding siblings ...)
  2022-07-10 21:23 ` [PATCH v1 08/33] thermal/drivers/sun8i: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-11  2:37   ` Florian Fainelli
  2022-07-10 21:24 ` [PATCH v1 12/33] thermal/drivers/st: " Daniel Lezcano
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Florian Fainelli, Broadcom internal kernel review list,
	Markus Mayer, Stefan Wahren, Zheng Yongjun,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/broadcom/bcm2711_thermal.c | 14 +++---
 drivers/thermal/broadcom/brcmstb_thermal.c | 20 ++++-----
 drivers/thermal/broadcom/ns-thermal.c      | 50 +++++++++-------------
 drivers/thermal/broadcom/sr-thermal.c      | 16 +++----
 4 files changed, 46 insertions(+), 54 deletions(-)

diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
index e9bef5c3414b..64d75593e760 100644
--- a/drivers/thermal/broadcom/bcm2711_thermal.c
+++ b/drivers/thermal/broadcom/bcm2711_thermal.c
@@ -31,11 +31,11 @@ struct bcm2711_thermal_priv {
 	struct thermal_zone_device *thermal;
 };
 
-static int bcm2711_get_temp(void *data, int *temp)
+static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct bcm2711_thermal_priv *priv = data;
-	int slope = thermal_zone_get_slope(priv->thermal);
-	int offset = thermal_zone_get_offset(priv->thermal);
+	struct bcm2711_thermal_priv *priv = tz->devdata;
+	int slope = thermal_zone_get_slope(tz);
+	int offset = thermal_zone_get_offset(tz);
 	u32 val;
 	int ret;
 
@@ -54,7 +54,7 @@ static int bcm2711_get_temp(void *data, int *temp)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops bcm2711_thermal_of_ops = {
+static struct thermal_zone_device_ops bcm2711_thermal_of_ops = {
 	.get_temp	= bcm2711_get_temp,
 };
 
@@ -88,8 +88,8 @@ static int bcm2711_thermal_probe(struct platform_device *pdev)
 	}
 	priv->regmap = regmap;
 
-	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
-						       &bcm2711_thermal_of_ops);
+	thermal = devm_thermal_of_zone_register(dev, 0, priv,
+						&bcm2711_thermal_of_ops);
 	if (IS_ERR(thermal)) {
 		ret = PTR_ERR(thermal);
 		dev_err(dev, "could not register sensor: %d\n", ret);
diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 0cedb8b4f00a..c459d14df3b5 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -105,7 +105,7 @@ static struct avs_tmon_trip avs_tmon_trips[] = {
 struct brcmstb_thermal_params {
 	unsigned int offset;
 	unsigned int mult;
-	const struct thermal_zone_of_device_ops *of_ops;
+	struct thermal_zone_device_ops *of_ops;
 };
 
 struct brcmstb_thermal_priv {
@@ -150,9 +150,9 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv,
 		return (u32)((offset - temp) / mult);
 }
 
-static int brcmstb_get_temp(void *data, int *temp)
+static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct brcmstb_thermal_priv *priv = data;
+	struct brcmstb_thermal_priv *priv = tz->devdata;
 	u32 val;
 	long t;
 
@@ -260,9 +260,9 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static int brcmstb_set_trips(void *data, int low, int high)
+static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int high)
 {
-	struct brcmstb_thermal_priv *priv = data;
+	struct brcmstb_thermal_priv *priv = tz->devdata;
 
 	dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high);
 
@@ -288,7 +288,7 @@ static int brcmstb_set_trips(void *data, int low, int high)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops brcmstb_16nm_of_ops = {
+static struct thermal_zone_device_ops brcmstb_16nm_of_ops = {
 	.get_temp	= brcmstb_get_temp,
 };
 
@@ -298,7 +298,7 @@ static const struct brcmstb_thermal_params brcmstb_16nm_params = {
 	.of_ops	= &brcmstb_16nm_of_ops,
 };
 
-static const struct thermal_zone_of_device_ops brcmstb_28nm_of_ops = {
+static struct thermal_zone_device_ops brcmstb_28nm_of_ops = {
 	.get_temp	= brcmstb_get_temp,
 	.set_trips	= brcmstb_set_trips,
 };
@@ -318,7 +318,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table);
 
 static int brcmstb_thermal_probe(struct platform_device *pdev)
 {
-	const struct thermal_zone_of_device_ops *of_ops;
+	struct thermal_zone_device_ops *of_ops;
 	struct thermal_zone_device *thermal;
 	struct brcmstb_thermal_priv *priv;
 	struct resource *res;
@@ -341,8 +341,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, priv);
 	of_ops = priv->temp_params->of_ops;
 
-	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
-						       of_ops);
+	thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv,
+						of_ops);
 	if (IS_ERR(thermal)) {
 		ret = PTR_ERR(thermal);
 		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadcom/ns-thermal.c
index c9468ba9d449..b9c3f2306bf5 100644
--- a/drivers/thermal/broadcom/ns-thermal.c
+++ b/drivers/thermal/broadcom/ns-thermal.c
@@ -14,19 +14,14 @@
 #define PVTMON_CONTROL0_SEL_TEST_MODE			0x0000000e
 #define PVTMON_STATUS					0x08
 
-struct ns_thermal {
-	struct thermal_zone_device *tz;
-	void __iomem *pvtmon;
-};
-
-static int ns_thermal_get_temp(void *data, int *temp)
+static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct ns_thermal *ns_thermal = data;
-	int offset = thermal_zone_get_offset(ns_thermal->tz);
-	int slope = thermal_zone_get_slope(ns_thermal->tz);
+	void __iomem *pvtmon = tz->devdata;
+	int offset = thermal_zone_get_offset(tz);
+	int slope = thermal_zone_get_slope(tz);
 	u32 val;
 
-	val = readl(ns_thermal->pvtmon + PVTMON_CONTROL0);
+	val = readl(pvtmon + PVTMON_CONTROL0);
 	if ((val & PVTMON_CONTROL0_SEL_MASK) != PVTMON_CONTROL0_SEL_TEMP_MONITOR) {
 		/* Clear current mode selection */
 		val &= ~PVTMON_CONTROL0_SEL_MASK;
@@ -34,50 +29,47 @@ static int ns_thermal_get_temp(void *data, int *temp)
 		/* Set temp monitor mode (it's the default actually) */
 		val |= PVTMON_CONTROL0_SEL_TEMP_MONITOR;
 
-		writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0);
+		writel(val, pvtmon + PVTMON_CONTROL0);
 	}
 
-	val = readl(ns_thermal->pvtmon + PVTMON_STATUS);
+	val = readl(pvtmon + PVTMON_STATUS);
 	*temp = slope * val + offset;
 
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops ns_thermal_ops = {
+static struct thermal_zone_device_ops ns_thermal_ops = {
 	.get_temp = ns_thermal_get_temp,
 };
 
 static int ns_thermal_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct ns_thermal *ns_thermal;
-
-	ns_thermal = devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL);
-	if (!ns_thermal)
-		return -ENOMEM;
+	struct thermal_zone_device *tz;
+	void __iomem *pvtmon;
 
-	ns_thermal->pvtmon = of_iomap(dev_of_node(dev), 0);
-	if (WARN_ON(!ns_thermal->pvtmon))
+	pvtmon = of_iomap(dev_of_node(dev), 0);
+	if (WARN_ON(!pvtmon))
 		return -ENOENT;
 
-	ns_thermal->tz = devm_thermal_zone_of_sensor_register(dev, 0,
-							      ns_thermal,
-							      &ns_thermal_ops);
-	if (IS_ERR(ns_thermal->tz)) {
-		iounmap(ns_thermal->pvtmon);
-		return PTR_ERR(ns_thermal->tz);
+	tz = devm_thermal_of_zone_register(dev, 0,
+					   pvtmon,
+					   &ns_thermal_ops);
+	if (IS_ERR(tz)) {
+		iounmap(pvtmon);
+		return PTR_ERR(tz);
 	}
 
-	platform_set_drvdata(pdev, ns_thermal);
+	platform_set_drvdata(pdev, pvtmon);
 
 	return 0;
 }
 
 static int ns_thermal_remove(struct platform_device *pdev)
 {
-	struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
+	void __iomem *pvtmon = platform_get_drvdata(pdev);
 
-	iounmap(ns_thermal->pvtmon);
+	iounmap(pvtmon);
 
 	return 0;
 }
diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/sr-thermal.c
index 85ab9edd580c..7c58eff407b3 100644
--- a/drivers/thermal/broadcom/sr-thermal.c
+++ b/drivers/thermal/broadcom/sr-thermal.c
@@ -19,7 +19,6 @@
 #define SR_TMON_MAX_LIST        6
 
 struct sr_tmon {
-	struct thermal_zone_device *tz;
 	unsigned int crit_temp;
 	unsigned int tmon_id;
 	struct sr_thermal *priv;
@@ -31,9 +30,9 @@ struct sr_thermal {
 	struct sr_tmon tmon[SR_TMON_MAX_LIST];
 };
 
-static int sr_get_temp(void *data, int *temp)
+static int sr_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct sr_tmon *tmon = data;
+	struct sr_tmon *tmon = tz->devdata;
 	struct sr_thermal *sr_thermal = tmon->priv;
 
 	*temp = readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id));
@@ -41,13 +40,14 @@ static int sr_get_temp(void *data, int *temp)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops sr_tz_ops = {
+static struct thermal_zone_device_ops sr_tz_ops = {
 	.get_temp = sr_get_temp,
 };
 
 static int sr_thermal_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct thermal_zone_device *tz;
 	struct sr_thermal *sr_thermal;
 	struct sr_tmon *tmon;
 	struct resource *res;
@@ -84,10 +84,10 @@ static int sr_thermal_probe(struct platform_device *pdev)
 		writel(0, sr_thermal->regs + SR_TMON_TEMP_BASE(i));
 		tmon->tmon_id = i;
 		tmon->priv = sr_thermal;
-		tmon->tz = devm_thermal_zone_of_sensor_register(dev, i, tmon,
-								&sr_tz_ops);
-		if (IS_ERR(tmon->tz))
-			return PTR_ERR(tmon->tz);
+		tz = devm_thermal_of_zone_register(dev, i, tmon,
+						   &sr_tz_ops);
+		if (IS_ERR(tz))
+			return PTR_ERR(tz);
 
 		dev_dbg(dev, "thermal sensor %d registered\n", i);
 	}
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 12/33] thermal/drivers/st: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (3 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 10/33] thermal/drivers/broadcom: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-10 21:24 ` [PATCH v1 16/33] thermal/drivers/imx: " Daniel Lezcano
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Maxime Coquelin, Alexandre Torgue,
	moderated list:ARM/STM32 ARCHITECTURE,
	moderated list:ARM/STM32 ARCHITECTURE

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/st/stm_thermal.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index 5fd3fb8912a6..e4ca0d504a4f 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -302,9 +302,9 @@ static int stm_disable_irq(struct stm_thermal_sensor *sensor)
 	return 0;
 }
 
-static int stm_thermal_set_trips(void *data, int low, int high)
+static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
 {
-	struct stm_thermal_sensor *sensor = data;
+	struct stm_thermal_sensor *sensor = tz->devdata;
 	u32 itr1, th;
 	int ret;
 
@@ -350,9 +350,9 @@ static int stm_thermal_set_trips(void *data, int low, int high)
 }
 
 /* Callback to get temperature from HW */
-static int stm_thermal_get_temp(void *data, int *temp)
+static int stm_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct stm_thermal_sensor *sensor = data;
+	struct stm_thermal_sensor *sensor = tz->devdata;
 	u32 periods;
 	int freqM, ret;
 
@@ -474,7 +474,7 @@ static int stm_thermal_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
 			 stm_thermal_suspend, stm_thermal_resume);
 
-static const struct thermal_zone_of_device_ops stm_tz_ops = {
+static const struct thermal_zone_device_ops stm_tz_ops = {
 	.get_temp	= stm_thermal_get_temp,
 	.set_trips	= stm_thermal_set_trips,
 };
@@ -539,9 +539,9 @@ static int stm_thermal_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	sensor->th_dev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0,
-							      sensor,
-							      &stm_tz_ops);
+	sensor->th_dev = devm_thermal_of_zone_register(&pdev->dev, 0,
+						       sensor,
+						       &stm_tz_ops);
 
 	if (IS_ERR(sensor->th_dev)) {
 		dev_err(&pdev->dev, "%s: thermal zone sensor registering KO\n",
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 16/33] thermal/drivers/imx: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (4 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 12/33] thermal/drivers/st: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-10 21:24 ` [PATCH v1 20/33] thermal/drivers/mtk: " Daniel Lezcano
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/imx8mm_thermal.c | 14 +++++++-------
 drivers/thermal/imx_sc_thermal.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index af666bd9e8d4..90992eddd442 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -96,15 +96,15 @@ static int imx8mp_tmu_get_temp(void *data, int *temp)
 	return 0;
 }
 
-static int tmu_get_temp(void *data, int *temp)
+static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct tmu_sensor *sensor = data;
+	struct tmu_sensor *sensor = tz->devdata;
 	struct imx8mm_tmu *tmu = sensor->priv;
 
-	return tmu->socdata->get_temp(data, temp);
+	return tmu->socdata->get_temp(sensor, temp);
 }
 
-static struct thermal_zone_of_device_ops tmu_tz_ops = {
+static struct thermal_zone_device_ops tmu_tz_ops = {
 	.get_temp = tmu_get_temp,
 };
 
@@ -165,9 +165,9 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 	for (i = 0; i < data->num_sensors; i++) {
 		tmu->sensors[i].priv = tmu;
 		tmu->sensors[i].tzd =
-			devm_thermal_zone_of_sensor_register(&pdev->dev, i,
-							     &tmu->sensors[i],
-							     &tmu_tz_ops);
+			devm_thermal_of_zone_register(&pdev->dev, i,
+						      &tmu->sensors[i],
+						      &tmu_tz_ops);
 		if (IS_ERR(tmu->sensors[i].tzd)) {
 			ret = PTR_ERR(tmu->sensors[i].tzd);
 			dev_err(&pdev->dev,
diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
index 331a241eb0ef..773d02b043be 100644
--- a/drivers/thermal/imx_sc_thermal.c
+++ b/drivers/thermal/imx_sc_thermal.c
@@ -43,11 +43,11 @@ struct imx_sc_msg_misc_get_temp {
 	} data;
 } __packed __aligned(4);
 
-static int imx_sc_thermal_get_temp(void *data, int *temp)
+static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct imx_sc_msg_misc_get_temp msg;
 	struct imx_sc_rpc_msg *hdr = &msg.hdr;
-	struct imx_sc_sensor *sensor = data;
+	struct imx_sc_sensor *sensor = tz->devdata;
 	int ret;
 
 	msg.data.req.resource_id = sensor->resource_id;
@@ -70,7 +70,7 @@ static int imx_sc_thermal_get_temp(void *data, int *temp)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops imx_sc_thermal_ops = {
+static struct thermal_zone_device_ops imx_sc_thermal_ops = {
 	.get_temp = imx_sc_thermal_get_temp,
 };
 
@@ -109,10 +109,10 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
 			break;
 		}
 
-		sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
-								   sensor->resource_id,
-								   sensor,
-								   &imx_sc_thermal_ops);
+		sensor->tzd = devm_thermal_of_zone_register(&pdev->dev,
+							    sensor->resource_id,
+							    sensor,
+							    &imx_sc_thermal_ops);
 		if (IS_ERR(sensor->tzd)) {
 			dev_err(&pdev->dev, "failed to register thermal zone\n");
 			ret = PTR_ERR(sensor->tzd);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 20/33] thermal/drivers/mtk: Switch to new of API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (5 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 16/33] thermal/drivers/imx: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-10 21:24 ` [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Daniel Lezcano
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Matthias Brugger, moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/mtk_thermal.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index ede94eadddda..1dfa6b058d9c 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -679,9 +679,9 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
 	return max;
 }
 
-static int mtk_read_temp(void *data, int *temperature)
+static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature)
 {
-	struct mtk_thermal *mt = data;
+	struct mtk_thermal *mt = tz->devdata;
 	int i;
 	int tempmax = INT_MIN;
 
@@ -700,7 +700,7 @@ static int mtk_read_temp(void *data, int *temperature)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops mtk_thermal_ops = {
+static struct thermal_zone_device_ops mtk_thermal_ops = {
 	.get_temp = mtk_read_temp,
 };
 
@@ -1082,8 +1082,8 @@ static int mtk_thermal_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, mt);
 
-	tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
-						     &mtk_thermal_ops);
+	tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,
+					      &mtk_thermal_ops);
 	if (IS_ERR(tzdev)) {
 		ret = PTR_ERR(tzdev);
 		goto err_disable_clk_peri_therm;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (6 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 20/33] thermal/drivers/mtk: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-10 23:18   ` Damien Le Moal
  2022-07-10 21:24 ` [PATCH v1 27/33] iio/drivers/sun4i_gpadc: " Daniel Lezcano
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Damien Le Moal, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team,
	open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/ata/ahci_imx.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 79aa9f285312..5ad9a890e71a 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio)
 }
 
 /* SATA AHCI temperature monitor */
-static int sata_ahci_read_temperature(void *dev, int *temp)
+static int __sata_ahci_read_temperature(void *dev, int *temp)
 {
 	u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum;
 	u32 str1, str2, str3, str4;
@@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *temp)
 	return 0;
 }
 
+static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
+{
+	return __sata_ahci_read_temperature(tz->devdata, temp);
+}
+
 static ssize_t sata_ahci_show_temp(struct device *dev,
 				   struct device_attribute *da,
 				   char *buf)
@@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev,
 	unsigned int temp = 0;
 	int err;
 
-	err = sata_ahci_read_temperature(dev, &temp);
+	err = __sata_ahci_read_temperature(dev, &temp);
 	if (err < 0)
 		return err;
 
 	return sprintf(buf, "%u\n", temp);
 }
 
-static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = {
+static struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = {
 	.get_temp = sata_ahci_read_temperature,
 };
 
@@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
 			ret = PTR_ERR(hwmon_dev);
 			goto disable_clk;
 		}
-		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
-					     &fsl_sata_ahci_of_thermal_ops);
+		devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev,
+					      &fsl_sata_ahci_of_thermal_ops);
 		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
 	}
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 27/33] iio/drivers/sun4i_gpadc: Switch to new of thermal API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (7 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-11  7:52   ` Lars-Peter Clausen
  2022-07-10 21:24 ` [PATCH v1 28/33] input/drivers/touchscreen_sun4i: " Daniel Lezcano
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland,
	open list:IIO SUBSYSTEM AND DRIVERS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/iio/adc/sun4i-gpadc-iio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 2d393a4dfff6..7aebfd337871 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -412,9 +412,9 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static int sun4i_gpadc_get_temp(void *data, int *temp)
+static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct sun4i_gpadc_iio *info = data;
+	struct sun4i_gpadc_iio *info = tz->devdata;
 	int val, scale, offset;
 
 	if (sun4i_gpadc_temp_read(info->indio_dev, &val))
@@ -428,7 +428,7 @@ static int sun4i_gpadc_get_temp(void *data, int *temp)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops = {
+static struct thermal_zone_device_ops sun4i_ts_tz_ops = {
 	.get_temp = &sun4i_gpadc_get_temp,
 };
 
@@ -637,9 +637,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	if (IS_ENABLED(CONFIG_THERMAL_OF)) {
-		info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
-							    0, info,
-							    &sun4i_ts_tz_ops);
+		info->tzd = thermal_of_zone_register(info->sensor_device,
+						     0, info,
+						     &sun4i_ts_tz_ops);
 		/*
 		 * Do not fail driver probing when failing to register in
 		 * thermal because no thermal DT node is found.
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 28/33] input/drivers/touchscreen_sun4i: Switch to new of thermal API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (8 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 27/33] iio/drivers/sun4i_gpadc: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-11  3:28   ` Dmitry Torokhov
  2022-07-10 21:24 ` [PATCH v1 30/33] thermal/drivers/bcm2835: " Daniel Lezcano
  2022-07-10 21:24 ` [PATCH v1 31/33] thermal/drivers/samsung: " Daniel Lezcano
  11 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Dmitry Torokhov, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/input/touchscreen/sun4i-ts.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index 742a7e96c1b5..7cee09504e34 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -192,12 +192,12 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
 	return 0;
 }
 
-static int sun4i_get_tz_temp(void *data, int *temp)
+static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp)
 {
-	return sun4i_get_temp(data, temp);
+	return sun4i_get_temp(tz->devdata, temp);
 }
 
-static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops = {
+static struct thermal_zone_device_ops sun4i_ts_tz_ops = {
 	.get_temp = sun4i_get_tz_temp,
 };
 
@@ -356,8 +356,8 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	if (IS_ERR(hwmon))
 		return PTR_ERR(hwmon);
 
-	thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts,
-						       &sun4i_ts_tz_ops);
+	thermal = devm_thermal_of_zone_register(ts->dev, 0, ts,
+						&sun4i_ts_tz_ops);
 	if (IS_ERR(thermal))
 		return PTR_ERR(thermal);
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 30/33] thermal/drivers/bcm2835: Switch to new of thermal API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (9 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 28/33] input/drivers/touchscreen_sun4i: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-11  2:40   ` Florian Fainelli
  2022-07-10 21:24 ` [PATCH v1 31/33] thermal/drivers/samsung: " Daniel Lezcano
  11 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/broadcom/bcm2835_thermal.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index c8e4344d5a3d..4a7c6270dfac 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -88,9 +88,9 @@ static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)
 	return temp;
 }
 
-static int bcm2835_thermal_get_temp(void *d, int *temp)
+static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct bcm2835_thermal_data *data = d;
+	struct bcm2835_thermal_data *data = tz->devdata;
 	u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT);
 
 	if (!(val & BCM2835_TS_TSENSSTAT_VALID))
@@ -135,7 +135,7 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev)
 	debugfs_create_regset32("regset", 0444, data->debugfsdir, regset);
 }
 
-static const struct thermal_zone_of_device_ops bcm2835_thermal_ops = {
+static struct thermal_zone_device_ops bcm2835_thermal_ops = {
 	.get_temp = bcm2835_thermal_get_temp,
 };
 
@@ -206,8 +206,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
 			 data->clk, rate);
 
 	/* register of thermal sensor and get info from DT */
-	tz = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
-					     &bcm2835_thermal_ops);
+	tz = devm_thermal_of_zone_register(&pdev->dev, 0, data,
+					   &bcm2835_thermal_ops);
 	if (IS_ERR(tz)) {
 		err = PTR_ERR(tz);
 		dev_err(&pdev->dev,
@@ -277,7 +277,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
 
 	return 0;
 err_tz:
-	thermal_zone_of_sensor_unregister(&pdev->dev, tz);
+	thermal_of_zone_unregister(tz);
 err_clk:
 	clk_disable_unprepare(data->clk);
 
@@ -290,7 +290,7 @@ static int bcm2835_thermal_remove(struct platform_device *pdev)
 	struct thermal_zone_device *tz = data->tz;
 
 	debugfs_remove_recursive(data->debugfsdir);
-	thermal_zone_of_sensor_unregister(&pdev->dev, tz);
+	thermal_of_zone_unregister(tz);
 	clk_disable_unprepare(data->clk);
 
 	return 0;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 31/33] thermal/drivers/samsung: Switch to new of thermal API
       [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
                   ` (10 preceding siblings ...)
  2022-07-10 21:24 ` [PATCH v1 30/33] thermal/drivers/bcm2835: " Daniel Lezcano
@ 2022-07-10 21:24 ` Daniel Lezcano
  2022-07-11 10:41   ` Krzysztof Kozlowski
  11 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-10 21:24 UTC (permalink / raw)
  To: daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Alim Akhtar,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES

The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach.

Use this new API.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/samsung/exynos_tmu.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index f4ab4c5b4b62..2bd7b3b57b28 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -650,9 +650,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
 	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
 }
 
-static int exynos_get_temp(void *p, int *temp)
+static int exynos_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-	struct exynos_tmu_data *data = p;
+	struct exynos_tmu_data *data = tz->devdata;
 	int value, ret = 0;
 
 	if (!data || !data->tmu_read)
@@ -728,9 +728,9 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
 	writel(val, data->base + emul_con);
 }
 
-static int exynos_tmu_set_emulation(void *drv_data, int temp)
+static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp)
 {
-	struct exynos_tmu_data *data = drv_data;
+	struct exynos_tmu_data *data = tz->devdata;
 	int ret = -EINVAL;
 
 	if (data->soc == SOC_ARCH_EXYNOS4210)
@@ -750,7 +750,7 @@ static int exynos_tmu_set_emulation(void *drv_data, int temp)
 }
 #else
 #define exynos4412_tmu_set_emulation NULL
-static int exynos_tmu_set_emulation(void *drv_data, int temp)
+static int exynos_tmu_set_emulation(struct thermal_zone *tz, int temp)
 	{ return -EINVAL; }
 #endif /* CONFIG_THERMAL_EMULATION */
 
@@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct thermal_zone_of_device_ops exynos_sensor_ops = {
+static struct thermal_zone_device_ops exynos_sensor_ops = {
 	.get_temp = exynos_get_temp,
 	.set_emul_temp = exynos_tmu_set_emulation,
 };
@@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 	 * data->tzd must be registered before calling exynos_tmu_initialize(),
 	 * requesting irq and calling exynos_tmu_control().
 	 */
-	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
-						    &exynos_sensor_ops);
+	data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data,
+						  &exynos_sensor_ops);
 	if (IS_ERR(data->tzd)) {
 		ret = PTR_ERR(data->tzd);
 		if (ret != -EPROBE_DEFER)
@@ -1118,7 +1118,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 	return 0;
 
 err_thermal:
-	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
+	thermal_of_zone_unregister(data->tzd);
 err_sclk:
 	clk_disable_unprepare(data->sclk);
 err_clk:
@@ -1138,7 +1138,7 @@ static int exynos_tmu_remove(struct platform_device *pdev)
 	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
 	struct thermal_zone_device *tzd = data->tzd;
 
-	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
+	thermal_of_zone_unregister(tzd);
 	exynos_tmu_control(pdev, false);
 
 	clk_disable_unprepare(data->sclk);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API
  2022-07-10 21:24 ` [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Daniel Lezcano
@ 2022-07-10 23:18   ` Damien Le Moal
  2022-07-11  9:14     ` Daniel Lezcano
  0 siblings, 1 reply; 20+ messages in thread
From: Damien Le Moal @ 2022-07-10 23:18 UTC (permalink / raw)
  To: Daniel Lezcano, daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team,
	open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On 7/11/22 06:24, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
> 
> Use this new API.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> ---
>  drivers/ata/ahci_imx.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
> index 79aa9f285312..5ad9a890e71a 100644
> --- a/drivers/ata/ahci_imx.c
> +++ b/drivers/ata/ahci_imx.c
> @@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio)
>  }
>  
>  /* SATA AHCI temperature monitor */
> -static int sata_ahci_read_temperature(void *dev, int *temp)
> +static int __sata_ahci_read_temperature(void *dev, int *temp)
>  {
>  	u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum;
>  	u32 str1, str2, str3, str4;
> @@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *temp)
>  	return 0;
>  }
>  
> +static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
> +{
> +	return __sata_ahci_read_temperature(tz->devdata, temp);
> +}
> +
>  static ssize_t sata_ahci_show_temp(struct device *dev,
>  				   struct device_attribute *da,
>  				   char *buf)
> @@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev,
>  	unsigned int temp = 0;
>  	int err;
>  
> -	err = sata_ahci_read_temperature(dev, &temp);
> +	err = __sata_ahci_read_temperature(dev, &temp);
>  	if (err < 0)
>  		return err;
>  
>  	return sprintf(buf, "%u\n", temp);
>  }

I do not see why the above changes are necessary. Please explain.

>  
> -static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = {
> +static struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = {

Why remove the const ?

>  	.get_temp = sata_ahci_read_temperature,
>  };
>  
> @@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
>  			ret = PTR_ERR(hwmon_dev);
>  			goto disable_clk;
>  		}
> -		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
> -					     &fsl_sata_ahci_of_thermal_ops);
> +		devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev,
> +					      &fsl_sata_ahci_of_thermal_ops);

This is the only change that seems necessary.

>  		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
>  	}
>  

And it is hard to review a patch without the full series for context.
Please send all patches next time.


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 10/33] thermal/drivers/broadcom: Switch to new of API
  2022-07-10 21:24 ` [PATCH v1 10/33] thermal/drivers/broadcom: " Daniel Lezcano
@ 2022-07-11  2:37   ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2022-07-11  2:37 UTC (permalink / raw)
  To: Daniel Lezcano, daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Florian Fainelli, Broadcom internal kernel review list,
	Markus Mayer, Stefan Wahren, Zheng Yongjun,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE



On 7/10/2022 2:24 PM, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
> 
> Use this new API.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> ---
>   drivers/thermal/broadcom/bcm2711_thermal.c | 14 +++---
>   drivers/thermal/broadcom/brcmstb_thermal.c | 20 ++++-----

For these two above:

Tested-by: Florian Fainelli <f.fainelli@gmail.com>

and for the whole patch:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Any chance we can keep the struct thermal_zone_device_ops const though?
--
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 30/33] thermal/drivers/bcm2835: Switch to new of thermal API
  2022-07-10 21:24 ` [PATCH v1 30/33] thermal/drivers/bcm2835: " Daniel Lezcano
@ 2022-07-11  2:40   ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2022-07-11  2:40 UTC (permalink / raw)
  To: Daniel Lezcano, daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE



On 7/10/2022 2:24 PM, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
> 
> Use this new API.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 28/33] input/drivers/touchscreen_sun4i: Switch to new of thermal API
  2022-07-10 21:24 ` [PATCH v1 28/33] input/drivers/touchscreen_sun4i: " Daniel Lezcano
@ 2022-07-11  3:28   ` Dmitry Torokhov
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2022-07-11  3:28 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: daniel.lezcano, rafael, rui.zhang, khilman, abailon, amitk,
	linux-kernel, linux-pm, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland,
	open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support

Hi Daniel,

On Sun, Jul 10, 2022 at 11:24:18PM +0200, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
> 
> Use this new API.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>

I assume you want to take this through thermal tree if you get everyone
to agree. I am OK with it, but please use "Input: <driver> - <subject>"
format for input patches, i.e.

	Input: sun4i-ts - switch to new OF thermal API

Otherwise:

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

-- 
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 27/33] iio/drivers/sun4i_gpadc: Switch to new of thermal API
  2022-07-10 21:24 ` [PATCH v1 27/33] iio/drivers/sun4i_gpadc: " Daniel Lezcano
@ 2022-07-11  7:52   ` Lars-Peter Clausen
  0 siblings, 0 replies; 20+ messages in thread
From: Lars-Peter Clausen @ 2022-07-11  7:52 UTC (permalink / raw)
  To: Daniel Lezcano, daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Jonathan Cameron, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	open list:IIO SUBSYSTEM AND DRIVERS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support

On 7/10/22 23:24, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
>
> Use this new API.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> ---
>   drivers/iio/adc/sun4i-gpadc-iio.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
> index 2d393a4dfff6..7aebfd337871 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -412,9 +412,9 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
>   	return 0;
>   }
>   
> -static int sun4i_gpadc_get_temp(void *data, int *temp)
> +static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
>   {
> -	struct sun4i_gpadc_iio *info = data;
> +	struct sun4i_gpadc_iio *info = tz->devdata;
>   	int val, scale, offset;
>   
>   	if (sun4i_gpadc_temp_read(info->indio_dev, &val))
> @@ -428,7 +428,7 @@ static int sun4i_gpadc_get_temp(void *data, int *temp)
>   	return 0;
>   }
>   
> -static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops = {
> +static struct thermal_zone_device_ops sun4i_ts_tz_ops = {
>   	.get_temp = &sun4i_gpadc_get_temp,
>   };
Why is the const removed? If the framework modifies the structure you 
need a per device copy of the struct.
>   
> @@ -637,9 +637,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
>   	pm_runtime_enable(&pdev->dev);
>   
>   	if (IS_ENABLED(CONFIG_THERMAL_OF)) {
> -		info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
> -							    0, info,
> -							    &sun4i_ts_tz_ops);
> +		info->tzd = thermal_of_zone_register(info->sensor_device,
> +						     0, info,
> +						     &sun4i_ts_tz_ops);
>   		/*
>   		 * Do not fail driver probing when failing to register in
>   		 * thermal because no thermal DT node is found.



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API
  2022-07-10 23:18   ` Damien Le Moal
@ 2022-07-11  9:14     ` Daniel Lezcano
  2022-07-11 10:37       ` Damien Le Moal
  0 siblings, 1 reply; 20+ messages in thread
From: Daniel Lezcano @ 2022-07-11  9:14 UTC (permalink / raw)
  To: Damien Le Moal, Daniel Lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team,
	open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On 11/07/2022 01:18, Damien Le Moal wrote:
> On 7/11/22 06:24, Daniel Lezcano wrote:
>> The thermal OF code has a new API allowing to migrate the OF
>> initialization to a simpler approach.
>>
>> Use this new API.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
>> ---
>>   drivers/ata/ahci_imx.c | 15 ++++++++++-----
>>   1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
>> index 79aa9f285312..5ad9a890e71a 100644
>> --- a/drivers/ata/ahci_imx.c
>> +++ b/drivers/ata/ahci_imx.c
>> @@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio)
>>   }
>>   
>>   /* SATA AHCI temperature monitor */
>> -static int sata_ahci_read_temperature(void *dev, int *temp)
>> +static int __sata_ahci_read_temperature(void *dev, int *temp)
>>   {
>>   	u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum;
>>   	u32 str1, str2, str3, str4;
>> @@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *temp)
>>   	return 0;
>>   }
>>   
>> +static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
>> +{
>> +	return __sata_ahci_read_temperature(tz->devdata, temp);
>> +}
>> +
>>   static ssize_t sata_ahci_show_temp(struct device *dev,
>>   				   struct device_attribute *da,
>>   				   char *buf)
>> @@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev,
>>   	unsigned int temp = 0;
>>   	int err;
>>   
>> -	err = sata_ahci_read_temperature(dev, &temp);
>> +	err = __sata_ahci_read_temperature(dev, &temp);
>>   	if (err < 0)
>>   		return err;
>>   
>>   	return sprintf(buf, "%u\n", temp);
>>   }
> 
> I do not see why the above changes are necessary. Please explain.

sata_ahci_read_temperature() is used by sata_ahci_show_temp() also.

So in order to change the function prototype for the get_temp ops which 
does not take a void* but a thermal_zone_device* structure, this 
function wraps the call.

Do you prefer sata_ahci_read_temperature() becomes sata_ahci_get_temp() 
and keep __sata_ahci_read_temperature() name untouched ?

>>   
>> -static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = {
>> +static struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = {
> 
> Why remove the const ?
> 
>>   	.get_temp = sata_ahci_read_temperature,
>>   };
>>   
>> @@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
>>   			ret = PTR_ERR(hwmon_dev);
>>   			goto disable_clk;
>>   		}
>> -		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
>> -					     &fsl_sata_ahci_of_thermal_ops);
>> +		devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev,
>> +					      &fsl_sata_ahci_of_thermal_ops);
> 
> This is the only change that seems necessary.
> 
>>   		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
>>   	}
>>   
> 
> And it is hard to review a patch without the full series for context.
> Please send all patches next time.
> 
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API
  2022-07-11  9:14     ` Daniel Lezcano
@ 2022-07-11 10:37       ` Damien Le Moal
  0 siblings, 0 replies; 20+ messages in thread
From: Damien Le Moal @ 2022-07-11 10:37 UTC (permalink / raw)
  To: Daniel Lezcano, Daniel Lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team,
	open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On 7/11/22 18:14, Daniel Lezcano wrote:
> On 11/07/2022 01:18, Damien Le Moal wrote:
>> On 7/11/22 06:24, Daniel Lezcano wrote:
>>> The thermal OF code has a new API allowing to migrate the OF
>>> initialization to a simpler approach.
>>>
>>> Use this new API.
>>>
>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
>>> ---
>>>   drivers/ata/ahci_imx.c | 15 ++++++++++-----
>>>   1 file changed, 10 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
>>> index 79aa9f285312..5ad9a890e71a 100644
>>> --- a/drivers/ata/ahci_imx.c
>>> +++ b/drivers/ata/ahci_imx.c
>>> @@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio)
>>>   }
>>>   
>>>   /* SATA AHCI temperature monitor */
>>> -static int sata_ahci_read_temperature(void *dev, int *temp)
>>> +static int __sata_ahci_read_temperature(void *dev, int *temp)
>>>   {
>>>   	u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum;
>>>   	u32 str1, str2, str3, str4;
>>> @@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *temp)
>>>   	return 0;
>>>   }
>>>   
>>> +static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
>>> +{
>>> +	return __sata_ahci_read_temperature(tz->devdata, temp);
>>> +}
>>> +
>>>   static ssize_t sata_ahci_show_temp(struct device *dev,
>>>   				   struct device_attribute *da,
>>>   				   char *buf)
>>> @@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev,
>>>   	unsigned int temp = 0;
>>>   	int err;
>>>   
>>> -	err = sata_ahci_read_temperature(dev, &temp);
>>> +	err = __sata_ahci_read_temperature(dev, &temp);
>>>   	if (err < 0)
>>>   		return err;
>>>   
>>>   	return sprintf(buf, "%u\n", temp);
>>>   }
>>
>> I do not see why the above changes are necessary. Please explain.
> 
> sata_ahci_read_temperature() is used by sata_ahci_show_temp() also.
> 
> So in order to change the function prototype for the get_temp ops which 
> does not take a void* but a thermal_zone_device* structure, this 
> function wraps the call.
> 
> Do you prefer sata_ahci_read_temperature() becomes sata_ahci_get_temp() 
> and keep __sata_ahci_read_temperature() name untouched ?

Understood. You can keep the name changes you have, but please add this
explanation to the commit message.

> 
>>>   
>>> -static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = {
>>> +static struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = {
>>
>> Why remove the const ?
>>
>>>   	.get_temp = sata_ahci_read_temperature,
>>>   };
>>>   
>>> @@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
>>>   			ret = PTR_ERR(hwmon_dev);
>>>   			goto disable_clk;
>>>   		}
>>> -		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
>>> -					     &fsl_sata_ahci_of_thermal_ops);
>>> +		devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev,
>>> +					      &fsl_sata_ahci_of_thermal_ops);
>>
>> This is the only change that seems necessary.
>>
>>>   		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
>>>   	}
>>>   
>>
>> And it is hard to review a patch without the full series for context.
>> Please send all patches next time.
>>
>>
> 
> 


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 31/33] thermal/drivers/samsung: Switch to new of thermal API
  2022-07-10 21:24 ` [PATCH v1 31/33] thermal/drivers/samsung: " Daniel Lezcano
@ 2022-07-11 10:41   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-11 10:41 UTC (permalink / raw)
  To: Daniel Lezcano, daniel.lezcano, rafael
  Cc: rui.zhang, khilman, abailon, amitk, linux-kernel, linux-pm,
	Bartlomiej Zolnierkiewicz, Alim Akhtar,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES

On 10/07/2022 23:24, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
> 
> Use this new API.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index f4ab4c5b4b62..2bd7b3b57b28 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -650,9 +650,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
>  	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
>  }
>  
> -static int exynos_get_temp(void *p, int *temp)
> +static int exynos_get_temp(struct thermal_zone_device *tz, int *temp)
>  {
> -	struct exynos_tmu_data *data = p;
> +	struct exynos_tmu_data *data = tz->devdata;
>  	int value, ret = 0;
>  
>  	if (!data || !data->tmu_read)
> @@ -728,9 +728,9 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
>  	writel(val, data->base + emul_con);
>  }
>  
> -static int exynos_tmu_set_emulation(void *drv_data, int temp)
> +static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp)
>  {
> -	struct exynos_tmu_data *data = drv_data;
> +	struct exynos_tmu_data *data = tz->devdata;
>  	int ret = -EINVAL;
>  
>  	if (data->soc == SOC_ARCH_EXYNOS4210)
> @@ -750,7 +750,7 @@ static int exynos_tmu_set_emulation(void *drv_data, int temp)
>  }
>  #else
>  #define exynos4412_tmu_set_emulation NULL
> -static int exynos_tmu_set_emulation(void *drv_data, int temp)
> +static int exynos_tmu_set_emulation(struct thermal_zone *tz, int temp)
>  	{ return -EINVAL; }
>  #endif /* CONFIG_THERMAL_EMULATION */
>  
> @@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct thermal_zone_of_device_ops exynos_sensor_ops = {
> +static struct thermal_zone_device_ops exynos_sensor_ops = {
>  	.get_temp = exynos_get_temp,
>  	.set_emul_temp = exynos_tmu_set_emulation,
>  };
> @@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	 * data->tzd must be registered before calling exynos_tmu_initialize(),
>  	 * requesting irq and calling exynos_tmu_control().
>  	 */
> -	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> -						    &exynos_sensor_ops);
> +	data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data,
> +						  &exynos_sensor_ops);
>  	if (IS_ERR(data->tzd)) {
>  		ret = PTR_ERR(data->tzd);
>  		if (ret != -EPROBE_DEFER)
> @@ -1118,7 +1118,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_thermal:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
> +	thermal_of_zone_unregister(data->tzd);

You use now devm, so this should not be needed.

>  err_sclk:
>  	clk_disable_unprepare(data->sclk);
>  err_clk:
> @@ -1138,7 +1138,7 @@ static int exynos_tmu_remove(struct platform_device *pdev)
>  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
>  	struct thermal_zone_device *tzd = data->tzd;
>  
> -	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
> +	thermal_of_zone_unregister(tzd);

This as well.



Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-07-11 10:43 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
2022-07-10 21:23 ` [PATCH v1 03/33] thermal/drivers/rockchip: Switch to new of API Daniel Lezcano
2022-07-10 21:23 ` [PATCH v1 04/33] thermal/drivers/uniphier: " Daniel Lezcano
2022-07-10 21:23 ` [PATCH v1 08/33] thermal/drivers/sun8i: " Daniel Lezcano
2022-07-10 21:24 ` [PATCH v1 10/33] thermal/drivers/broadcom: " Daniel Lezcano
2022-07-11  2:37   ` Florian Fainelli
2022-07-10 21:24 ` [PATCH v1 12/33] thermal/drivers/st: " Daniel Lezcano
2022-07-10 21:24 ` [PATCH v1 16/33] thermal/drivers/imx: " Daniel Lezcano
2022-07-10 21:24 ` [PATCH v1 20/33] thermal/drivers/mtk: " Daniel Lezcano
2022-07-10 21:24 ` [PATCH v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Daniel Lezcano
2022-07-10 23:18   ` Damien Le Moal
2022-07-11  9:14     ` Daniel Lezcano
2022-07-11 10:37       ` Damien Le Moal
2022-07-10 21:24 ` [PATCH v1 27/33] iio/drivers/sun4i_gpadc: " Daniel Lezcano
2022-07-11  7:52   ` Lars-Peter Clausen
2022-07-10 21:24 ` [PATCH v1 28/33] input/drivers/touchscreen_sun4i: " Daniel Lezcano
2022-07-11  3:28   ` Dmitry Torokhov
2022-07-10 21:24 ` [PATCH v1 30/33] thermal/drivers/bcm2835: " Daniel Lezcano
2022-07-11  2:40   ` Florian Fainelli
2022-07-10 21:24 ` [PATCH v1 31/33] thermal/drivers/samsung: " Daniel Lezcano
2022-07-11 10:41   ` Krzysztof Kozlowski

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).