From patchwork Sat Jul 2 08:50:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaktipriya Shridhar X-Patchwork-Id: 9210761 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 EE91060752 for ; Sat, 2 Jul 2016 08:51:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB7ED28513 for ; Sat, 2 Jul 2016 08:51:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD8BA286D4; Sat, 2 Jul 2016 08:51:24 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD2A328513 for ; Sat, 2 Jul 2016 08:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751212AbcGBIvA (ORCPT ); Sat, 2 Jul 2016 04:51:00 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33361 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751031AbcGBIu7 (ORCPT ); Sat, 2 Jul 2016 04:50:59 -0400 Received: by mail-pa0-f65.google.com with SMTP id ts6so11578515pac.0; Sat, 02 Jul 2016 01:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=DS6LuW+JFGF+lbBHTqaRFx0OgvlusFKgcl2hXr992Kg=; b=BKZHhKLWCtMSa7+UYpiH+6XumrhYGgoeZUiXmns/vkhkHlqtFa3gTz3nIiTMvRdf0Y Big7ROgXegNvKul/r4i00c/7knLkC42qsJ+CAseGoZdc7Xl1v+nrirGece8kgvBKEcLy 3kWg9/AgfZT+EUa3gTp336vOvlI2QPUbin5ZnCJMpE7nFpVUeO8HihJn+z1BbuDmiK+4 qnnGjd1CJachVgFLu/OKOhyREO1OoJB4Hor6JUsL2ldi9YZm9ijD8z1qwo+ov2qp7nGK 1+QDqf49jXmONc3hTTD1zqZLj62FHFY/BNe4v1GebiR/FutLQIc5i+tV8S2HCFAbXUSl plnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=DS6LuW+JFGF+lbBHTqaRFx0OgvlusFKgcl2hXr992Kg=; b=K6OpEcra21sMnYcXRVjaz8KvVU5WUo+naD15Z8nmuiN8enj+wdoxuwZS5mYjwbPRXD uIXETnDmA0U2Izlz8OsqNtq4CPJl4T+s6Kx22oqI8IL+Ob2z5hcxMtZm1GHJHYYf1QOx 8mgkJd7WyGMC4vS42v3dhvsKPs2KnqRLealXp1wl41V1Tkr6lNUGnm3yxxLa4dFggp4W 49GT9JTqSz1QEY/sfTSVSwM3TMjJM2Zdvs0NRcNlNlawGnHNjRvvqIPkbZOuWG62r8yP soOr7QUj9xrshInc6egkHLxnRipCQ6rL39kHgRpVGoUjieadSWIjEiwZWKBwjPxxGfHn VsVw== X-Gm-Message-State: ALyK8tKadh8Pw9Ycp+lu9OzrZAeQCiZgD7/SZq+LA5YvSTQJVX9zdkYqSOjCMMJsR9HwSg== X-Received: by 10.66.178.49 with SMTP id cv17mr4324390pac.157.1467449457929; Sat, 02 Jul 2016 01:50:57 -0700 (PDT) Received: from Karyakshetra ([2401:fa00:c:fd01:410d:2f25:536:9c8f]) by smtp.gmail.com with ESMTPSA id ot2sm3440331pac.29.2016.07.02.01.50.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Jul 2016 01:50:57 -0700 (PDT) Date: Sat, 2 Jul 2016 14:20:55 +0530 From: Bhaktipriya Shridhar To: Mark Brown Cc: Tejun Heo , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: spi-txx9: Remove deprecated create_singlethread_workqueue Message-ID: <20160702085054.GA28059@Karyakshetra> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The workqueue "workqueue" has a single work item(&c->work) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path.Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in txx9spi_remove() to ensure that nothing is pending while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo --- drivers/spi/spi-txx9.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c index d69f8f8..7492ea3 100644 --- a/drivers/spi/spi-txx9.c +++ b/drivers/spi/spi-txx9.c @@ -72,7 +72,6 @@ struct txx9spi { - struct workqueue_struct *workqueue; struct work_struct work; spinlock_t lock; /* protect 'queue' */ struct list_head queue; @@ -315,7 +314,7 @@ static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m) spin_lock_irqsave(&c->lock, flags); list_add_tail(&m->queue, &c->queue); - queue_work(c->workqueue, &c->work); + schedule_work(&c->work); spin_unlock_irqrestore(&c->lock, flags); return 0; @@ -374,10 +373,6 @@ static int txx9spi_probe(struct platform_device *dev) if (ret) goto exit; - c->workqueue = create_singlethread_workqueue( - dev_name(master->dev.parent)); - if (!c->workqueue) - goto exit_busy; c->last_chipselect = -1; dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", @@ -400,8 +395,6 @@ static int txx9spi_probe(struct platform_device *dev) exit_busy: ret = -EBUSY; exit: - if (c->workqueue) - destroy_workqueue(c->workqueue); clk_disable(c->clk); spi_master_put(master); return ret; @@ -412,7 +405,7 @@ static int txx9spi_remove(struct platform_device *dev) struct spi_master *master = platform_get_drvdata(dev); struct txx9spi *c = spi_master_get_devdata(master); - destroy_workqueue(c->workqueue); + flush_work(&c->work); clk_disable(c->clk); return 0; }