public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-mmc@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	Simon Horman <horms@verge.net.au>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: [PATCH 1/9] mmc: sh_mobile_sdhi: simplify accessing DT data
Date: Mon, 12 Dec 2016 20:51:20 +0100	[thread overview]
Message-ID: <20161212195128.16633-2-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20161212195128.16633-1-wsa+renesas@sang-engineering.com>

By using the helper of_device_get_match_data(), we can skip some
checking and make the code simpler.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 15c77bc6e4ee72..b48e3ae4549b6b 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -548,8 +548,7 @@ static void sh_mobile_sdhi_enable_dma(struct tmio_mmc_host *host, bool enable)
 
 static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id =
-		of_match_device(sh_mobile_sdhi_of_match, &pdev->dev);
+	const struct sh_mobile_sdhi_of_data *of_data = of_device_get_match_data(&pdev->dev);
 	struct sh_mobile_sdhi *priv;
 	struct tmio_mmc_data *mmc_data;
 	struct tmio_mmc_data *mmd = pdev->dev.platform_data;
@@ -590,9 +589,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto eprobe;
 	}
 
-	if (of_id && of_id->data) {
-		const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
-
+	if (of_data) {
 		mmc_data->flags |= of_data->tmio_flags;
 		mmc_data->capabilities |= of_data->capabilities;
 		mmc_data->capabilities2 |= of_data->capabilities2;
@@ -662,14 +659,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	if (host->mmc->caps & MMC_CAP_UHS_SDR104) {
 		host->mmc->caps |= MMC_CAP_HW_RESET;
 
-		if (of_id && of_id->data) {
-			const struct sh_mobile_sdhi_of_data *of_data;
-			const struct sh_mobile_sdhi_scc *taps;
+		if (of_data) {
+			const struct sh_mobile_sdhi_scc *taps = of_data->taps;
 			bool hit = false;
 
-			of_data = of_id->data;
-			taps = of_data->taps;
-
 			for (i = 0; i < of_data->taps_num; i++) {
 				if (taps[i].clk_rate == 0 ||
 				    taps[i].clk_rate == host->mmc->f_max) {
-- 
2.10.2

  reply	other threads:[~2016-12-12 19:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 19:51 [PATCH 0/9] mmc: sh_mobile_sdhi: add HS200 support Wolfram Sang
2016-12-12 19:51 ` Wolfram Sang [this message]
2016-12-13 10:48   ` [PATCH 1/9] mmc: sh_mobile_sdhi: simplify accessing DT data Geert Uytterhoeven
2016-12-12 19:51 ` [PATCH 2/9] mmc: sh_mobile_sdhi: improve prerequisite for hw_reset Wolfram Sang
2016-12-13 10:51   ` Geert Uytterhoeven
2016-12-13 11:08     ` Wolfram Sang
2016-12-12 19:51 ` [PATCH 3/9] mmc: sh_mobile_sdhi: improve prerequisites for tuning Wolfram Sang
2016-12-12 19:51 ` [PATCH 4/9] mmc: sh_mobile_sdhi: remove superfluous check in hw_reset Wolfram Sang
2016-12-12 19:51 ` [PATCH 5/9] mmc: sh_mobile_sdhi: remove superfluous check in init_tuning Wolfram Sang
2016-12-12 19:51 ` [PATCH 6/9] mmc: sh_mobile_sdhi: remove superfluous check in SCC error check Wolfram Sang
2016-12-12 19:51 ` [PATCH 7/9] mmc: sh_mobile_sdhi: enable HS200 Wolfram Sang
2016-12-12 19:51 ` [PATCH 8/9] arm64: dts: r8a7795: enable HS200 for eMMC Wolfram Sang
2016-12-12 19:51 ` [PATCH 9/9] arm64: dts: r8a7796: " Wolfram Sang
2016-12-29 19:02 ` [PATCH 0/9] mmc: sh_mobile_sdhi: add HS200 support Ulf Hansson

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=20161212195128.16633-2-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.com \
    --cc=horms@verge.net.au \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /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