lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1501238415.29303.279.camel@linux.intel.com>
Date:   Fri, 28 Jul 2017 13:40:15 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        linux-i2c@...r.kernel.org
Cc:     Sören Brinkmann <soren.brinkmann@...inx.com>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Michal Simek <michal.simek@...inx.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Sekhar Nori <nsekhar@...com>,
        Scott Branden <sbranden@...adcom.com>,
        Wolfram Sang <wsa@...-dreams.de>,
        Joachim Eastwood <manabian@...il.com>,
        Kukjin Kim <kgene@...nel.org>,
        bcm-kernel-feedback-list@...adcom.com,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Barry Song <baohua@...nel.org>,
        Jon Mason <jonmason@...adcom.com>,
        Kevin Hilman <khilman@...nel.org>,
        Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
        linux-samsung-soc@...r.kernel.org, Ray Jui <rjui@...adcom.com>,
        Patrice Chotard <patrice.chotard@...com>
Subject: Re: [PATCH] i2c: use dev_get_drvdata() to get private data in
 suspend/resume hooks

On Fri, 2017-07-28 at 01:16 +0900, Masahiro Yamada wrote:
> Several drivers call to_platform_device() to get platform_device
> and pass it to platform_get_drvdata().  In platform_get_drvdata(),
> the platform_device is converted back to struct device again.
> 
> Use dev_get_drvdata() to avoid platform_device/device dance.
> 

I think it should be split on per driver basis.

In any case,

Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

(for DesignWare only)

>  drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++----

> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 2ea6d0d25a01..abe1eca8d689 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -428,8 +428,7 @@ static void dw_i2c_plat_complete(struct device
> *dev)
>  #ifdef CONFIG_PM
>  static int dw_i2c_plat_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
> +	struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
>  
>  	i_dev->disable(i_dev);
>  	i2c_dw_plat_prepare_clk(i_dev, false);
> @@ -439,8 +438,7 @@ static int dw_i2c_plat_suspend(struct device *dev)
>  
>  static int dw_i2c_plat_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
> +	struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
>  
>  	i2c_dw_plat_prepare_clk(i_dev, true);
>  	i_dev->init(i_dev);
> 

-- 
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ