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


Groups > linux.kernel > #1460368 > unrolled thread

[PATCH 4/6] i2c: tegra: Simplify I2C resume

Started byJon Hunter <jonathanh@nvidia.com>
First post2016-08-11 12:20 +0200
Last post2016-08-11 12:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/6] i2c: tegra: Simplify I2C resume Jon Hunter <jonathanh@nvidia.com> - 2016-08-11 12:20 +0200

#1460368 — [PATCH 4/6] i2c: tegra: Simplify I2C resume

FromJon Hunter <jonathanh@nvidia.com>
Date2016-08-11 12:20 +0200
Subject[PATCH 4/6] i2c: tegra: Simplify I2C resume
Message-ID<s4VfH-2u4-5@gated-at.bofh.it>
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>
---
 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 57f9c1612533..4eaf3c4a531b 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -984,17 +984,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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web