From patchwork Wed Jul 14 13:07:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 58896 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id D24DD100A38 for ; Wed, 14 Jul 2010 23:08:06 +1000 (EST) Received: by ozlabs.org (Postfix) id 41D92B7069; Wed, 14 Jul 2010 23:07:59 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from buildserver.ru.mvista.com (unknown [213.79.90.228]) by ozlabs.org (Postfix) with ESMTP id 78E99B6F07 for ; Wed, 14 Jul 2010 23:07:58 +1000 (EST) Received: from localhost (unknown [10.150.0.9]) by buildserver.ru.mvista.com (Postfix) with ESMTP id 2785F8819; Wed, 14 Jul 2010 18:07:57 +0500 (SAMST) Date: Wed, 14 Jul 2010 17:07:57 +0400 From: Anton Vorontsov To: Andrew Morton Subject: [PATCH 1/8] sdhci: Turn timeout timer into delayed work Message-ID: <20100714130757.GA517@oksana.dev.rtsoft.ru> References: <20100714130728.GA27339@oksana.dev.rtsoft.ru> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100714130728.GA27339@oksana.dev.rtsoft.ru> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Matt Fleming , Albert Herranz , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, Ben Dooks , Pierre Ossman X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org There is no need for the timeout handler to run in the atomic context, so this patch turns timeout timeout into the delayed work. Note that the timeout handler still grabs an irqsave spinlock, we'll deal with it in a separate patch. Signed-off-by: Anton Vorontsov --- drivers/mmc/host/sdhci.c | 14 ++++++++------ drivers/mmc/host/sdhci.h | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index c6d1bd8..dc6328c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -13,6 +13,8 @@ * - JMicron (hardware and technical support) */ +#include +#include #include #include #include @@ -906,7 +908,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) mdelay(1); } - mod_timer(&host->timer, jiffies + 10 * HZ); + schedule_delayed_work(&host->timeout_work, 10 * HZ); host->cmd = cmd; @@ -1280,7 +1282,7 @@ static void sdhci_tasklet_finish(unsigned long param) spin_lock_irqsave(&host->lock, flags); - del_timer(&host->timer); + __cancel_delayed_work(&host->timeout_work); mrq = host->mrq; @@ -1324,12 +1326,12 @@ static void sdhci_tasklet_finish(unsigned long param) mmc_request_done(host->mmc, mrq); } -static void sdhci_timeout_timer(unsigned long data) +static void sdhci_timeout_work(struct work_struct *wk) { struct sdhci_host *host; unsigned long flags; - host = (struct sdhci_host*)data; + host = container_of(wk, struct sdhci_host, timeout_work.work); spin_lock_irqsave(&host->lock, flags); @@ -1877,7 +1879,7 @@ int sdhci_add_host(struct sdhci_host *host) tasklet_init(&host->finish_tasklet, sdhci_tasklet_finish, (unsigned long)host); - setup_timer(&host->timer, sdhci_timeout_timer, (unsigned long)host); + INIT_DELAYED_WORK(&host->timeout_work, sdhci_timeout_work); ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, mmc_hostname(mmc), host); @@ -1963,7 +1965,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead) free_irq(host->irq, host); - del_timer_sync(&host->timer); + flush_delayed_work(&host->timeout_work); tasklet_kill(&host->card_tasklet); tasklet_kill(&host->finish_tasklet); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c846813..55c114d 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -12,6 +12,7 @@ #define __SDHCI_H #include +#include #include #include #include @@ -290,7 +291,7 @@ struct sdhci_host { struct tasklet_struct card_tasklet; /* Tasklet structures */ struct tasklet_struct finish_tasklet; - struct timer_list timer; /* Timer for timeouts */ + struct delayed_work timeout_work; /* Work for timeouts */ unsigned long private[0] ____cacheline_aligned; };