From: Andrzej Hajda <a.hajda@samsung.com>
To: Wolfram Sang <wsa@the-dreams.de>,
Krzysztof Kozlowski <krzk@kernel.org>,
Javier Martinez Canillas <javier@osg.samsung.com>,
linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: Andrzej Hajda <a.hajda@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: [PATCH 2/2] i2c: exynos5: de-duplicate error logs on clock setup
Date: Fri, 24 Feb 2017 12:16:02 +0100 [thread overview]
Message-ID: <1487934962-8703-2-git-send-email-a.hajda@samsung.com> (raw)
In-Reply-To: <1487934962-8703-1-git-send-email-a.hajda@samsung.com>
In case of clock setup error it is enough to log it once.
Moreover patch simplifies clock setup routines.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
drivers/i2c/busses/i2c-exynos5.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index 54df9e6..bc2b5db 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -309,7 +309,8 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings)
div = temp / 512;
clk_cycle = temp / (div + 1) - 2;
if (temp < 4 || div >= 256 || clk_cycle < 2) {
- dev_warn(i2c->dev, "Failed to calculate divisor");
+ dev_err(i2c->dev, "%s clock set-up failed\n",
+ hs_timings ? "HS" : "FS");
return -EINVAL;
}
@@ -351,24 +352,13 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings)
static int exynos5_hsi2c_clock_setup(struct exynos5_i2c *i2c)
{
- /*
- * Configure the Fast speed timing values
- * Even the High Speed mode initially starts with Fast mode
- */
- if (exynos5_i2c_set_timing(i2c, false)) {
- dev_err(i2c->dev, "HSI2C FS Clock set up failed\n");
- return -EINVAL;
- }
+ /* always set Fast Speed timings */
+ int ret = exynos5_i2c_set_timing(i2c, false);
- /* configure the High speed timing values */
- if (i2c->op_clock >= HSI2C_HS_TX_CLOCK) {
- if (exynos5_i2c_set_timing(i2c, true)) {
- dev_err(i2c->dev, "HSI2C HS Clock set up failed\n");
- return -EINVAL;
- }
- }
+ if (ret < 0 || i2c->op_clock < HSI2C_HS_TX_CLOCK)
+ return ret;
- return 0;
+ return exynos5_i2c_set_timing(i2c, true);
}
/*
--
2.7.4
next prev parent reply other threads:[~2017-02-24 11:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170224111634eucas1p22340b3b86a835e90ce981a9d9d4dc64a@eucas1p2.samsung.com>
2017-02-24 11:16 ` [PATCH 1/2] i2c: exynos5: simplify clock frequency handling Andrzej Hajda
2017-02-24 11:16 ` Andrzej Hajda [this message]
2017-04-20 15:28 ` [PATCH 2/2] i2c: exynos5: de-duplicate error logs on clock setup Javier Martinez Canillas
2017-04-21 12:04 ` Wolfram Sang
2017-04-03 10:06 ` [PATCH 1/2] i2c: exynos5: simplify clock frequency handling Andrzej Hajda
2017-04-20 14:54 ` Javier Martinez Canillas
2017-04-21 12:04 ` Wolfram Sang
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=1487934962-8703-2-git-send-email-a.hajda@samsung.com \
--to=a.hajda@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=javier@osg.samsung.com \
--cc=krzk@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox