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>
此提交包含在:
@@ -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);
|
||||
|
新增問題並參考
封鎖使用者