diff mbox series

pwm: rcar: simplify getting .drvdata

Message ID 20180405172552.8720-1-wsa+renesas@sang-engineering.com
State Superseded
Headers show
Series pwm: rcar: simplify getting .drvdata | expand

Commit Message

Wolfram Sang April 5, 2018, 5:25 p.m. UTC
We should get drvdata 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>
---

Only build tested. Fixed numerous times in other drivers, however...

 drivers/pwm/pwm-rcar.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Yoshihiro Shimoda April 6, 2018, 2:07 p.m. UTC | #1
Hi Wolfram-san,

> From: Wolfram Sang, Sent: Friday, April 6, 2018 2:26 AM
> 
> We should get drvdata 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>
> ---
> 
> Only build tested. Fixed numerous times in other drivers, however...

Thank you for the patch!

Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

>  drivers/pwm/pwm-rcar.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
> index 91d11f2e2fef..748f614d5375 100644
> --- a/drivers/pwm/pwm-rcar.c
> +++ b/drivers/pwm/pwm-rcar.c
> @@ -261,8 +261,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
>  #ifdef CONFIG_PM_SLEEP
>  static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
> +	struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev);
>  	struct pwm_chip *chip = &rcar_pwm->chip;
> 
>  	return &chip->pwms[0];
> --
> 2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-pwm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven April 9, 2018, 8:37 a.m. UTC | #2
On Thu, Apr 5, 2018 at 7:25 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> We should get drvdata 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: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Simon Horman April 9, 2018, 11:47 a.m. UTC | #3
On Thu, Apr 05, 2018 at 07:25:51PM +0200, Wolfram Sang wrote:
> We should get drvdata 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>
> ---
> 
> Only build tested. Fixed numerous times in other drivers, however...

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
--
To unsubscribe from this list: send the line "unsubscribe linux-pwm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 91d11f2e2fef..748f614d5375 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -261,8 +261,7 @@  MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
 #ifdef CONFIG_PM_SLEEP
 static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
+	struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev);
 	struct pwm_chip *chip = &rcar_pwm->chip;
 
 	return &chip->pwms[0];