From patchwork Sun Sep 4 15:57:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaktipriya Shridhar X-Patchwork-Id: 9312653 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 4596060760 for ; Sun, 4 Sep 2016 15:55:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 355C728549 for ; Sun, 4 Sep 2016 15:55:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A19E28846; Sun, 4 Sep 2016 15:55:14 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DC5D28549 for ; Sun, 4 Sep 2016 15:55:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 515BE26657F; Sun, 4 Sep 2016 17:55:11 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5EAE8266178; Sun, 4 Sep 2016 17:55:04 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4D00B26640F; Sun, 4 Sep 2016 17:55:02 +0200 (CEST) Received: from mail-pa0-f65.google.com (mail-pa0-f65.google.com [209.85.220.65]) by alsa0.perex.cz (Postfix) with ESMTP id 8C6EB265D68 for ; Sun, 4 Sep 2016 17:54:45 +0200 (CEST) Received: by mail-pa0-f65.google.com with SMTP id hm5so3538152pac.1 for ; Sun, 04 Sep 2016 08:54:45 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ET3LnUypQNP3A224FvOoXpoIOQHD9z/NjaTcLx/ucpk=; b=bZjDluhBd7vK4bOmx/KMOowzRzfrs1PK60meSeIoNQe3rsY9GbQFUsPVk2Up6baf7i IcVi8wFIvBAtVTcrCzRKZAFbYfpQh3av8+MkGskQs7wWtjUP/y9q8hr2H+nrkJ0A4OkO M4yBBz1ymeLC9TBnNfuWbSI4/qx4xl0YJadHARWKAgVuCoF9+4sHzRMPMADQMkmicyY9 KG5XT8SQL/NOWKo7w5ghEF43MpDhX6avfjt8ssd/JeoDdqB/HPAI3WlR3CevhELjQiuU GDOVhzDcx+2id+b3C4wUoAHt/LgWLgEre0McPKybmYsDBH8VQgdL6xkAJVhv8X1YA0xR Z6ww== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ET3LnUypQNP3A224FvOoXpoIOQHD9z/NjaTcLx/ucpk=; b=mv0ee1/krIiZs8tXydZjz1umqD3bGy0WXRWzWmE5p5BUVSPFSBSzJegE3ypm6n1P1U I7fq3jK68GOrIpDbCUG4ilZadysbpyZ+iLFYxnXx2+sPq2/z5xMjp4kWlZG2UokBSGTJ HNQRTJ9EW2mlDH9joVZhVGaCLETj7ReY1RPFTuT6kT5LXZlCW9GS0S1X7GL13dP/xhNO gbCzpMmr8chFNQ6/AU4KEqxouePshbT6gnNa0pob8OLE7JbggKDB9673ADt4jfPKo0Hp 2BD4+HmtJj/07kCNX2mTslBS6RESQq763nATwml58I/knA6fkRx1ioCI3JgyIqp3K5Bc IoPg== X-Gm-Message-State: AE9vXwOfw4UzxttrjbXriuCIIEe+jiX+N3vjx//jZpoCDZk5OiPcWpGsy0PSbxsEpqFagw== X-Received: by 10.66.248.10 with SMTP id yi10mr55546126pac.31.1473004482143; Sun, 04 Sep 2016 08:54:42 -0700 (PDT) Received: from Karyakshetra ([14.139.82.6]) by smtp.gmail.com with ESMTPSA id h17sm4061541pfk.59.2016.09.04.08.54.41 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Sep 2016 08:54:41 -0700 (PDT) Date: Sun, 4 Sep 2016 21:27:32 +0530 From: Bhaktipriya Shridhar To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Message-ID: <26fb1f9d167bb4f3755fabaaa2a00562b49b41d4.1473004491.git.bhaktipriya96@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Tejun Heo , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH v4 1/2] ASoC: tlv320dac33: Remove deprecated create_singlethread_workqueue X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The workqueue "dac33_wq" queues a single work item &dac33->work and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, it has been converted to use 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. The work item has been flushed in dac33_soc_remove to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar --- Changes in v4: -No change. Split the patch into a patch set. sound/soc/codecs/tlv320dac33.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) -- 2.1.4 diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index f7a6ce7..6822ac1 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -90,7 +90,6 @@ static const char *dac33_supply_names[DAC33_NUM_SUPPLIES] = { struct tlv320dac33_priv { struct mutex mutex; - struct workqueue_struct *dac33_wq; struct work_struct work; struct snd_soc_codec *codec; struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES]; @@ -771,7 +770,7 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev) /* Do not schedule the workqueue in Mode7 */ if (dac33->fifo_mode != DAC33_FIFO_MODE7) - queue_work(dac33->dac33_wq, &dac33->work); + schedule_work(&dac33->work); return IRQ_HANDLED; } @@ -1127,7 +1126,7 @@ static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (dac33->fifo_mode) { dac33->state = DAC33_PREFILL; - queue_work(dac33->dac33_wq, &dac33->work); + schedule_work(&dac33->work); } break; case SNDRV_PCM_TRIGGER_STOP: @@ -1135,7 +1134,7 @@ static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (dac33->fifo_mode) { dac33->state = DAC33_FLUSH; - queue_work(dac33->dac33_wq, &dac33->work); + schedule_work(&dac33->work); } break; default: @@ -1410,14 +1409,6 @@ static int dac33_soc_probe(struct snd_soc_codec *codec) dac33->irq = -1; } if (dac33->irq != -1) { - /* Setup work queue */ - dac33->dac33_wq = - create_singlethread_workqueue("tlv320dac33"); - if (dac33->dac33_wq == NULL) { - free_irq(dac33->irq, codec); - return -ENOMEM; - } - INIT_WORK(&dac33->work, dac33_work); } } @@ -1437,7 +1428,7 @@ static int dac33_soc_remove(struct snd_soc_codec *codec) if (dac33->irq >= 0) { free_irq(dac33->irq, dac33->codec); - destroy_workqueue(dac33->dac33_wq); + flush_work(&dac33->work); } return 0; }