From patchwork Fri Apr 15 17:29:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 8854231 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F09F29F3A0 for ; Fri, 15 Apr 2016 17:52:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F5F620256 for ; Fri, 15 Apr 2016 17:52:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17C3C20218 for ; Fri, 15 Apr 2016 17:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750873AbcDORwe (ORCPT ); Fri, 15 Apr 2016 13:52:34 -0400 Received: from mail-bl2on0082.outbound.protection.outlook.com ([65.55.169.82]:13975 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750861AbcDORwd (ORCPT ); Fri, 15 Apr 2016 13:52:33 -0400 X-Greylist: delayed 909 seconds by postgrey-1.27 at vger.kernel.org; Fri, 15 Apr 2016 13:52:33 EDT Received: from BY2PR03CA076.namprd03.prod.outlook.com (10.141.249.49) by BY1PR0301MB1223.namprd03.prod.outlook.com (10.161.203.19) with Microsoft SMTP Server (TLS) id 15.1.453.26; Fri, 15 Apr 2016 17:37:13 +0000 Received: from BN1AFFO11FD053.protection.gbl (2a01:111:f400:7c10::180) by BY2PR03CA076.outlook.office365.com (2a01:111:e400:2c5d::49) with Microsoft SMTP Server (TLS) id 15.1.466.19 via Frontend Transport; Fri, 15 Apr 2016 17:37:13 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD053.mail.protection.outlook.com (10.58.53.68) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Fri, 15 Apr 2016 17:37:13 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u3FHb2HD019919; Fri, 15 Apr 2016 10:37:09 -0700 From: Dong Aisheng To: CC: , , , , , , , Subject: [PATCH 02/23] mmc: sdhci: move sdhci_get_cd() forward to avoid declaration Date: Sat, 16 Apr 2016 01:29:26 +0800 Message-ID: <1460741387-23815-3-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460741387-23815-1-git-send-email-aisheng.dong@nxp.com> References: <1460741387-23815-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131052154333692066; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(6806005)(81166005)(48376002)(85426001)(2950100001)(50466002)(104016004)(87936001)(5008740100001)(1220700001)(50226001)(1096002)(50986999)(4326007)(76176999)(586003)(86362001)(92566002)(47776003)(77096005)(33646002)(189998001)(2351001)(11100500001)(5003940100001)(229853001)(36756003)(105606002)(110136002)(19580405001)(19580395003)(106466001)(2906002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB1223; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD053; 1:fJpHdN+AedHw7xI/zHwgO5rz/IN2yqi9PIXznxfVZ8vJYyOxWlv+28TzINwQ/dne5pCurei3hLm5cE9WjDHAlGrPgbcMLWi7QMZOSjnV9uhgaHXxe5lIfJgPlTFXpVPajO5h++S5Ok+r1vmLOQ0sgT6RHz/uX5lP7i5ixz/W6CGzxM6Bq/o3tXcZ2HNAColSvrqMeG5enZjixXHueAb9a4IOAcZvrks3Xp+v2Qpe27gJ1HF7RbLi0PdwfA8cKzu/+E39saVarIos6gA5V+eZG3OoKWG1YxT4sKRgtiCdeAWysoRaKkiaM+rutLh6w2k5jJs1er4HiUs1hs7n1Df125g5wsNRj+KuhUo2IdoUtU27yMDE6OxkTJTQLBwOqnTb8GwN1XxTLyxhEoD02au/J6TtWosrhUU4ITHMFl4MkHjGnQSHcXUa6sj1ijrB9EyISZ1oI6eLl2mc+WATCTN+34LfJrjQb7QMDme7WqAUrw/0YFXRO2IETS1B0Z/aL8Z18cNukHZ95+yjpIRQrGm3UvK74Q642mYzmKOHzc459TvQrFnuGrawwmTyhlurR+Qy1XFuAX/TuiR5ISwdVDl6S2P61ci+Kpsi3Nlm65YMKfQC7RYvA4G9tr69khJXSTD3 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 929c8043-0d45-4552-f5ba-08d36554947f X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 2:P9mmy4Xkzy/3nEjObGaMphGuRcyclSEIgBdOV/OqwfjWlRgpiUSw2tPNHMODev5OIvMhGDZO8OI1/RQgy7GYxPDBXuLHIQVYLeQ5KGS1Ac0p531GlXaksQMPfHv7WcLgfXs49Z8nljF/I0ZJZb8lUKjM79CHL+NYk9jsIBHbKypqpZ3KWgD+jnxcWsNU30mw; 3:d29ff+AGE0PBPZIIQ7XpFjUGazE/guWs6/OGhzL6gG+ew1pz/JAyM4kr6odO8TppBo+RFovxiyvet8X+8cilvpHfWe2FpQMId8OsxT1nLnXdQIwc+lqCS82S2tPrnfNfx/qAkMGzOWm9EPcHhy7sIsnCZIw0fqwY90WT1Pvn3upUxA3XqVd2OmKcRw3Z5R1enPvCC549g4T+dmNj8oKCTR/GsnQRzR0Lmu2jrIB3Mv4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 25:yR9dSmKt2xe8wrla4zEM24DIuY1094eifUbIZhw4BaVrFGZE+aN/jA+V0VgXR5FCJGBFNn3c7VX/gW4Dq3LPBnNF1iqRsPTZqkvxm/A9w7hFwZIwYzsdPXw1vMpgC0ZrBfzZorTutr2OrU6IJJdJNId8OlIEzNhhTvCcM7xWgMzTA0MQZ1c4U0LNUQSMTBwO9LLeALVFR6LJvC6ajlEmvr8sCI9DwfADIR9jmunSJwd73Z9J+fNL7T9hVVSyZoPvMe8xmr1fQFHag1x/5e+Yxd0f+tUnvqTrpeUPLpb0onxcyaPMNwTs7Bq1jLgVeGrmvBprrTJUeskbHwrxOMzbUzGSB8y8dqbz4lM6h1/km1jzFnRHAwawmFb64uL9qTIaz+9AMiGpSWVU3Afd7Ch7m6SMeCX8DVVMiS/efMavV19kSgk3jTJYFwXxifX1i2O0ydUHRxdBJnHcVsKN+2mpMdI50AkZfY/HvXMXEduS5SH1OoMuJDWI7dyHfLzjGGoyJX3k4J4MJGzyriuSHJeGNLSLZDt6DI66YLH/6tz3zG0nGxHDRd6t/bUjbrSnpWf9hBZevtcJB7ol5kynIWIqQ2ajoR4e6PBgtdkZPcRAJAslDuLywJqjwYerD5+vEqRpzFVsRyp9h2/HaJnqUEuqr4YBC9dBsFiXByj1t7QxyYw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13017025)(13024025)(13023025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY1PR0301MB1223; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1223; 4:+11b5Hgy2ZL8ePnyuxk9P1aU9xuuDDdJPzfAZrYIX0OfX6EsTbE3QDjBMyriEGDibjL8h2n4ss4yFAOrCHMLYX3MQ5gerYh0/hHWG7V4zWmPohsMGGlhIZzk4wKcgJOeb9JJeMmn/kcragg0xIQKG4DvpUAnYgiH8YgrD3sli+DemTfrbDavuUpx2loRbAkL2mr/O7YgJEp1vXiltzeZ1e5HUDCL+UO8nip5ZilZMpgB97obrROfaFV3mgbZohsEzQhb3i62cE1cmgvnOKAWFCw6mDMLT6H+49nUoKEFGLzARsiEgdmlzpdmsslmtcR6o/ZvVNGW0M+pA4RZW6PJnqwDRrql9lHDPUJHw4Qkbddrxr8JD84JDzJUf1FNghX122aGkZ809wSYrAnxMtjuQM1pcxt+DVuuMxXaM/1wgWSvK3ufsaoivykmm1DDOWvQZv0viied8znhnMfi82uuLMtOV9BdY+DOxBoJIJb0hqA= X-Forefront-PRVS: 0913EA1D60 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0301MB1223; 23:NTvrXeG/aa+FRyi56wyrdJ4v1PpjU5Ndkse5vAt?= =?us-ascii?Q?ceqpgXum7NIdi+00xIkgy+oJP+TE7ItsM0jZzghRpSuZuEy3un4rbq5fwLzu?= =?us-ascii?Q?YxEusk70KCi7OYSRoGSQTfisItIRg2uCQvbWDXddg7ZfRoAKa1DUKGzVgaQ7?= =?us-ascii?Q?bfc6cCTKS0i6uag7AIYdJT8SovpbGYg7fO79ec11IqsXEYvmQBQT18vBr5ZS?= =?us-ascii?Q?OSueu3X1uJ99pw2VAmg6ds7n18Mha5YlI73U/ln3ITa4AoaZbLlTK7vG3TiR?= =?us-ascii?Q?5ioRyEbJopTCA0Scjpkh/LKijczWIbtO7K1AntpwsIalLdL0V0KWsCnJthLA?= =?us-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O90InX57NxokNa+3PBqS5mWZUi0zfjnO4UuU4ceR3qzxkomA=; 24:5hJr1/cRfLr0yJNIXPkSpSU4PsM17OyFy6qdyD35N+0iFnO1WiqvT6rsdCsjNZ/asMUjdljRdBFz6Xlfy2/F6zt9GKdJGqhkPuAQhatdADI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2016 17:37:13.0104 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1223 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Move sdhci_get_cd() to avoid needing to declare this function before use. Signed-off-by: Dong Aisheng --- drivers/mmc/host/sdhci.c | 55 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index be52a3a..839aa4c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -53,7 +53,6 @@ static void sdhci_finish_data(struct sdhci_host *); static void sdhci_finish_command(struct sdhci_host *); static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable); -static int sdhci_get_cd(struct mmc_host *mmc); #ifdef CONFIG_PM static void sdhci_runtime_pm_bus_on(struct sdhci_host *host); @@ -161,6 +160,33 @@ static void sdhci_disable_card_detection(struct sdhci_host *host) sdhci_set_card_detection(host, false); } +static int sdhci_get_cd(struct mmc_host *mmc) +{ + struct sdhci_host *host = mmc_priv(mmc); + int gpio_cd = mmc_gpio_get_cd(mmc); + + if (host->flags & SDHCI_DEVICE_DEAD) + return 0; + + /* If nonremovable, assume that the card is always present. */ + if (host->mmc->caps & MMC_CAP_NONREMOVABLE) + return 1; + + /* + * Try slot gpio detect, if defined it take precedence + * over build in controller functionality + */ + if (!IS_ERR_VALUE(gpio_cd)) + return !!gpio_cd; + + /* If polling, assume that the card is always present. */ + if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) + return 1; + + /* Host native card detect */ + return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); +} + void sdhci_reset(struct sdhci_host *host, u8 mask) { unsigned long timeout; @@ -1551,33 +1577,6 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) spin_unlock_irqrestore(&host->lock, flags); } -static int sdhci_get_cd(struct mmc_host *mmc) -{ - struct sdhci_host *host = mmc_priv(mmc); - int gpio_cd = mmc_gpio_get_cd(mmc); - - if (host->flags & SDHCI_DEVICE_DEAD) - return 0; - - /* If nonremovable, assume that the card is always present. */ - if (host->mmc->caps & MMC_CAP_NONREMOVABLE) - return 1; - - /* - * Try slot gpio detect, if defined it take precedence - * over build in controller functionality - */ - if (!IS_ERR_VALUE(gpio_cd)) - return !!gpio_cd; - - /* If polling, assume that the card is always present. */ - if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) - return 1; - - /* Host native card detect */ - return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); -} - static int sdhci_check_ro(struct sdhci_host *host) { unsigned long flags;