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: 1839011 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DB55740E3E for ; Tue, 4 Dec 2012 15:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752857Ab2LDPwH (ORCPT ); Tue, 4 Dec 2012 10:52:07 -0500 Received: from moutng.kundenserver.de ([212.227.126.187]:64214 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753882Ab2LDPwC (ORCPT ); Tue, 4 Dec 2012 10:52:02 -0500 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 cc: Russell King - ARM Linux , Shawn Guo , Sebastian Hesselbarth , Mike Rapoport , linux-arm-kernel@lists.infradead.org, Chris Ball 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== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.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)); }