linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] thermal: simplify getting .driver_data
@ 2018-10-21 20:00 Wolfram Sang
  2018-10-21 20:00 ` [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: " Wolfram Sang
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, linux-arm-kernel, linux-pm,
	linux-rockchip

I got tired of fixing this in Renesas drivers manually, so I took the big
hammer. Remove this cumbersome code pattern which got copy-pasted too much
already:

-	struct platform_device *pdev = to_platform_device(dev);
-	struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+	struct ep93xx_keypad *keypad = dev_get_drvdata(dev);

A branch, tested by buildbot, can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/get_drvdata

I have been asked if it couldn't be done for dev_set_drvdata as well. I checked
it and did not find one occasion where it could be simplified like this. Not
much of a surprise because driver_data is usually set in probe() functions
which access struct platform_device in many other ways.

I am open for other comments, suggestions, too, of course.

Here is the cocci-script I created:

@@
struct device* d;
identifier pdev;
expression *ptr;
@@
(
-	struct platform_device *pdev = to_platform_device(d);
|
-	struct platform_device *pdev;
	...
-	pdev = to_platform_device(d);
)
	<... when != pdev
-	&pdev->dev
+	d
	...>

	ptr =
-	platform_get_drvdata(pdev)
+	dev_get_drvdata(d)

	<... when != pdev
-	&pdev->dev
+	d
	...>

Kind regards,

   Wolfram


Wolfram Sang (5):
  thermal: int340x_thermal: int3400_thermal: simplify getting
    .driver_data
  thermal: rockchip_thermal: simplify getting .driver_data
  thermal: spear_thermal: simplify getting .driver_data
  thermal: st: st_thermal: simplify getting .driver_data
  thermal: zx2967_thermal: simplify getting .driver_data

 drivers/thermal/int340x_thermal/int3400_thermal.c | 9 +++------
 drivers/thermal/rockchip_thermal.c                | 8 +++-----
 drivers/thermal/spear_thermal.c                   | 8 +++-----
 drivers/thermal/st/st_thermal.c                   | 6 ++----
 drivers/thermal/zx2967_thermal.c                  | 6 ++----
 5 files changed, 13 insertions(+), 24 deletions(-)

-- 
2.19.0


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

* [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] thermal: simplify getting .driver_data Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-11-05 15:04   ` Daniel Lezcano
  2018-10-21 20:00 ` [PATCH 2/5] thermal: rockchip_thermal: " Wolfram Sang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Zhang Rui, Eduardo Valentin,
	Daniel Lezcano, linux-pm

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. buildbot is happy.

 drivers/thermal/int340x_thermal/int3400_thermal.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c
index e26b01c05e82..61ca7ce3624e 100644
--- a/drivers/thermal/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
@@ -48,8 +48,7 @@ static ssize_t available_uuids_show(struct device *dev,
 				    struct device_attribute *attr,
 				    char *buf)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
+	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
 	int i;
 	int length = 0;
 
@@ -68,8 +67,7 @@ static ssize_t available_uuids_show(struct device *dev,
 static ssize_t current_uuid_show(struct device *dev,
 				 struct device_attribute *devattr, char *buf)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
+	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
 
 	if (priv->uuid_bitmap & (1 << priv->current_uuid_index))
 		return sprintf(buf, "%s\n",
@@ -82,8 +80,7 @@ static ssize_t current_uuid_store(struct device *dev,
 				  struct device_attribute *attr,
 				  const char *buf, size_t count)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
+	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
 	int i;
 
 	for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) {
-- 
2.19.0


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

* [PATCH 2/5] thermal: rockchip_thermal: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] thermal: simplify getting .driver_data Wolfram Sang
  2018-10-21 20:00 ` [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-11-02 12:25   ` Heiko Stuebner
  2018-11-05 15:05   ` Daniel Lezcano
  2018-10-21 20:00 ` [PATCH 3/5] thermal: spear_thermal: " Wolfram Sang
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Zhang Rui, Eduardo Valentin,
	Daniel Lezcano, Heiko Stuebner, linux-pm, linux-arm-kernel,
	linux-rockchip

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. buildbot is happy.

 drivers/thermal/rockchip_thermal.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index f36375d5a16c..9c7643d62ed7 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1327,8 +1327,7 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
 
 static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
+	struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
 	int i;
 
 	for (i = 0; i < thermal->chip->chn_num; i++)
@@ -1346,8 +1345,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
 
 static int __maybe_unused rockchip_thermal_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
+	struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
 	int i;
 	int error;
 
@@ -1376,7 +1374,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
 					      id, thermal->regs,
 					      thermal->tshut_temp);
 		if (error)
-			dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
+			dev_err(dev, "%s: invalid tshut=%d, error=%d\n",
 				__func__, thermal->tshut_temp, error);
 	}
 
-- 
2.19.0


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

* [PATCH 3/5] thermal: spear_thermal: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] thermal: simplify getting .driver_data Wolfram Sang
  2018-10-21 20:00 ` [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: " Wolfram Sang
  2018-10-21 20:00 ` [PATCH 2/5] thermal: rockchip_thermal: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-11-05 15:06   ` Daniel Lezcano
  2018-10-21 20:00 ` [PATCH 4/5] thermal: st: st_thermal: " Wolfram Sang
  2018-10-21 20:00 ` [PATCH 5/5] thermal: zx2967_thermal: " Wolfram Sang
  4 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Zhang Rui, Eduardo Valentin,
	Daniel Lezcano, linux-pm

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. buildbot is happy.

 drivers/thermal/spear_thermal.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index 81b35aace9de..8b9d567134d0 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -56,8 +56,7 @@ static struct thermal_zone_device_ops ops = {
 
 static int __maybe_unused spear_thermal_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
+	struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
 	struct spear_thermal_dev *stdev = spear_thermal->devdata;
 	unsigned int actual_mask = 0;
 
@@ -73,15 +72,14 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
 
 static int __maybe_unused spear_thermal_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
+	struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
 	struct spear_thermal_dev *stdev = spear_thermal->devdata;
 	unsigned int actual_mask = 0;
 	int ret = 0;
 
 	ret = clk_enable(stdev->clk);
 	if (ret) {
-		dev_err(&pdev->dev, "Can't enable clock\n");
+		dev_err(dev, "Can't enable clock\n");
 		return ret;
 	}
 
-- 
2.19.0


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

* [PATCH 4/5] thermal: st: st_thermal: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] thermal: simplify getting .driver_data Wolfram Sang
                   ` (2 preceding siblings ...)
  2018-10-21 20:00 ` [PATCH 3/5] thermal: spear_thermal: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-11-05 15:06   ` Daniel Lezcano
  2018-10-21 20:00 ` [PATCH 5/5] thermal: zx2967_thermal: " Wolfram Sang
  4 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Zhang Rui, Eduardo Valentin,
	Daniel Lezcano, linux-pm

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. buildbot is happy.

 drivers/thermal/st/st_thermal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
index be637e6b01d2..b2bbdf6eb02b 100644
--- a/drivers/thermal/st/st_thermal.c
+++ b/drivers/thermal/st/st_thermal.c
@@ -277,8 +277,7 @@ EXPORT_SYMBOL_GPL(st_thermal_unregister);
 #ifdef CONFIG_PM_SLEEP
 static int st_thermal_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
+	struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
 
 	return st_thermal_sensor_off(sensor);
 }
@@ -286,8 +285,7 @@ static int st_thermal_suspend(struct device *dev)
 static int st_thermal_resume(struct device *dev)
 {
 	int ret;
-	struct platform_device *pdev = to_platform_device(dev);
-	struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
+	struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
 
 	ret = st_thermal_sensor_on(sensor);
 	if (ret)
-- 
2.19.0


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

* [PATCH 5/5] thermal: zx2967_thermal: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] thermal: simplify getting .driver_data Wolfram Sang
                   ` (3 preceding siblings ...)
  2018-10-21 20:00 ` [PATCH 4/5] thermal: st: st_thermal: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-10-22  1:12   ` Shawn Guo
  2018-11-05 15:07   ` Daniel Lezcano
  4 siblings, 2 replies; 13+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Jun Nie, Shawn Guo, Zhang Rui,
	Eduardo Valentin, Daniel Lezcano, linux-arm-kernel, linux-pm

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. buildbot is happy.

 drivers/thermal/zx2967_thermal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c
index 6acce0bce7c0..145ebf371598 100644
--- a/drivers/thermal/zx2967_thermal.c
+++ b/drivers/thermal/zx2967_thermal.c
@@ -207,8 +207,7 @@ MODULE_DEVICE_TABLE(of, zx2967_thermal_id_table);
 #ifdef CONFIG_PM_SLEEP
 static int zx2967_thermal_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev);
+	struct zx2967_thermal_priv *priv = dev_get_drvdata(dev);
 
 	if (priv && priv->clk_topcrm)
 		clk_disable_unprepare(priv->clk_topcrm);
@@ -221,8 +220,7 @@ static int zx2967_thermal_suspend(struct device *dev)
 
 static int zx2967_thermal_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev);
+	struct zx2967_thermal_priv *priv = dev_get_drvdata(dev);
 	int error;
 
 	error = clk_prepare_enable(priv->clk_topcrm);
-- 
2.19.0


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

* Re: [PATCH 5/5] thermal: zx2967_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 5/5] thermal: zx2967_thermal: " Wolfram Sang
@ 2018-10-22  1:12   ` Shawn Guo
  2018-11-05 15:07   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Shawn Guo @ 2018-10-22  1:12 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Jun Nie, Zhang Rui,
	Eduardo Valentin, Daniel Lezcano, linux-arm-kernel, linux-pm

On Sun, Oct 21, 2018 at 10:00:52PM +0200, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Shawn Guo <shawnguo@kernel.org>

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

* Re: [PATCH 2/5] thermal: rockchip_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 2/5] thermal: rockchip_thermal: " Wolfram Sang
@ 2018-11-02 12:25   ` Heiko Stuebner
  2018-11-05 15:05   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2018-11-02 12:25 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Zhang Rui, Eduardo Valentin,
	Daniel Lezcano, linux-pm, linux-arm-kernel, linux-rockchip

Am Sonntag, 21. Oktober 2018, 22:00:49 CET schrieb Wolfram Sang:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>




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

* Re: [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: " Wolfram Sang
@ 2018-11-05 15:04   ` Daniel Lezcano
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Lezcano @ 2018-11-05 15:04 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel
  Cc: linux-renesas-soc, Zhang Rui, Eduardo Valentin, linux-pm

On 21/10/2018 22:00, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>


> 
> Build tested only. buildbot is happy.
> 
>  drivers/thermal/int340x_thermal/int3400_thermal.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c
> index e26b01c05e82..61ca7ce3624e 100644
> --- a/drivers/thermal/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
> @@ -48,8 +48,7 @@ static ssize_t available_uuids_show(struct device *dev,
>  				    struct device_attribute *attr,
>  				    char *buf)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
> +	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
>  	int i;
>  	int length = 0;
>  
> @@ -68,8 +67,7 @@ static ssize_t available_uuids_show(struct device *dev,
>  static ssize_t current_uuid_show(struct device *dev,
>  				 struct device_attribute *devattr, char *buf)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
> +	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
>  
>  	if (priv->uuid_bitmap & (1 << priv->current_uuid_index))
>  		return sprintf(buf, "%s\n",
> @@ -82,8 +80,7 @@ static ssize_t current_uuid_store(struct device *dev,
>  				  struct device_attribute *attr,
>  				  const char *buf, size_t count)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
> +	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
>  	int i;
>  
>  	for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) {
> 


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


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

* Re: [PATCH 2/5] thermal: rockchip_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 2/5] thermal: rockchip_thermal: " Wolfram Sang
  2018-11-02 12:25   ` Heiko Stuebner
@ 2018-11-05 15:05   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Daniel Lezcano @ 2018-11-05 15:05 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel
  Cc: linux-renesas-soc, Zhang Rui, Eduardo Valentin, Heiko Stuebner,
	linux-pm, linux-arm-kernel, linux-rockchip

On 21/10/2018 22:00, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/thermal/rockchip_thermal.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index f36375d5a16c..9c7643d62ed7 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -1327,8 +1327,7 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
>  
>  static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
> +	struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
>  	int i;
>  
>  	for (i = 0; i < thermal->chip->chn_num; i++)
> @@ -1346,8 +1345,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
>  
>  static int __maybe_unused rockchip_thermal_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
> +	struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
>  	int i;
>  	int error;
>  
> @@ -1376,7 +1374,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
>  					      id, thermal->regs,
>  					      thermal->tshut_temp);
>  		if (error)
> -			dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
> +			dev_err(dev, "%s: invalid tshut=%d, error=%d\n",
>  				__func__, thermal->tshut_temp, error);
>  	}
>  
> 


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


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

* Re: [PATCH 3/5] thermal: spear_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 3/5] thermal: spear_thermal: " Wolfram Sang
@ 2018-11-05 15:06   ` Daniel Lezcano
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Lezcano @ 2018-11-05 15:06 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel
  Cc: linux-renesas-soc, Zhang Rui, Eduardo Valentin, linux-pm

On 21/10/2018 22:00, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/thermal/spear_thermal.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
> index 81b35aace9de..8b9d567134d0 100644
> --- a/drivers/thermal/spear_thermal.c
> +++ b/drivers/thermal/spear_thermal.c
> @@ -56,8 +56,7 @@ static struct thermal_zone_device_ops ops = {
>  
>  static int __maybe_unused spear_thermal_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
> +	struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
>  	struct spear_thermal_dev *stdev = spear_thermal->devdata;
>  	unsigned int actual_mask = 0;
>  
> @@ -73,15 +72,14 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
>  
>  static int __maybe_unused spear_thermal_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
> +	struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
>  	struct spear_thermal_dev *stdev = spear_thermal->devdata;
>  	unsigned int actual_mask = 0;
>  	int ret = 0;
>  
>  	ret = clk_enable(stdev->clk);
>  	if (ret) {
> -		dev_err(&pdev->dev, "Can't enable clock\n");
> +		dev_err(dev, "Can't enable clock\n");
>  		return ret;
>  	}
>  
> 


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


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

* Re: [PATCH 4/5] thermal: st: st_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 4/5] thermal: st: st_thermal: " Wolfram Sang
@ 2018-11-05 15:06   ` Daniel Lezcano
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Lezcano @ 2018-11-05 15:06 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel
  Cc: linux-renesas-soc, Zhang Rui, Eduardo Valentin, linux-pm

On 21/10/2018 22:00, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/thermal/st/st_thermal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
> index be637e6b01d2..b2bbdf6eb02b 100644
> --- a/drivers/thermal/st/st_thermal.c
> +++ b/drivers/thermal/st/st_thermal.c
> @@ -277,8 +277,7 @@ EXPORT_SYMBOL_GPL(st_thermal_unregister);
>  #ifdef CONFIG_PM_SLEEP
>  static int st_thermal_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
> +	struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
>  
>  	return st_thermal_sensor_off(sensor);
>  }
> @@ -286,8 +285,7 @@ static int st_thermal_suspend(struct device *dev)
>  static int st_thermal_resume(struct device *dev)
>  {
>  	int ret;
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
> +	struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
>  
>  	ret = st_thermal_sensor_on(sensor);
>  	if (ret)
> 


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


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

* Re: [PATCH 5/5] thermal: zx2967_thermal: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 5/5] thermal: zx2967_thermal: " Wolfram Sang
  2018-10-22  1:12   ` Shawn Guo
@ 2018-11-05 15:07   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Daniel Lezcano @ 2018-11-05 15:07 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel
  Cc: linux-renesas-soc, Jun Nie, Shawn Guo, Zhang Rui,
	Eduardo Valentin, linux-arm-kernel, linux-pm

On 21/10/2018 22:00, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/thermal/zx2967_thermal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c
> index 6acce0bce7c0..145ebf371598 100644
> --- a/drivers/thermal/zx2967_thermal.c
> +++ b/drivers/thermal/zx2967_thermal.c
> @@ -207,8 +207,7 @@ MODULE_DEVICE_TABLE(of, zx2967_thermal_id_table);
>  #ifdef CONFIG_PM_SLEEP
>  static int zx2967_thermal_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev);
> +	struct zx2967_thermal_priv *priv = dev_get_drvdata(dev);
>  
>  	if (priv && priv->clk_topcrm)
>  		clk_disable_unprepare(priv->clk_topcrm);
> @@ -221,8 +220,7 @@ static int zx2967_thermal_suspend(struct device *dev)
>  
>  static int zx2967_thermal_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev);
> +	struct zx2967_thermal_priv *priv = dev_get_drvdata(dev);
>  	int error;
>  
>  	error = clk_prepare_enable(priv->clk_topcrm);
> 


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


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

end of thread, other threads:[~2018-11-05 15:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-21 20:00 [PATCH 0/5] thermal: simplify getting .driver_data Wolfram Sang
2018-10-21 20:00 ` [PATCH 1/5] thermal: int340x_thermal: int3400_thermal: " Wolfram Sang
2018-11-05 15:04   ` Daniel Lezcano
2018-10-21 20:00 ` [PATCH 2/5] thermal: rockchip_thermal: " Wolfram Sang
2018-11-02 12:25   ` Heiko Stuebner
2018-11-05 15:05   ` Daniel Lezcano
2018-10-21 20:00 ` [PATCH 3/5] thermal: spear_thermal: " Wolfram Sang
2018-11-05 15:06   ` Daniel Lezcano
2018-10-21 20:00 ` [PATCH 4/5] thermal: st: st_thermal: " Wolfram Sang
2018-11-05 15:06   ` Daniel Lezcano
2018-10-21 20:00 ` [PATCH 5/5] thermal: zx2967_thermal: " Wolfram Sang
2018-10-22  1:12   ` Shawn Guo
2018-11-05 15:07   ` Daniel Lezcano

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