Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470722

[PATCH V2 7/9] i2c: tegra: Simplify I2C resume

From Jon Hunter <jonathanh@nvidia.com>
Newsgroups linux.kernel
Subject [PATCH V2 7/9] i2c: tegra: Simplify I2C resume
Date 2016-08-26 15:20 +0200
Message-ID <sapd8-7yi-37@gated-at.bofh.it> (permalink)
References <sap3r-7uZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/i2c/busses/i2c-tegra.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index bdb50258a9a8..3c27012fa96c 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);
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 0/9] Some Tegra I2C Updates Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:10 +0200
  [PATCH V2 5/9] i2c: tegra: Remove non device-tree support Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:10 +0200
  [PATCH V2 2/9] i2c: tegra: Use BIT macro Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:10 +0200
  [PATCH V2 1/9] i2c: tegra: Fix lines over 80 characters Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:10 +0200
  [PATCH V2 8/9] i2c: tegra: Add runtime power-management support Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:20 +0200
  [PATCH V2 9/9] i2c: tegra: Add pinctrl support Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:20 +0200
    Re: [PATCH V2 9/9] i2c: tegra: Add pinctrl support Stephen Warren <swarren@wwwdotorg.org> - 2016-08-26 18:00 +0200
      Re: [PATCH V2 9/9] i2c: tegra: Add pinctrl support Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 18:50 +0200
        Re: [PATCH V2 9/9] i2c: tegra: Add pinctrl support Stephen Warren <swarren@wwwdotorg.org> - 2016-08-26 19:10 +0200
    Re: [PATCH V2 9/9] i2c: tegra: Add pinctrl support Linus Walleij <linus.walleij@linaro.org> - 2016-09-07 16:20 +0200
  [PATCH V2 6/9] i2c: tegra: Use device name for adapter name Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:20 +0200
  [PATCH V2 4/9] i2c: tegra: Add missing new line characters Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:20 +0200
  [PATCH V2 7/9] i2c: tegra: Simplify I2C resume Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 15:20 +0200
  Re: [PATCH V2 0/9] Some Tegra I2C Updates Wolfram Sang <wsa@the-dreams.de> - 2016-08-26 18:00 +0200
    Re: [PATCH V2 0/9] Some Tegra I2C Updates Jon Hunter <jonathanh@nvidia.com> - 2016-08-26 18:50 +0200
  Re: [PATCH V2 0/9] Some Tegra I2C Updates Wolfram Sang <wsa@the-dreams.de> - 2016-08-30 22:40 +0200
    Re: [PATCH V2 0/9] Some Tegra I2C Updates Jon Hunter <jonathanh@nvidia.com> - 2016-09-06 12:00 +0200

csiph-web