From patchwork Sat Jul 2 08:53:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaktipriya Shridhar X-Patchwork-Id: 9210765 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 4B754607D6 for ; Sat, 2 Jul 2016 08:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AE5F2853E for ; Sat, 2 Jul 2016 08:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F1F228545; Sat, 2 Jul 2016 08:56:03 +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 BB95A2853E for ; Sat, 2 Jul 2016 08:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750939AbcGBI4B (ORCPT ); Sat, 2 Jul 2016 04:56:01 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34886 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750815AbcGBIz6 (ORCPT ); Sat, 2 Jul 2016 04:55:58 -0400 Received: by mail-pa0-f68.google.com with SMTP id hf6so11544360pac.2; Sat, 02 Jul 2016 01:53:38 -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=BnX512qCqIMGIYvnAws4J/NFdFy68hzIdmRzUuH398o=; b=mONSTEv04tBiIv8SMEumKTMOGRGJWMyEGLhRQFvnk12efh/5PbfxXKR1RHq7jmLWCu TN50Urn8z8PMGsK6u6WmAjqBbLSBop3lhSiyfWr0y+1Lc+aDtw01GbegwTye3aF5rfzT 4M3+Y7bfUs//B6LTAIERkGJ9Q17oYdh7tHoS1WokLk+xPEcPqCvnw06IREUDTllaYwcU XJ247oSjH/oSV1Y9Qja9xtPoFnkdUDVUkfrcY8BvKPHXMgusjVCN00EcNHUFQSn2wWSL 0mrfigReqEs2cqI1ADwcvSW4sSdHemaYFtsWulEIRVfS1qTz+82b8lvzzLS2sCkIbcFl 3aBw== 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=BnX512qCqIMGIYvnAws4J/NFdFy68hzIdmRzUuH398o=; b=XrSUOsoExV4k/fzl62fjWvVi9KY+42g88fQK29FSBfbG4Iiw/aVpSCOXKsqlv05H5M w6jROs+JiVwxCWjscldFwfBSTQx1q/7R4iWDi4mXwsohYWmfjb8QU0qZrH1SHKRcsgCE OzkWdjNlrMdPo7f1dMGRAtXcqcXuJPGrrymOskjq8AHbPmRGi0Sly1jcwZoyRC4Z3tvR 2PAuXHwoAipiQ6snbuSJX+aUszVwBSc2BNKZYKu60iCfN8tQi2glgsFhQ3RkZCQchk/N LNmx71hiAoLlQcj1MX9EAkdQkM8sK4xASC18UfJEPt/yuawuxESFSGo+UYM41rwLMAWA EiEw== X-Gm-Message-State: ALyK8tLIljA1X9AbGU7XTs5FkK+ezsl2NX2d4MNasWJIl0p/YpGMsAgatAUkpHGxfH7oRA== X-Received: by 10.66.89.228 with SMTP id br4mr4314855pab.110.1467449617807; Sat, 02 Jul 2016 01:53:37 -0700 (PDT) Received: from Karyakshetra ([2401:fa00:c:fd01:410d:2f25:536:9c8f]) by smtp.gmail.com with ESMTPSA id r143sm3163026pfr.48.2016.07.02.01.53.36 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Jul 2016 01:53:37 -0700 (PDT) Date: Sat, 2 Jul 2016 14:23:34 +0530 From: Bhaktipriya Shridhar To: Mark Brown Cc: Tejun Heo , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: spi-topcliff-pch: Remove deprecated create_singlethread_workqueue Message-ID: <20160702085334.GA28440@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 "wk" serves as a queue for carrying out execution of requests. It has a single work item(&drv_data->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 pch_spi_free_resources() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo --- drivers/spi/spi-topcliff-pch.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 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-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 93dfcee..621ec19 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c @@ -133,8 +133,6 @@ struct pch_spi_dma_ctrl { * @io_remap_addr: The remapped PCI base address * @master: Pointer to the SPI master structure * @work: Reference to work queue handler - * @wk: Workqueue for carrying out execution of the - * requests * @wait: Wait queue for waking up upon receiving an * interrupt. * @transfer_complete: Status of SPI Transfer @@ -169,7 +167,6 @@ struct pch_spi_data { unsigned long io_base_addr; struct spi_master *master; struct work_struct work; - struct workqueue_struct *wk; wait_queue_head_t wait; u8 transfer_complete; u8 bcurrent_msg_processing; @@ -517,8 +514,7 @@ static int pch_spi_transfer(struct spi_device *pspi, struct spi_message *pmsg) dev_dbg(&pspi->dev, "%s - Invoked list_add_tail\n", __func__); - /* schedule work queue to run */ - queue_work(data->wk, &data->work); + schedule_work(&data->work); dev_dbg(&pspi->dev, "%s - Invoked queue work\n", __func__); retval = 0; @@ -674,7 +670,7 @@ static void pch_spi_nomore_transfer(struct pch_spi_data *data) *more messages) */ dev_dbg(&data->master->dev, "%s:Invoke queue_work\n", __func__); - queue_work(data->wk, &data->work); + schedule_work(&data->work); } else if (data->board_dat->suspend_sts || data->status == STATUS_EXITING) { dev_dbg(&data->master->dev, @@ -1266,14 +1262,7 @@ static void pch_spi_free_resources(struct pch_spi_board_data *board_dat, { dev_dbg(&board_dat->pdev->dev, "%s ENTRY\n", __func__); - /* free workqueue */ - if (data->wk != NULL) { - destroy_workqueue(data->wk); - data->wk = NULL; - dev_dbg(&board_dat->pdev->dev, - "%s destroy_workqueue invoked successfully\n", - __func__); - } + flush_work(&data->work); } static int pch_spi_get_resources(struct pch_spi_board_data *board_dat, @@ -1283,14 +1272,6 @@ static int pch_spi_get_resources(struct pch_spi_board_data *board_dat, dev_dbg(&board_dat->pdev->dev, "%s ENTRY\n", __func__); - /* create workqueue */ - data->wk = create_singlethread_workqueue(KBUILD_MODNAME); - if (!data->wk) { - dev_err(&board_dat->pdev->dev, - "%s create_singlet hread_workqueue failed\n", __func__); - retval = -EBUSY; - goto err_return; - } /* reset PCH SPI h/w */ pch_spi_reset(data->master);