From patchwork Thu Jan 26 23:37:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9540389 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 A6F3460429 for ; Thu, 26 Jan 2017 23:41:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C6CC28305 for ; Thu, 26 Jan 2017 23:41:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90ECD2830A; Thu, 26 Jan 2017 23:41:06 +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 0DA1128305 for ; Thu, 26 Jan 2017 23:41:06 +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 1cWtf4-0007jS-F3; Thu, 26 Jan 2017 23:41:02 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWtcZ-0003s1-SH for linux-arm-kernel@bombadil.infradead.org; Thu, 26 Jan 2017 23:38:28 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWtcU-0001gz-CX for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2017 23:38:26 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (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 3A64580F63; 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-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0QNbWSR001942; Thu, 26 Jan 2017 18:37:33 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 5466880FD1; Fri, 27 Jan 2017 00:37:31 +0100 (CET) From: Gerd Hoffmann To: linux-rpi-kernel@lists.infradead.org Subject: [PATCH 11/13] mmc: bcm2835: kill tasklet Date: Fri, 27 Jan 2017 00:37:24 +0100 Message-Id: <1485473846-24537-12-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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); 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_233822_808533_9DD99F75 X-CRM114-Status: GOOD ( 18.05 ) 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 | 53 ++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 39 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 6a1fef3..fc2d02f 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -147,7 +147,6 @@ struct bcm2835_host { u32 pio_timeout; /* In jiffies */ int clock; /* Current clock speed */ unsigned int max_clk; /* Max possible freq */ - struct tasklet_struct finish_tasklet; /* Tasklet structures */ struct timer_list timer; /* Timer for timeouts */ struct sg_mapping_iter sg_miter; /* SG state for PIO */ unsigned int blocks; /* remaining PIO blocks */ @@ -274,11 +273,12 @@ static void bcm2835_reset(struct mmc_host *mmc) if (host->dma_chan) dmaengine_terminate_sync(host->dma_chan); - tasklet_kill(&host->finish_tasklet); bcm2835_reset_internal(host); } +static void bcm2835_finish_data(struct bcm2835_host *host); static void bcm2835_finish_command(struct bcm2835_host *host); +static void bcm2835_finish_request(struct bcm2835_host *host); static void bcm2835_wait_transfer_complete(struct bcm2835_host *host) { @@ -318,8 +318,6 @@ static void bcm2835_wait_transfer_complete(struct bcm2835_host *host) } } -static void bcm2835_finish_data(struct bcm2835_host *host); - static void bcm2835_dma_complete(void *param) { struct bcm2835_host *host = param; @@ -667,7 +665,7 @@ bool bcm2835_send_command(struct bcm2835_host *host, dev_err(dev, "previous command never completed.\n"); bcm2835_dumpregs(host); cmd->error = -EILSEQ; - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); return false; } @@ -688,7 +686,7 @@ bool bcm2835_send_command(struct bcm2835_host *host, if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { dev_err(dev, "unsupported response type!\n"); cmd->error = -EINVAL; - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); return false; } @@ -746,7 +744,7 @@ static void bcm2835_transfer_complete(struct bcm2835_host *host) } } else { bcm2835_wait_transfer_complete(host); - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); } } @@ -847,7 +845,7 @@ static void bcm2835_finish_command(struct bcm2835_host *host) dev_err(dev, "command never completed.\n"); bcm2835_dumpregs(host); host->cmd->error = -EIO; - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); return; } else if (sdcmd & SDCMD_FAIL_FLAG) { u32 sdhsts = readl(host->ioaddr + SDHSTS); @@ -865,7 +863,7 @@ static void bcm2835_finish_command(struct bcm2835_host *host) bcm2835_dumpregs(host); host->cmd->error = -EILSEQ; } - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); return; } } @@ -903,12 +901,12 @@ static void bcm2835_finish_command(struct bcm2835_host *host) } } else if (cmd == host->mrq->stop) { /* Finished CMD12 */ - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); } else { /* Processed actual command. */ host->cmd = NULL; if (!host->data) - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); else if (host->data_complete) bcm2835_transfer_complete(host); } @@ -935,7 +933,7 @@ static void bcm2835_timeout(unsigned long data) host->mrq->cmd->error = -ETIMEDOUT; dev_dbg(dev, "timeout_timer tasklet_schedule\n"); - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); } } @@ -1244,7 +1242,7 @@ static void bcm2835_request(struct mmc_host *mmc, edm); bcm2835_dumpregs(host); mrq->cmd->error = -EILSEQ; - tasklet_schedule(&host->finish_tasklet); + bcm2835_finish_request(host); mutex_unlock(&host->mutex); return; } @@ -1300,21 +1298,10 @@ static void bcm2835_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) .hw_reset = bcm2835_reset, }; -static void bcm2835_tasklet_finish(unsigned long param) +static void bcm2835_finish_request(struct bcm2835_host *host) { - struct bcm2835_host *host = (struct bcm2835_host *)param; - struct mmc_request *mrq; struct dma_chan *terminate_chan = NULL; - - mutex_lock(&host->mutex); - - /* If this tasklet gets rescheduled while running, it will - * be run again afterwards but without any active request. - */ - if (!host->mrq) { - mutex_unlock(&host->mutex); - return; - } + struct mmc_request *mrq; del_timer(&host->timer); @@ -1328,8 +1315,6 @@ static void bcm2835_tasklet_finish(unsigned long param) terminate_chan = host->dma_chan; host->dma_chan = NULL; - mutex_unlock(&host->mutex); - if (terminate_chan) { int err = dmaengine_terminate_all(terminate_chan); @@ -1402,9 +1387,6 @@ int bcm2835_add_host(struct bcm2835_host *host) /* report supported voltage ranges */ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; - tasklet_init(&host->finish_tasklet, - bcm2835_tasklet_finish, (unsigned long)host); - setup_timer(&host->timer, bcm2835_timeout, (unsigned long)host); @@ -1419,7 +1401,7 @@ int bcm2835_add_host(struct bcm2835_host *host) if (ret) { dev_err(dev, "failed to request IRQ %d: %d\n", host->irq, ret); - goto untasklet; + return ret; } mmc_add_host(mmc); @@ -1432,11 +1414,6 @@ int bcm2835_add_host(struct bcm2835_host *host) pio_limit_string); return 0; - -untasklet: - tasklet_kill(&host->finish_tasklet); - - return ret; } static int bcm2835_probe(struct platform_device *pdev) @@ -1548,8 +1525,6 @@ static int bcm2835_remove(struct platform_device *pdev) del_timer_sync(&host->timer); - tasklet_kill(&host->finish_tasklet); - mmc_free_host(host->mmc); platform_set_drvdata(pdev, NULL);