From patchwork Fri Jun 17 10:09:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9183267 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 8626860832 for ; Fri, 17 Jun 2016 10:18:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 736C328388 for ; Fri, 17 Jun 2016 10:18:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6814928399; Fri, 17 Jun 2016 10:18:55 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B5CB328390 for ; Fri, 17 Jun 2016 10:18:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDqpr-0006Uy-97; Fri, 17 Jun 2016 10:17:11 +0000 Received: from mail-bn1on0065.outbound.protection.outlook.com ([157.56.110.65] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDqpP-000610-UG for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 10:16:47 +0000 Received: from BN3PR0301CA0082.namprd03.prod.outlook.com (10.160.152.178) by SN2PR03MB2383.namprd03.prod.outlook.com (10.166.210.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12; Fri, 17 Jun 2016 10:16:22 +0000 Received: from BY2FFO11FD051.protection.gbl (2a01:111:f400:7c0c::146) by BN3PR0301CA0082.outlook.office365.com (2a01:111:e400:401e::50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.517.8 via Frontend Transport; Fri, 17 Jun 2016 10:16:22 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD051.mail.protection.outlook.com (10.1.15.188) with Microsoft SMTP Server (TLS) id 15.1.511.7 via Frontend Transport; Fri, 17 Jun 2016 10:16:21 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u5HAFbSr029984; Fri, 17 Jun 2016 03:16:14 -0700 From: Peter Chen To: , , , , , Subject: [PATCH 05/12] power: pwrseq: Generalize mmc_pwrseq operations by removing mmc prefix Date: Fri, 17 Jun 2016 18:09:18 +0800 Message-ID: <1466158165-9380-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466158165-9380-1-git-send-email-peter.chen@nxp.com> References: <1466158165-9380-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131106321817604723; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(85426001)(2201001)(189998001)(11100500001)(97736004)(92566002)(5001770100001)(586003)(50986999)(76176999)(86362001)(4326007)(2906002)(36756003)(87936001)(2171001)(106466001)(229853001)(77096005)(47776003)(8676002)(81156014)(356003)(105606002)(6806005)(81166006)(5008740100001)(104016004)(8936002)(2950100001)(50466002)(33646002)(48376002)(5003940100001)(50226002)(68736007)(19580405001)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2383; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD051; 1:fb3iUC+2Fu/YNnufkdBN4aFiJrE78+OOLKR5CpBs6qpsL6o3SW0DAjCAQ+kR5J+lhNWiPLA/E5LZ5eXxsJO1vhTwux8SIdliXOKpr/A+iLcTPJHje+g9dwf/rg3ikupPfedaaBH8+oaV+EjtXnvJLz1l0GFu+wbyuzzQDsC7PR1qQwYDQgBVZoAGi9iy1x3So8TIsFz8O+sRfEHdV2sl6z7NjSBLnl8FO7D1Gbb468lWd2lzHI18he804tbY3oFjOIp1TMSJm4zzN7M+vd9ROzJnL3n7ormmraeUjNkBqxKb6dBB1GI+2vNpl3f6sdLRKGvjGurdxJcJcFieEHmP31GpyzXCyvvHbj+ImLmxTqsw7IeMPZAnUEh0Pbq8mcSJEYzxcsWGEB6sCpP2yD7Bf17Zs+3YvunrdffbXtSNXdheVevGa3HfTrsQuTo0QrhSKAu3+ayVMgd3X+oQiJ4haG+iF4Y9uExn1LXxMwfmtAijhk7FjUxmr73BuxQbETVcPwlcvgOkCH2IlbFJyjoPR1j+v+u6YCOvJ+Q95+bq/ucc9rdXJlMpFXDF+dVZisu4pGw4ioXQIay3WAFPvR1+rImP7zMAVATdfTQA9peKqnO5SMpb/90Vp7V9Pqzjzqjb MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 01c26d00-3e11-49ae-b115-08d396986e33 X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2383; 2:ofx1TlwLY74yrV1LEANf/2YnVMiAI/NVUzBsOyY44nVGSvdLx9kAQFiA27eKy6gCF/hZzOtl9bzGPpH2QW/OIyDBA9SLF1BfPTtMNj9VI9T7yY3618WdcFpazJbbsavkoyKmgeu/+05OvCsvTYE3S/qwKBFLOmWtUglIagxoxOXrdUOXWQ2TpzBAHvKhOKhj; 3:KBRKCeyPWeJVqvHmEbuldyjwJmGUFoZTiWzQi/Va2IZWiOZtuT1Ys7G58Ta8FzC3it0DdoStiq2PX8oHaP6VlaGJEhEZRRbuW+2a1EXBxlmH4B4U6es3TYE7Ngy3x+H9C/fsVt6dSnSo2OcYUOhDM9dHCG94LaB+yVTpifsK1IDk/h65lI+Qn0Imabg03vWhRHhoqWzhLLy68ysiRkAF5McB49RyiiDr81L9ZSvf7nI=; 25:XdxXEdN8JKL/d8OVvtm/Au3D/V2m+z5jAlzGbImlhqegR05wAn2AScJ1+7MuZC2r/5qJBwgFMPs00GxeQVnGKE0td1/x1LPPSzgFJvkGASW2QFpMXds+UvEEl6HWRKtjofoq9MunYVF168qQ9GMViCWz1sa0soTRVvvBTATjun4/N+5OT3pF78OhWW9whADkZkQf+I7EkIZlCCEztlb98ahl5Hm3ggTR0hnbSKMUlGPmrMmlPdxx8yNWu0qr/xmtRIoCwXio6YMG/mjlbyoMm2c2xZlW83Lkknk2RqqNc8lMCscz4jOzhCJpeyW4V1Qz1SMxmKRlE3gGgjBiXfhkVVLrcgRM03xeEFHvhk0cLDOdVHpScfO3CsNDx8UC7p/ek1nsTv3G2eH6JpCI7IgTEQfLzg0AFuTGHp7TTNMBrYg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB2383; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(7411616537696); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13015025)(13023025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:SN2PR03MB2383; BCL:0; PCL:0; RULEID:(400006); SRVR:SN2PR03MB2383; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2383; 4:aODY3BvB+hxO/wFqt2/9RRsRqD+9CDZw3nwTeagEpJHFmOsiLaEuERkwwDG1q07tvQm/YLSHNFStW5GQJhcydXkrnOggCFiJI4R7F3Whzf+k+qeuMna8S81wOaajn6FE7VqBiu8R5gtvWMwbIcAcALc9cyZymSntWqrsp2nghxTYUPM/cNFi2miPFeYmFo4rzsS3h7eUVA2mhdzatwc7TgYwkocIxtKGs8MvcnsCZghYsxtbpbxJ7KCyrnZCUwRksA6utinYFgNnK4ZtZqjb7vhVvWuqP23hi5BBZnb74Ah7aots7jiVr1KLzHb0n2aKM0raQ37C+pdYKFZeC4JrjAOYHwQUMdJpdcfGye/LCJp+dE3tEe1NxbT+t7jk1Go4zJA2FAQvNxIOmNXE2Mph43deKuI1Dgg9OE0Uym5lc+pDOIyR7klBEUTpaf+0azSxknT+enD6Zqi2ZPk9a6w1lx/SIHxsiZRw3oJaJVZoMAzVpO78fPZQA7iwSFlPcQG9cp3bvAZIGXN5RG/gZfJM7g== X-Forefront-PRVS: 09760A0505 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2383; 23:1YsC4chG+y9uwIjcSigzEHjZz75olJuEEFn7XeUjk?= =?us-ascii?Q?/dmtQgb7au/rIqf0pANtCsMYsh0pf+YmNxhxIVcWBIt3s4YTc9o+0i4427Qu?= =?us-ascii?Q?uL91Wr0Fjrl1lIe+VU5a4wGHPUXDoDnMafDkBGpnK9tAb5GcHLjiEj1H6srH?= =?us-ascii?Q?/dXkvHwNhx4ZduL0SYdfmLKlY7yvtVLIBfDK7NmPoNWFrlCS5p7vXUz/FdhL?= =?us-ascii?Q?ej3tua0Qsz870dKC7Uuxrz52wQIiMVGbqILXGzbq0QlAceFNhkGFjaOkyo+f?= =?us-ascii?Q?2FD81+CSxtRrsDijcYpRzpBnwPenLc99k6ZYbX9u7WyN2rQt/NYsQ1sYUNxC?= =?us-ascii?Q?bVRgTML+/3SxZ4MR09thkXa2GKVX4SM6Sq3YcQit6U2AkvL1O9W8566EAddB?= =?us-ascii?Q?3TJ0FGuJie9DSzupR9qmLb+vByDjb7dknxe4EmYUeJBCrOpx7G/V4oE7O5Dt?= =?us-ascii?Q?K9T+QnEUi6kGDS4PMljijelX4U0JYOziAdrsio8kzG7XdiUOKsdzPPf/+i7d?= =?us-ascii?Q?NWQFyFtPRUUsWSZ041NM82teAx8B2LO+v6UbaYDLdW/P+iPdSWN5FcZawbsQ?= =?us-ascii?Q?i8QdijGE1JTHo6Pmh7rbRPRXi7eOwpnpCb7m31WoXnrRy0VwLXoWqJB5DtXs?= =?us-ascii?Q?9nf3je5tef8XbYF5nqxVr7YuZlI4F1yWZoQ62fI7nDkX8qpRXcTWvAA90tC5?= =?us-ascii?Q?19ntElo8Tey6nep/zjvs3Yh2cqsZMF5xNGYOJbD2/3DIN1Swv46K1DzKLu2Y?= =?us-ascii?Q?i7CsZQkBLrmDr6SnYBZRwXemOCulXZL2IFUfVw94ArTaYQ73xDTvfE3jmKOR?= =?us-ascii?Q?c+J5kLMMFMZURSfD8jVLZz4byTUYoOZCQhoAkMnRI9HQghCNcYzR+QUZI7+q?= =?us-ascii?Q?BRhWthaP9vz6EtOusZQ0vBiPK6N/B20F6VsAH1nAEsLoVIuK4XX6bNROOkKO?= =?us-ascii?Q?QqTKCjYJl5JpqmhhYRTN9ISxlMESXErmIpmA+6yYIpQ6eMSGtvcwWOZayUdK?= =?us-ascii?Q?gNNY6PXCOLKGROtvG2GUjzBfT8CanLXU3aQJ95Coc45ex7cvo1Xj5FxCubfn?= =?us-ascii?Q?l0LzgrGE0l/MCIQaK7Z1HBfWvL5ZUQqzBadmbazSgg8EUWvMi3syB2aMrDmA?= =?us-ascii?Q?AmaO78rC82LnRTRWYGl2oM3jMff3RiZ?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2383; 6:DSvHeW9LXoavqTSrip4LiT+9OJ/3DrQuLQ5j5Axe9KwyInDfXiU+4wfHzx0+26tzt8aW/qYm+haNhtV7NMfCvgTuOSrgJZ+zML1CO5kvqb99IbzgVrrqB9IrJIM6r0t2yj7khPAqcyLwUPqXqxqs4Qf8cZ8dNyC2CSglIcitLjQ6dNydwPOBQTQQIToX47JB3ahgRUYt2GOSn2cyYJdaizYjCNfWFnlyNZFyPI1e9jpiEEGRO2+79uupY5+Py1vX3WgMARB9UtNoodhyM7T4BfgR5jHgzbWwFpx+Z98Ayfc=; 5:VayyXtotH9BCQhCcU/HWmrky0VGcPGtPmbc4YWJrS3FWC5o4f5skpjf7W2+K0/kZEfDIvGMwQ/pi3mnGpchXBQRm76A+sBalP3Hoeb9FtpdLPyhoJD4yCNZrgRl+plFQboIlUHDvxTyCxgvMcnki67hb6Juex4iDcuAy5ld7Cf0=; 24:WCjNzFiz36vUTdPQogSi2sbCEI06OmFwOSZ656hwBClcCsKsAa0UGcTxWUkpoFD7hlrGmYJOKm2bBYaVhfIWY+vv8+9cp0KlZ04Ab/OHxEw=; 7:vRXxhMsRj5ZEYWAV7636JzTBn3WmimwXYhakfU5mgoNbnc3Lu5lfv4pIUN1SUbFYCKEjwoof6ZZJgN4IOBr3Ry31b3eKeJzXLitHmr744orZVrS1ukfCb1a3lrrIfh1jQvQzV+0frSX+ZUu9+ISHfnwuxuMgOwFxlncf2axOgOm5L5FWTLcKqMrY3WI/3BpndID4OMV4lCMRO8MzU9cU5y92VSadPj7Ap80UwHskiOaa9COM8Ml82r7iJGOh7GmV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 10:16:21.4328 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2383 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_031644_480737_6DC11CCC X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, k.kozlowski@samsung.com, stephen.boyd@linaro.org, oscar@naiandei.net, arnd@arndb.de, pawel.moll@arm.com, linux-pm@vger.kernel.org, s.hauer@pengutronix.de, linux-usb@vger.kernel.org, linux-mmc@vger.kernel.org, mail@maciej.szmigiero.name, troy.kisky@boundarydevices.com, javier@osg.samsung.com, p.zabel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Krzysztof Kozlowski The power sequence hooks (mmc_pwrseq_pre_power_on(), mmc_pwrseq_post_power_on() and mmc_pwrseq_power_off()) can be made more generic to allow re-use in other subsystems. They do not need to take pointer to struct mmc_host but instead the struct pwrseq should be sufficient. Remove the "mmc" prefix and use the pointer to struct pwrseq as argument. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Javier Martinez Canillas --- drivers/mmc/core/core.c | 6 +++--- drivers/power/pwrseq/pwrseq.c | 24 +++++++++--------------- drivers/power/pwrseq/pwrseq_emmc.c | 6 ++---- drivers/power/pwrseq/pwrseq_simple.c | 14 ++++++-------- include/linux/pwrseq.h | 18 +++++++++--------- 5 files changed, 29 insertions(+), 39 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index edefc3f..09a4722 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1719,7 +1719,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr) if (host->ios.power_mode == MMC_POWER_ON) return; - mmc_pwrseq_pre_power_on(host); + pwrseq_pre_power_on(host->pwrseq); host->ios.vdd = fls(ocr) - 1; host->ios.power_mode = MMC_POWER_UP; @@ -1740,7 +1740,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr) */ mmc_delay(10); - mmc_pwrseq_post_power_on(host); + pwrseq_post_power_on(host->pwrseq); host->ios.clock = host->f_init; @@ -1759,7 +1759,7 @@ void mmc_power_off(struct mmc_host *host) if (host->ios.power_mode == MMC_POWER_OFF) return; - mmc_pwrseq_power_off(host); + pwrseq_power_off(host->pwrseq); host->ios.clock = 0; host->ios.vdd = 0; diff --git a/drivers/power/pwrseq/pwrseq.c b/drivers/power/pwrseq/pwrseq.c index 9c66582..495a19d 100644 --- a/drivers/power/pwrseq/pwrseq.c +++ b/drivers/power/pwrseq/pwrseq.c @@ -52,32 +52,26 @@ int mmc_pwrseq_alloc(struct mmc_host *host) } EXPORT_SYMBOL_GPL(mmc_pwrseq_alloc); -void mmc_pwrseq_pre_power_on(struct mmc_host *host) +void pwrseq_pre_power_on(struct pwrseq *pwrseq) { - struct pwrseq *pwrseq = host->pwrseq; - if (pwrseq && pwrseq->ops->pre_power_on) - pwrseq->ops->pre_power_on(host); + pwrseq->ops->pre_power_on(pwrseq); } -EXPORT_SYMBOL_GPL(mmc_pwrseq_pre_power_on); +EXPORT_SYMBOL_GPL(pwrseq_pre_power_on); -void mmc_pwrseq_post_power_on(struct mmc_host *host) +void pwrseq_post_power_on(struct pwrseq *pwrseq) { - struct pwrseq *pwrseq = host->pwrseq; - if (pwrseq && pwrseq->ops->post_power_on) - pwrseq->ops->post_power_on(host); + pwrseq->ops->post_power_on(pwrseq); } -EXPORT_SYMBOL_GPL(mmc_pwrseq_post_power_on); +EXPORT_SYMBOL_GPL(pwrseq_post_power_on); -void mmc_pwrseq_power_off(struct mmc_host *host) +void pwrseq_power_off(struct pwrseq *pwrseq) { - struct pwrseq *pwrseq = host->pwrseq; - if (pwrseq && pwrseq->ops->power_off) - pwrseq->ops->power_off(host); + pwrseq->ops->power_off(pwrseq); } -EXPORT_SYMBOL_GPL(mmc_pwrseq_power_off); +EXPORT_SYMBOL_GPL(pwrseq_power_off); void mmc_pwrseq_free(struct mmc_host *host) { diff --git a/drivers/power/pwrseq/pwrseq_emmc.c b/drivers/power/pwrseq/pwrseq_emmc.c index a68ac9a..dbb7e75 100644 --- a/drivers/power/pwrseq/pwrseq_emmc.c +++ b/drivers/power/pwrseq/pwrseq_emmc.c @@ -19,8 +19,6 @@ #include #include -#include - struct mmc_pwrseq_emmc { struct pwrseq pwrseq; struct notifier_block reset_nb; @@ -37,9 +35,9 @@ static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) udelay(200); } -static void mmc_pwrseq_emmc_reset(struct mmc_host *host) +static void mmc_pwrseq_emmc_reset(struct pwrseq *_pwrseq) { - struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); + struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(_pwrseq); __mmc_pwrseq_emmc_reset(pwrseq); } diff --git a/drivers/power/pwrseq/pwrseq_simple.c b/drivers/power/pwrseq/pwrseq_simple.c index d5fbd65..93807a6 100644 --- a/drivers/power/pwrseq/pwrseq_simple.c +++ b/drivers/power/pwrseq/pwrseq_simple.c @@ -18,8 +18,6 @@ #include #include -#include - struct mmc_pwrseq_simple { struct pwrseq pwrseq; bool clk_enabled; @@ -46,9 +44,9 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, } } -static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) +static void mmc_pwrseq_simple_pre_power_on(struct pwrseq *_pwrseq) { - struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(_pwrseq); if (!IS_ERR(pwrseq->ext_clk) && !pwrseq->clk_enabled) { clk_prepare_enable(pwrseq->ext_clk); @@ -58,16 +56,16 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); } -static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) +static void mmc_pwrseq_simple_post_power_on(struct pwrseq *_pwrseq) { - struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(_pwrseq); mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); } -static void mmc_pwrseq_simple_power_off(struct mmc_host *host) +static void mmc_pwrseq_simple_power_off(struct pwrseq *_pwrseq) { - struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(_pwrseq); mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); diff --git a/include/linux/pwrseq.h b/include/linux/pwrseq.h index 6d2d2a4..fcc8fd8 100644 --- a/include/linux/pwrseq.h +++ b/include/linux/pwrseq.h @@ -11,9 +11,9 @@ #include struct pwrseq_ops { - void (*pre_power_on)(struct mmc_host *host); - void (*post_power_on)(struct mmc_host *host); - void (*power_off)(struct mmc_host *host); + void (*pre_power_on)(struct pwrseq *pwrseq); + void (*post_power_on)(struct pwrseq *pwrseq); + void (*power_off)(struct pwrseq *pwrseq); }; struct pwrseq { @@ -28,10 +28,10 @@ struct pwrseq { int pwrseq_register(struct pwrseq *pwrseq); void pwrseq_unregister(struct pwrseq *pwrseq); +void pwrseq_pre_power_on(struct pwrseq *pwrseq); +void pwrseq_post_power_on(struct pwrseq *pwrseq); +void pwrseq_power_off(struct pwrseq *pwrseq); int mmc_pwrseq_alloc(struct mmc_host *host); -void mmc_pwrseq_pre_power_on(struct mmc_host *host); -void mmc_pwrseq_post_power_on(struct mmc_host *host); -void mmc_pwrseq_power_off(struct mmc_host *host); void mmc_pwrseq_free(struct mmc_host *host); #else /* CONFIG_POWER_SEQ */ @@ -41,10 +41,10 @@ static inline int pwrseq_register(struct pwrseq *pwrseq) return -ENOSYS; } static inline void pwrseq_unregister(struct pwrseq *pwrseq) {} +static inline void pwrseq_pre_power_on(struct pwrseq *pwrseq) {} +static inline void pwrseq_post_power_on(struct pwrseq *pwrseq) {} +static inline void pwrseq_power_off(struct pwrseq *pwrseq) {} static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } -static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} -static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} -static inline void mmc_pwrseq_power_off(struct mmc_host *host) {} static inline void mmc_pwrseq_free(struct mmc_host *host) {} #endif /* CONFIG_POWER_SEQ */