Skip to content

Commit a181b8d

Browse files
Minghao Chiwsakernel
authored andcommitted
i2c: davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and pm_runtime_put_noidle. This change is just to simplify the code, no actual functional changes. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 5692900 commit a181b8d

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/i2c/busses/i2c-davinci.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,9 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
539539

540540
dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
541541

542-
ret = pm_runtime_get_sync(dev->dev);
542+
ret = pm_runtime_resume_and_get(dev->dev);
543543
if (ret < 0) {
544544
dev_err(dev->dev, "Failed to runtime_get device: %d\n", ret);
545-
pm_runtime_put_noidle(dev->dev);
546545
return ret;
547546
}
548547

@@ -821,10 +820,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
821820

822821
pm_runtime_enable(dev->dev);
823822

824-
r = pm_runtime_get_sync(dev->dev);
823+
r = pm_runtime_resume_and_get(dev->dev);
825824
if (r < 0) {
826825
dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
827-
pm_runtime_put_noidle(dev->dev);
828826
return r;
829827
}
830828

@@ -898,11 +896,9 @@ static int davinci_i2c_remove(struct platform_device *pdev)
898896

899897
i2c_del_adapter(&dev->adapter);
900898

901-
ret = pm_runtime_get_sync(&pdev->dev);
902-
if (ret < 0) {
903-
pm_runtime_put_noidle(&pdev->dev);
899+
ret = pm_runtime_resume_and_get(&pdev->dev);
900+
if (ret < 0)
904901
return ret;
905-
}
906902

907903
davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
908904

0 commit comments

Comments
 (0)