Skip to content

Commit

Permalink
i2c: designware: Keep pm_runtime_enable/_disable calls in sync
Browse files Browse the repository at this point in the history
On an hardware shared I2C bus (certain Intel Baytrail SoC platforms) the
runtime PM disable depth keeps increasing over repeated modprobe/rmmod
cycle because pm_runtime_disable() is called without checking should it
be disabled already because of bus sharing.

This hasn't made any other harm than dev->power.disable_depth keeps
increasing but keep it sync by calling pm_runtime_disable() only when
runtime PM is not disabled.

Reported-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Jarkko Nikula authored and Wolfram Sang committed Dec 12, 2015
1 parent 2d244c8 commit e79e72c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/i2c/busses/i2c-designware-platdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
}

r = i2c_dw_probe(dev);
if (r) {
if (r && !dev->pm_runtime_disabled)
pm_runtime_disable(&pdev->dev);
return r;
}

return 0;
return r;
}

static int dw_i2c_plat_remove(struct platform_device *pdev)
Expand All @@ -265,7 +263,8 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)

pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
if (!dev->pm_runtime_disabled)
pm_runtime_disable(&pdev->dev);

return 0;
}
Expand Down

0 comments on commit e79e72c

Please sign in to comment.