From patchwork Tue Dec 4 15:51:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 1839041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 1F150DF230 for ; Tue, 4 Dec 2012 15:54:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TfunE-0003FF-1H; Tue, 04 Dec 2012 15:52:20 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tfums-00038e-E7 for linux-arm-kernel@lists.infradead.org; Tue, 04 Dec 2012 15:51:59 +0000 Received: from axis700.grange (dslb-094-221-109-052.pools.arcor-ip.net [94.221.109.52]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LdKtt-1SyMlp3cCv-00iqdo; Tue, 04 Dec 2012 16:51:41 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 72E6A40B99; Tue, 4 Dec 2012 16:51:40 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 6FF7940B98; Tue, 4 Dec 2012 16:51:40 +0100 (CET) Date: Tue, 4 Dec 2012 16:51:40 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-mmc@vger.kernel.org Subject: [PATCH 3/3] mmc: sdhci: implement the .card_event() method In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:55nYvIWzH61eYDqc/uNHIYatLtcnUGe/TKe/9TI5cLH 3XUFDkyrIS1lqTiPbYNAu8LWVuwO+9fn5JNz2GEdKXaZlKpICh vxLxJRmcyfc9Q6cLwLCuvk60kZoHHwyDTH9LXiDm7zgkCA36ol WLPRbFW1LtLjEiZRSK7Tga511QXlKHfibi9y4/f6Y4nKss6xMX qLafFO/3HPhLWGs7I+NkUcjEZZoutW6Lickav32ssAebGozXEk 0SDxK1HvNek3sSKPFSk8qI67IG8l5RKmxJWKIggAqnIRf5CZJ6 h4HqIZyyrnlW3Ui6dW17FyXBCVhLNppuSelC5RuEkSQ8ccIzAB aLQDXgGxDtB3ZcUx/TW/pXSjmoMyLfDAJhB9YJghV0JmON5wzp vt4K5hiIQeS6w== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121204_105158_789649_00E140C4 X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.187 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (g.liakhovetski[at]gmx.de) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Chris Ball , Russell King - ARM Linux , Sebastian Hesselbarth , Mike Rapoport , Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Extracting a part of the SDHCI card tasklet into a .card_event() implementation allows SDHCI hosts to use generic card-detection services, e.g. the GPIO slot function. Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/sdhci.c | 48 +++++++++++++++++++++++++-------------------- 1 files changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index c7851c0..2323553 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1994,30 +1994,11 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable) sdhci_runtime_pm_put(host); } -static const struct mmc_host_ops sdhci_ops = { - .request = sdhci_request, - .set_ios = sdhci_set_ios, - .get_ro = sdhci_get_ro, - .hw_reset = sdhci_hw_reset, - .enable_sdio_irq = sdhci_enable_sdio_irq, - .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, - .execute_tuning = sdhci_execute_tuning, - .enable_preset_value = sdhci_enable_preset_value, -}; - -/*****************************************************************************\ - * * - * Tasklets * - * * -\*****************************************************************************/ - -static void sdhci_tasklet_card(unsigned long param) +static void sdhci_card_event(struct mmc_host *mmc) { - struct sdhci_host *host; + struct sdhci_host *host = mmc_priv(mmc); unsigned long flags; - host = (struct sdhci_host*)param; - spin_lock_irqsave(&host->lock, flags); /* Check host->mrq first in case we are runtime suspended */ @@ -2036,6 +2017,31 @@ static void sdhci_tasklet_card(unsigned long param) } spin_unlock_irqrestore(&host->lock, flags); +} + +static const struct mmc_host_ops sdhci_ops = { + .request = sdhci_request, + .set_ios = sdhci_set_ios, + .get_ro = sdhci_get_ro, + .hw_reset = sdhci_hw_reset, + .enable_sdio_irq = sdhci_enable_sdio_irq, + .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, + .execute_tuning = sdhci_execute_tuning, + .enable_preset_value = sdhci_enable_preset_value, + .card_event = sdhci_card_event, +}; + +/*****************************************************************************\ + * * + * Tasklets * + * * +\*****************************************************************************/ + +static void sdhci_tasklet_card(unsigned long param) +{ + struct sdhci_host *host = (struct sdhci_host*)param; + + sdhci_card_event(host->mmc); mmc_detect_change(host->mmc, msecs_to_jiffies(200)); }