All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-i2c@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: [RFC PATCH 3/7] i2c: sh_mobile: require setup callback
Date: Mon, 18 Dec 2017 22:57:58 +0100	[thread overview]
Message-ID: <20171218215802.28591-4-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20171218215802.28591-1-wsa+renesas@sang-engineering.com>

Require the setup callback and move the frequency calculation into it.
This is in preparation for supporting multiple formulas.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index a3a377a10fa789..88af45225003a5 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -771,15 +771,17 @@ static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
 	iic_wr(pd, ICCR, ICCR_TRS);
 	udelay(10);
 
-	return 0;
+	return sh_mobile_i2c_init(pd);
 }
 
 static const struct sh_mobile_dt_config default_dt_config = {
 	.clks_per_count = 1,
+	.setup = sh_mobile_i2c_init,
 };
 
 static const struct sh_mobile_dt_config fast_clock_dt_config = {
 	.clks_per_count = 2,
+	.setup = sh_mobile_i2c_init,
 };
 
 static const struct sh_mobile_dt_config r8a7740_dt_config = {
@@ -882,15 +884,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	config = of_device_get_match_data(&dev->dev);
 	if (config) {
 		pd->clks_per_count = config->clks_per_count;
-
-		if (config->setup) {
-			ret = config->setup(pd);
-			if (ret)
-				return ret;
-		}
+		ret = config->setup(pd);
+	} else {
+		ret = sh_mobile_i2c_init(pd);
 	}
-
-	ret = sh_mobile_i2c_init(pd);
 	if (ret)
 		return ret;
 
-- 
2.11.0

  parent reply	other threads:[~2017-12-18 21:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 21:57 [RFC PATCH 0/7] i2c: sh_mobile: support per-SoC frequency calculation Wolfram Sang
2017-12-18 21:57 ` [RFC PATCH 1/7] i2c: sh_mobile: move type detection upwards Wolfram Sang
2017-12-18 21:57 ` [RFC PATCH 2/7] i2c: sh_mobile: allow setup callback to return errno Wolfram Sang
2017-12-18 21:57 ` Wolfram Sang [this message]
2017-12-18 21:57 ` [RFC PATCH 4/7] i2c: sh_mobile: let RuntimePM do the clock handling Wolfram Sang
2017-12-18 21:58 ` [RFC PATCH 5/7] i2c: sh_mobile: add helper to check frequency calculations Wolfram Sang
2017-12-18 21:58 ` [RFC PATCH 6/7] i2c: sh_mobile: add new frequency calculation for later SoC Wolfram Sang
2017-12-18 21:58 ` [RFC PATCH 7/7] i2c: sh_mobile: let r8a7790 (R-Car H2) use the new formula Wolfram Sang
2018-01-15 17:02 ` [RFC PATCH 0/7] i2c: sh_mobile: support per-SoC frequency calculation 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=20171218215802.28591-4-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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.