From patchwork Mon Jul 25 15:05:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaktipriya Shridhar X-Patchwork-Id: 9245889 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 DE0F3607D3 for ; Mon, 25 Jul 2016 15:06:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFB2225250 for ; Mon, 25 Jul 2016 15:06:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C380D26E5D; Mon, 25 Jul 2016 15:06: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 6387B25250 for ; Mon, 25 Jul 2016 15:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752835AbcGYPF7 (ORCPT ); Mon, 25 Jul 2016 11:05:59 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33349 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157AbcGYPF6 (ORCPT ); Mon, 25 Jul 2016 11:05:58 -0400 Received: by mail-pf0-f194.google.com with SMTP id i6so12141314pfe.0; Mon, 25 Jul 2016 08:05: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 :in-reply-to:user-agent; bh=Urcg6owAFM1e0v8ayLTRHgDJnob+vZZ7KGJhulyy89k=; b=HIYPRM9ktPIgPiekM1GHYfT1TjSwucc+nAH9+C5Lx68I2S4N78HsX+fKpEAYcxkJCb HWTvz88etCnBfp2G+0v1OcDGHtlXnT8J2ylq8liXsxM1EFOS7FypMGwcu6f50pFw/L8c StJSNw2SQdSY0/AX6ju6QRMBfr/35ijbLVCaV107x+wDA/3qA3cNTiG+jN1+YDdBss1O 1tda5ZSIPEvH7w4WQet177TWph8/upzFZTNI7SBbMDRHhNZBdmiD4AirdAVXGg6Tqaro KDRMXiYQCwnmAaTL8wkjJZHbsdwUg7E/9yD+IKui16arEsfr0UXZMr7lYR7uirHR1Svl 7UMQ== 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:in-reply-to:user-agent; bh=Urcg6owAFM1e0v8ayLTRHgDJnob+vZZ7KGJhulyy89k=; b=GpDqP/vzcrk7lNotkfJMi0WxPbqp3Eu5XWFyBJCiGYyFhB5BoEZiGiaXNue4KOoL0s Tj9LN0t7A5Kx9jajMHjN1SGXSmIXvK2aV9woHs9j3I2ObgZkCfvFdGdzPM1QqVz/INaC RqFJHoKYvRMFBoIN29GtUfA1p5lA9ERMc/NzG43FNzwvJFEBqgnXSgrqonGPoo4PT9lk 7OO9Mxsx74rVDFzS6WFHJySHhKEF4U+wSSJ0DsEARsRM5i6uLEg+/5nWL8DsyVvuNa4o NMzA3pr+h3mICQldTNNh+HRbjHh+eSGTfRXrS+QTINWsmaTQt7OTR5N7sDAREivCGnwT /6NQ== X-Gm-Message-State: AEkoousvGoVXFEX74DwRTel2AErgSGCIeTQo/OtbDYQwaTK3I8TgPrEt8klGJRnWrlZ6vQ== X-Received: by 10.98.201.2 with SMTP id k2mr30256808pfg.95.1469459157497; Mon, 25 Jul 2016 08:05:57 -0700 (PDT) Received: from Karyakshetra ([203.187.238.3]) by smtp.gmail.com with ESMTPSA id e72sm40929046pfb.49.2016.07.25.08.05.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jul 2016 08:05:56 -0700 (PDT) Date: Mon, 25 Jul 2016 20:35:53 +0530 From: Bhaktipriya Shridhar To: Mauro Carvalho Chehab , Geunyoung Kim , Junghak Sung , Hans Verkuil , Inki Dae Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] [media] cx25821: Remove deprecated create_singlethread_workqueue Message-ID: <4499de0921c2455eb6299f543a18186a769dbef3.1469458280.git.bhaktipriya96@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160725144952.GA11594@Karyakshetra> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The workqueue "_irq_audio_queues" runs the audio upstream handler. It has a single work item(&dev->_audio_work_entry) 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. The work item has been flushed in cx25821_stop_upstream_audio() to ensure that nothing is pending when the driver is disconnected. Signed-off-by: Bhaktipriya Shridhar --- Changes in v2: -Flushed work item and updated the commit description to reflect the same. drivers/media/pci/cx25821/cx25821-audio-upstream.c | 14 ++------------ drivers/media/pci/cx25821/cx25821.h | 1 - 2 files changed, 2 insertions(+), 13 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" 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/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c index 05bd957..7c8edb6 100644 --- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c @@ -242,8 +242,7 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) dev->_audioframe_count = 0; dev->_audiofile_status = END_OF_FILE; - destroy_workqueue(dev->_irq_audio_queues); - dev->_irq_audio_queues = NULL; + flush_work(&dev->_audio_work_entry); kfree(dev->_audiofilename); } @@ -446,8 +445,7 @@ static int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, dev->_audioframe_index = dev->_last_index_irq; - queue_work(dev->_irq_audio_queues, - &dev->_audio_work_entry); + schedule_work(&dev->_audio_work_entry); } if (dev->_is_first_audio_frame) { @@ -639,14 +637,6 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) /* Work queue */ INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler); - dev->_irq_audio_queues = - create_singlethread_workqueue("cx25821_audioworkqueue"); - - if (!dev->_irq_audio_queues) { - printk(KERN_DEBUG - pr_fmt("ERROR: create_singlethread_workqueue() for Audio FAILED!\n")); - return -ENOMEM; - } dev->_last_index_irq = 0; dev->_audio_is_running = 0; diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h index a513b68..c813d88 100644 --- a/drivers/media/pci/cx25821/cx25821.h +++ b/drivers/media/pci/cx25821/cx25821.h @@ -294,7 +294,6 @@ struct cx25821_dev { u32 audio_upstream_riscbuf_size; u32 audio_upstream_databuf_size; int _audioframe_index; - struct workqueue_struct *_irq_audio_queues; struct work_struct _audio_work_entry; char *input_audiofilename;