From patchwork Mon Oct 21 15:25:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremie Samuel X-Patchwork-Id: 3078571 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9D747BF924 for ; Mon, 21 Oct 2013 15:27:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F37BE2039E for ; Mon, 21 Oct 2013 15:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1370420360 for ; Mon, 21 Oct 2013 15:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753739Ab3JUP10 (ORCPT ); Mon, 21 Oct 2013 11:27:26 -0400 Received: from co202.xi-lite.net ([149.6.83.202]:36369 "EHLO co202.xi-lite.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753694Ab3JUP1Z (ORCPT ); Mon, 21 Oct 2013 11:27:25 -0400 Received: from localhost (localhost [127.0.0.1]) by co202.xi-lite.net (Postfix) with ESMTP id ADE60480954; Mon, 21 Oct 2013 17:27:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at fw.aswsp.net Received: from co202.xi-lite.net ([127.0.0.1]) by localhost (fw.aswsp.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 160xQ_ZCiPrO; Mon, 21 Oct 2013 17:27:24 +0200 (CEST) Received: from HCAS2.aswsp.lan (unknown [193.34.35.150]) by co202.xi-lite.net (Postfix) with ESMTPS id 9CB7448088C; Mon, 21 Oct 2013 17:27:24 +0200 (CEST) Received: from jerk.parrot.biz (46.218.109.88) by smtp.aswsp.com (193.34.32.148) with Microsoft SMTP Server id 14.2.342.3; Mon, 21 Oct 2013 17:27:59 +0200 From: Jeremie Samuel To: Chris Ball CC: , =?UTF-8?q?Gr=C3=A9gor=20Boirie?= , Matthieu Castet , Jeremie Samuel , Anton Vorontsov Subject: [PATCH v2 1/8] sdhci: Turn timeout timer into delayed work Date: Mon, 21 Oct 2013 17:25:50 +0200 Message-ID: <1382369157-16129-2-git-send-email-jeremie.samuel.ext@parrot.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1382369157-16129-1-git-send-email-jeremie.samuel.ext@parrot.com> References: <1382369157-16129-1-git-send-email-jeremie.samuel.ext@parrot.com> MIME-Version: 1.0 X-Originating-IP: [46.218.109.88] 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.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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. Patch based on http://thread.gmane.org/gmane.linux.kernel.mmc/2579. Signed-off-by: Anton Vorontsov Signed-off-by: Jeremie Samuel --- drivers/mmc/host/sdhci.c | 13 +++++++------ include/linux/mmc/sdhci.h | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 66bce7a..b312ec6 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -13,6 +13,7 @@ * - JMicron (hardware and technical support) */ +#include #include #include #include @@ -1013,7 +1014,7 @@ 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; @@ -2140,7 +2141,7 @@ static void sdhci_tasklet_finish(unsigned long param) return; } - del_timer(&host->timer); + cancel_delayed_work(&host->timeout_work); mrq = host->mrq; @@ -2180,12 +2181,12 @@ static void sdhci_tasklet_finish(unsigned long param) sdhci_runtime_pm_put(host); } -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); @@ -3213,7 +3214,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); if (host->version >= SDHCI_SPEC_300) { init_waitqueue_head(&host->buf_ready_int); @@ -3316,7 +3317,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead) sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK); 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/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 3e781b8..98cf934 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -12,6 +12,7 @@ #define LINUX_MMC_SDHCI_H #include +#include #include #include #include @@ -163,7 +164,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 */ u32 caps; /* Alternative CAPABILITY_0 */ u32 caps1; /* Alternative CAPABILITY_1 */