From patchwork Thu Jan 26 23:37:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9540405 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 D894860429 for ; Thu, 26 Jan 2017 23:44:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE6FB28305 for ; Thu, 26 Jan 2017 23:44:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C37552830A; Thu, 26 Jan 2017 23:44:51 +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=-1.9 required=2.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CB6A28305 for ; Thu, 26 Jan 2017 23:44:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cWtih-0001xh-M4; Thu, 26 Jan 2017 23:44:47 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWteb-0007YJ-Ne for linux-arm-kernel@bombadil.infradead.org; Thu, 26 Jan 2017 23:40:33 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWtcX-0004PD-5J for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2017 23:38:25 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1198180494; Thu, 26 Jan 2017 23:37:34 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0QNbWqq013428; Thu, 26 Jan 2017 18:37:33 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 8061680F6D; Fri, 27 Jan 2017 00:37:31 +0100 (CET) From: Gerd Hoffmann To: linux-rpi-kernel@lists.infradead.org Subject: [PATCH 12/13] mmc: bcm2835: move timeout to thread context Date: Fri, 27 Jan 2017 00:37:25 +0100 Message-Id: <1485473846-24537-13-git-send-email-kraxel@redhat.com> In-Reply-To: <1485473846-24537-1-git-send-email-kraxel@redhat.com> References: <1485473846-24537-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Jan 2017 23:37:34 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170126_183825_402584_C4A40010 X-CRM114-Status: GOOD ( 15.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Ulf Hansson , Florian Fainelli , Scott Branden , Stephen Warren , Ray Jui , Lee Jones , linux-mmc@vger.kernel.org, open list , Eric Anholt , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , Gerd Hoffmann , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 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 Signed-off-by: Gerd Hoffmann --- drivers/mmc/host/bcm2835.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index fc2d02f..82caddc 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -147,7 +147,7 @@ struct bcm2835_host { u32 pio_timeout; /* In jiffies */ int clock; /* Current clock speed */ unsigned int max_clk; /* Max possible freq */ - struct timer_list timer; /* Timer for timeouts */ + struct delayed_work timeout_work; /* Timer for timeouts */ struct sg_mapping_iter sg_miter; /* SG state for PIO */ unsigned int blocks; /* remaining PIO blocks */ int irq; /* Device IRQ */ @@ -669,12 +669,11 @@ bool bcm2835_send_command(struct bcm2835_host *host, return false; } - timeout = jiffies; if (!cmd->data && cmd->busy_timeout > 9000) - timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; + timeout = DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; else - timeout += 10 * HZ; - mod_timer(&host->timer, timeout); + timeout = 10 * HZ; + schedule_delayed_work(&host->timeout_work, timeout); host->cmd = cmd; @@ -912,9 +911,11 @@ static void bcm2835_finish_command(struct bcm2835_host *host) } } -static void bcm2835_timeout(unsigned long data) +static void bcm2835_timeout(struct work_struct *work) { - struct bcm2835_host *host = (struct bcm2835_host *)data; + struct delayed_work *d = to_delayed_work(work); + struct bcm2835_host *host = + container_of(d, struct bcm2835_host, timeout_work); struct device *dev = &host->pdev->dev; mutex_lock(&host->mutex); @@ -1303,7 +1304,7 @@ static void bcm2835_finish_request(struct bcm2835_host *host) struct dma_chan *terminate_chan = NULL; struct mmc_request *mrq; - del_timer(&host->timer); + cancel_delayed_work(&host->timeout_work); mrq = host->mrq; @@ -1387,8 +1388,7 @@ int bcm2835_add_host(struct bcm2835_host *host) /* report supported voltage ranges */ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; - setup_timer(&host->timer, bcm2835_timeout, - (unsigned long)host); + INIT_DELAYED_WORK(&host->timeout_work, bcm2835_timeout); /* Set interrupt enables */ host->hcfg = SDHCFG_BUSY_IRPT_EN; @@ -1523,7 +1523,7 @@ static int bcm2835_remove(struct platform_device *pdev) free_irq(host->irq, host); - del_timer_sync(&host->timer); + cancel_delayed_work_sync(&host->timeout_work); mmc_free_host(host->mmc); platform_set_drvdata(pdev, NULL);