diff options
author | Jon Hunter <jonathanh@nvidia.com> | 2016-08-26 14:09:03 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-08-30 22:00:08 +0200 |
commit | f4c2d89bd4b13ec448f6c5dc07f445883685ea4b (patch) | |
tree | f269f6b8f70e072c607058c474941519b3b53e19 /drivers/i2c/busses/i2c-tegra.c | |
parent | 0da9ab89aba975d2b27b829636e253c5b2771c13 (diff) | |
download | op-kernel-dev-f4c2d89bd4b13ec448f6c5dc07f445883685ea4b.zip op-kernel-dev-f4c2d89bd4b13ec448f6c5dc07f445883685ea4b.tar.gz |
i2c: tegra: Simplify I2C resume
The I2C adapter is unlocked regardless of whether the tegra_i2c_init()
called during the resume is successful or not. However, if the
tegra_i2c_init() is not successful, then ->is_suspended is not set to
false. Simplify the resume code by only setting ->is_suspended to false
if tegra_i2c_init() is successful and return the error code from
tegra_i2c_init().
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-tegra.c')
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index bdb5025..3c27012 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -989,17 +989,12 @@ static int tegra_i2c_resume(struct device *dev) i2c_lock_adapter(&i2c_dev->adapter); ret = tegra_i2c_init(i2c_dev); - - if (ret) { - i2c_unlock_adapter(&i2c_dev->adapter); - return ret; - } - - i2c_dev->is_suspended = false; + if (!ret) + i2c_dev->is_suspended = false; i2c_unlock_adapter(&i2c_dev->adapter); - return 0; + return ret; } static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume); |