From patchwork Sun Jul 10 14:25:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaktipriya Shridhar X-Patchwork-Id: 9222681 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 1ADE960572 for ; Sun, 10 Jul 2016 14:25:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F317D24B48 for ; Sun, 10 Jul 2016 14:25:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3B1126E8A; Sun, 10 Jul 2016 14:25:37 +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 7258024B48 for ; Sun, 10 Jul 2016 14:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932169AbcGJOZg (ORCPT ); Sun, 10 Jul 2016 10:25:36 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34593 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757139AbcGJOZf (ORCPT ); Sun, 10 Jul 2016 10:25:35 -0400 Received: by mail-pf0-f196.google.com with SMTP id g202so1079596pfb.1; Sun, 10 Jul 2016 07:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tUTX7sJPO9vZVcE0A5mcN39nmsuTdluzCZuQXHlnVwo=; b=vbvZ+xF02y9pRlA9KxPZ9HGUSx0wPoVGopnrzm5A5DKjckPRQwZEL+G1LZKrbg3ukf wEVLOuEPzLPlFEXPWo7oVnaiCLIapHWpO02g9Ec0XNsl5N2b8JIaIjOxt8NH/rBPM7nc CvGSTKlM92cjklRg/9LmURNLtebuWYV/w/ASeLI7sD12zHBHs5ued7BOX0/vwA63TEGO T2ReQlcQ8I/d507HDoeZmJ9QaC0ZFh7ZF3SY1WjseqMV34hS46xX/axJyfYYLyG1vpS/ Iwcsue4y3UmmI/DTqLCKzoXgYk7MIkmoPLHCy1AX5U/e1Ci7SjUxwkcfG9Ir7lG9YJJJ Fm2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tUTX7sJPO9vZVcE0A5mcN39nmsuTdluzCZuQXHlnVwo=; b=Zyh+aoKgVR57yi+HGbXcFSuYqNS8yMT2qA/z8rf+3kYivU4B51jm9QrGHy05wqkrZm 9PSTRHBth6I9MSTuvOW3JBJOvI8ihoPtXJRc2+5NHqxOBFEdnbHon9TPvxaKE6BwN90i HH5XHHt4745JrzS3Kf8J7/1+WqA0hSefooJ9zohtL0TS8HLhANidIMxxRYzoRios7zVb NXwxybm8PUjVhumCWu9Sl+d+QsBTtrT1aVPPNYLiezLPsiy9sVlwaVHWO2/OBZfdiI7+ wtymDhDbkxOhmJeTP/FAXHHRYq3OK2ysfF9XIF3SzmKdIhc5va/9hfjOzV+iYzv5Mj4Y UgRw== X-Gm-Message-State: ALyK8tL2x2h6S3Z8ZCmlLi6ATzPA3dLD5B38apfXLFO+247oPDtrltq5sS3Eb0Lwrski4Q== X-Received: by 10.98.96.67 with SMTP id u64mr26935721pfb.70.1468160734751; Sun, 10 Jul 2016 07:25:34 -0700 (PDT) Received: from Karyakshetra.iiit.ac.in ([14.139.82.6]) by smtp.googlemail.com with ESMTPSA id tt1sm397940pac.35.2016.07.10.07.25.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Jul 2016 07:25:34 -0700 (PDT) From: Bhaktipriya Shridhar To: Mark Brown Cc: Tejun Heo , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Bhaktipriya Shridhar Subject: [PATCH v2] spi: spi-sh: Remove deprecated create_singlethread_workqueue Date: Sun, 10 Jul 2016 19:55:19 +0530 Message-Id: <1468160719-32600-1-git-send-email-bhaktipriya96@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <201607021811.Q9yqxNLJ%fengguang.wu@intel.com> References: <201607021811.Q9yqxNLJ%fengguang.wu@intel.com> 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 has a single workitem(&ss->ws) 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 spi_sh_remove() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo --- Changes in v2: -Fixed build error by correcting parameter passed to flush_work drivers/spi/spi-sh.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 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-sh.c b/drivers/spi/spi-sh.c index 5025011..2bf53f0 100644 --- a/drivers/spi/spi-sh.c +++ b/drivers/spi/spi-sh.c @@ -82,7 +82,6 @@ struct spi_sh_data { int irq; struct spi_master *master; struct list_head queue; - struct workqueue_struct *workqueue; struct work_struct ws; unsigned long cr1; wait_queue_head_t wait; @@ -380,7 +379,7 @@ static int spi_sh_transfer(struct spi_device *spi, struct spi_message *mesg) spi_sh_clear_bit(ss, SPI_SH_SSA, SPI_SH_CR1); list_add_tail(&mesg->queue, &ss->queue); - queue_work(ss->workqueue, &ss->ws); + schedule_work(&ss->ws); spin_unlock_irqrestore(&ss->lock, flags); @@ -425,7 +424,7 @@ static int spi_sh_remove(struct platform_device *pdev) struct spi_sh_data *ss = platform_get_drvdata(pdev); spi_unregister_master(ss->master); - destroy_workqueue(ss->workqueue); + flush_work(&ss->ws); free_irq(ss->irq, ss); return 0; @@ -484,18 +483,11 @@ static int spi_sh_probe(struct platform_device *pdev) spin_lock_init(&ss->lock); INIT_WORK(&ss->ws, spi_sh_work); init_waitqueue_head(&ss->wait); - ss->workqueue = create_singlethread_workqueue( - dev_name(master->dev.parent)); - if (ss->workqueue == NULL) { - dev_err(&pdev->dev, "create workqueue error\n"); - ret = -EBUSY; - goto error1; - } ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss); if (ret < 0) { dev_err(&pdev->dev, "request_irq error\n"); - goto error2; + goto error1; } master->num_chipselect = 2; @@ -514,8 +506,6 @@ static int spi_sh_probe(struct platform_device *pdev) error3: free_irq(irq, ss); - error2: - destroy_workqueue(ss->workqueue); error1: spi_master_put(master);