From patchwork Mon Oct 14 08:23:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3034731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 685299F243 for ; Mon, 14 Oct 2013 08:26:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1DCBF20278 for ; Mon, 14 Oct 2013 08:26:03 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0473200DC for ; Mon, 14 Oct 2013 08:26:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VVdS5-0008Ol-Ts; Mon, 14 Oct 2013 08:24:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VVdRl-0006wH-RT; Mon, 14 Oct 2013 08:24:13 +0000 Received: from mail-db9lp0252.outbound.messaging.microsoft.com ([213.199.154.252] helo=db9outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VVdRE-0006sM-Lp for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2013 08:23:42 +0000 Received: from mail130-db9-R.bigfish.com (10.174.16.238) by DB9EHSOBE014.bigfish.com (10.174.14.77) with Microsoft SMTP Server id 14.1.225.22; Mon, 14 Oct 2013 08:23:16 +0000 Received: from mail130-db9 (localhost [127.0.0.1]) by mail130-db9-R.bigfish.com (Postfix) with ESMTP id 8C13E400B4; Mon, 14 Oct 2013 08:23:16 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h1de097h8275dhz2dh87h2a8h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e23h1fe8h1ff5h1151h1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail130-db9 (localhost.localdomain [127.0.0.1]) by mail130-db9 (MessageSwitch) id 1381738994444849_30773; Mon, 14 Oct 2013 08:23:14 +0000 (UTC) Received: from DB9EHSMHS031.bigfish.com (unknown [10.174.16.238]) by mail130-db9.bigfish.com (Postfix) with ESMTP id 5D7E9202AD; Mon, 14 Oct 2013 08:23:14 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS031.bigfish.com (10.174.14.41) with Microsoft SMTP Server (TLS) id 14.16.227.3; Mon, 14 Oct 2013 08:23:14 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.158.2; Mon, 14 Oct 2013 08:23:12 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.29]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r9E8MxRJ007437; Mon, 14 Oct 2013 01:23:10 -0700 From: Shawn Guo To: Subject: [PATCH 4/5] mmc: sdhci-esdhc-imx: pdev->id_entry should be immutable Date: Mon, 14 Oct 2013 16:23:43 +0800 Message-ID: <1381739024-24924-5-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1381739024-24924-1-git-send-email-shawn.guo@linaro.org> References: <1381739024-24924-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131014_042340_976005_B8868060 X-CRM114-Status: GOOD ( 11.40 ) X-Spam-Score: -1.2 (-) Cc: Chris Ball , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Shawn Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As a good practice, device driver should not modify pdev->id_entry but keep it immutable. Let's assign of_device_id.data with imx_esdhc_type constants directly, so that we do not have to manipulate pdev->id_entry in .probe(). As the result, sdhci-esdhc-imx53 and sdhci-usdhc-imx6q can be removed from platform_device_id table now, since they will only probe from device tree. Signed-off-by: Shawn Guo --- drivers/mmc/host/sdhci-esdhc-imx.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 63a6024..f1e1385 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -139,23 +139,17 @@ static struct platform_device_id imx_esdhc_devtype[] = { .name = "sdhci-esdhc-imx51", .driver_data = IMX51_ESDHC, }, { - .name = "sdhci-esdhc-imx53", - .driver_data = IMX53_ESDHC, - }, { - .name = "sdhci-usdhc-imx6q", - .driver_data = IMX6Q_USDHC, - }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype); static const struct of_device_id imx_esdhc_dt_ids[] = { - { .compatible = "fsl,imx25-esdhc", .data = &imx_esdhc_devtype[IMX25_ESDHC], }, - { .compatible = "fsl,imx35-esdhc", .data = &imx_esdhc_devtype[IMX35_ESDHC], }, - { .compatible = "fsl,imx51-esdhc", .data = &imx_esdhc_devtype[IMX51_ESDHC], }, - { .compatible = "fsl,imx53-esdhc", .data = &imx_esdhc_devtype[IMX53_ESDHC], }, - { .compatible = "fsl,imx6q-usdhc", .data = &imx_esdhc_devtype[IMX6Q_USDHC], }, + { .compatible = "fsl,imx25-esdhc", .data = (void *) IMX25_ESDHC, }, + { .compatible = "fsl,imx35-esdhc", .data = (void *) IMX35_ESDHC, }, + { .compatible = "fsl,imx51-esdhc", .data = (void *) IMX51_ESDHC, }, + { .compatible = "fsl,imx53-esdhc", .data = (void *) IMX53_ESDHC, }, + { .compatible = "fsl,imx6q-usdhc", .data = (void *) IMX6Q_USDHC, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids); @@ -872,9 +866,8 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) goto free_sdhci; } - if (of_id) - pdev->id_entry = of_id->data; - imx_data->devtype = pdev->id_entry->driver_data; + imx_data->devtype = of_id ? (enum imx_esdhc_type) of_id->data : + pdev->id_entry->driver_data; pltfm_host->priv = imx_data; if (is_imx25_esdhc(imx_data))