i2c: use dev_get_drvdata() to get private data in suspend/resume hooks

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.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (for DesignWare only)
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
此提交包含在:
Masahiro Yamada
2017-07-28 01:16:24 +09:00
提交者 Wolfram Sang
父節點 f2326401b8
當前提交 9242e72aae
共有 13 個檔案被更改,包括 24 行新增48 行删除

查看文件

@@ -826,8 +826,7 @@ static int cdns_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long
*/
static int __maybe_unused cdns_i2c_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct cdns_i2c *xi2c = platform_get_drvdata(pdev);
struct cdns_i2c *xi2c = dev_get_drvdata(dev);
clk_disable(xi2c->clk);
@@ -844,8 +843,7 @@ static int __maybe_unused cdns_i2c_runtime_suspend(struct device *dev)
*/
static int __maybe_unused cdns_i2c_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct cdns_i2c *xi2c = platform_get_drvdata(pdev);
struct cdns_i2c *xi2c = dev_get_drvdata(dev);
int ret;
ret = clk_enable(xi2c->clk);