From: Jon Hunter <jonathanh@nvidia.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
Wolfram Sang <wsa@the-dreams.de>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>
Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH 4/6] i2c: tegra: Simplify I2C resume
Date: Thu, 11 Aug 2016 11:16:58 +0100 [thread overview]
Message-ID: <1470910620-9898-5-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1470910620-9898-1-git-send-email-jonathanh@nvidia.com>
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
WARNING: multiple messages have this Message-ID (diff)
From: Jon Hunter <jonathanh@nvidia.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
Wolfram Sang <wsa@the-dreams.de>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>
Cc: <linux-i2c@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH 4/6] i2c: tegra: Simplify I2C resume
Date: Thu, 11 Aug 2016 11:16:58 +0100 [thread overview]
Message-ID: <1470910620-9898-5-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1470910620-9898-1-git-send-email-jonathanh@nvidia.com>
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
next prev parent reply other threads:[~2016-08-11 10:16 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 10:16 [PATCH 0/6] Some Tegra I2C Updates Jon Hunter
2016-08-11 10:16 ` Jon Hunter
2016-08-11 10:16 ` [PATCH 1/6] i2c: tegra: Add missing new line characters Jon Hunter
2016-08-11 10:16 ` Jon Hunter
[not found] ` <1470910620-9898-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-11 14:58 ` Laxman Dewangan
2016-08-11 14:58 ` Laxman Dewangan
2016-08-11 10:16 ` [PATCH 2/6] i2c: tegra: Remove non device-tree support Jon Hunter
2016-08-11 10:16 ` Jon Hunter
2016-08-11 14:59 ` Laxman Dewangan
2016-08-11 14:59 ` Laxman Dewangan
[not found] ` <1470910620-9898-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-25 19:33 ` Wolfram Sang
2016-08-25 19:33 ` Wolfram Sang
2016-08-25 20:49 ` Jon Hunter
2016-08-25 20:49 ` Jon Hunter
2016-08-11 10:16 ` [PATCH 3/6] i2c: tegra: Use device name for adapter name Jon Hunter
2016-08-11 10:16 ` Jon Hunter
2016-08-11 14:59 ` Laxman Dewangan
2016-08-11 14:59 ` Laxman Dewangan
2016-08-11 10:16 ` Jon Hunter [this message]
2016-08-11 10:16 ` [PATCH 4/6] i2c: tegra: Simplify I2C resume Jon Hunter
[not found] ` <1470910620-9898-5-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-11 15:00 ` Laxman Dewangan
2016-08-11 15:00 ` Laxman Dewangan
2016-08-11 10:16 ` [PATCH 5/6] i2c: tegra: Add runtime power-management support Jon Hunter
2016-08-11 10:16 ` Jon Hunter
[not found] ` <1470910620-9898-6-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-11 15:01 ` Laxman Dewangan
2016-08-11 15:01 ` Laxman Dewangan
2016-08-25 19:26 ` Wolfram Sang
2016-08-25 20:53 ` Jon Hunter
2016-08-25 20:53 ` Jon Hunter
[not found] ` <c546ae53-005e-83d7-136d-d12a83b58549-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-25 22:31 ` Wolfram Sang
2016-08-25 22:31 ` Wolfram Sang
2016-08-11 10:17 ` [PATCH 6/6] i2c: tegra: Add pinctrl support Jon Hunter
2016-08-11 10:17 ` Jon Hunter
[not found] ` <1470910620-9898-7-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-11 15:01 ` Laxman Dewangan
2016-08-11 15:01 ` Laxman Dewangan
[not found] ` <1470910620-9898-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-24 11:10 ` [PATCH 0/6] Some Tegra I2C Updates Jon Hunter
2016-08-24 11:10 ` Jon Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470910620-9898-5-git-send-email-jonathanh@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=gnurou@gmail.com \
--cc=ldewangan@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.