Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9242e72a authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Wolfram Sang
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (for DesignWare only)
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent f2326401
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -510,8 +510,7 @@ static int bcm_iproc_i2c_remove(struct platform_device *pdev)

static int bcm_iproc_i2c_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev);
	struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);

	/* make sure there's no pending interrupt when we go into suspend */
	writel(0, iproc_i2c->base + IE_OFFSET);
@@ -526,8 +525,7 @@ static int bcm_iproc_i2c_suspend(struct device *dev)

static int bcm_iproc_i2c_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev);
	struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
	int ret;
	u32 val;

+2 −4
Original line number Diff line number Diff line
@@ -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);
+2 −4
Original line number Diff line number Diff line
@@ -876,8 +876,7 @@ static int davinci_i2c_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int davinci_i2c_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
	struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev);

	/* put I2C into reset */
	davinci_i2c_reset_ctrl(i2c_dev, 0);
@@ -888,8 +887,7 @@ static int davinci_i2c_suspend(struct device *dev)

static int davinci_i2c_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
	struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev);

	clk_prepare_enable(i2c_dev->clk);
	/* take I2C out of reset */
+2 −4
Original line number Diff line number Diff line
@@ -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);
+2 −4
Original line number Diff line number Diff line
@@ -803,8 +803,7 @@ static int exynos5_i2c_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int exynos5_i2c_suspend_noirq(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
	struct exynos5_i2c *i2c = dev_get_drvdata(dev);

	i2c->suspended = 1;

@@ -815,8 +814,7 @@ static int exynos5_i2c_suspend_noirq(struct device *dev)

static int exynos5_i2c_resume_noirq(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
	struct exynos5_i2c *i2c = dev_get_drvdata(dev);
	int ret = 0;

	ret = clk_prepare_enable(i2c->clk);
Loading