From patchwork Mon Dec 12 19:51:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 9471135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7564B60476 for ; Mon, 12 Dec 2016 19:51:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C80A284EF for ; Mon, 12 Dec 2016 19:51:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E716284F0; Mon, 12 Dec 2016 19:51:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 056BA284BD for ; Mon, 12 Dec 2016 19:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753007AbcLLTvt (ORCPT ); Mon, 12 Dec 2016 14:51:49 -0500 Received: from www.zeus03.de ([194.117.254.33]:41862 "EHLO mail.zeus03.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752656AbcLLTvs (ORCPT ); Mon, 12 Dec 2016 14:51:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references; s=k1; bh=Yvu4pksz3XJzN8Zjy1NJ2UxnPZ+D6WWSvfNe/GHF+eE=; b=FhtgD3DWbmKU iOGbvED7O3PDtvBtdAfRS4t3jLsM56NQW7r5tK64eohInkXQHjVAaTwoRcw5TX+v ttQjQ42qHcIQ5g9ttY/p9w1UbFWPH2f4Um4GUGYA1sUf7xtrMUfm4pjYtgvVdIfU S7fsGh14lhFzUasRDjSYvUffOhi94ms= Received: (qmail 2187 invoked from network); 12 Dec 2016 20:51:45 +0100 Received: from p54b33eed.dip0.t-ipconnect.de (HELO localhost) (l3s3148p1@84.179.62.237) by mail.zeus03.de with ESMTPSA (ECDHE-RSA-AES256-GCM-SHA384 encrypted, authenticated); 12 Dec 2016 20:51:45 +0100 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Simon Horman , Wolfram Sang Subject: [PATCH 1/9] mmc: sh_mobile_sdhi: simplify accessing DT data Date: Mon, 12 Dec 2016 20:51:20 +0100 Message-Id: <20161212195128.16633-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161212195128.16633-1-wsa+renesas@sang-engineering.com> References: <20161212195128.16633-1-wsa+renesas@sang-engineering.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By using the helper of_device_get_match_data(), we can skip some checking and make the code simpler. Signed-off-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven --- 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) {