From patchwork Sun Aug 14 05:25:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaktipriya Shridhar X-Patchwork-Id: 9278661 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 F112B6086A for ; Sun, 14 Aug 2016 09:28:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1EDE28A28 for ; Sun, 14 Aug 2016 09:28:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D696528A3B; Sun, 14 Aug 2016 09:28:49 +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=unavailable 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 816C428A2A for ; Sun, 14 Aug 2016 09:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753133AbcHNJ2e (ORCPT ); Sun, 14 Aug 2016 05:28:34 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:34187 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbcHNJ2c (ORCPT ); Sun, 14 Aug 2016 05:28:32 -0400 Received: by mail-pa0-f67.google.com with SMTP id hh10so1973045pac.1; Sun, 14 Aug 2016 02:28:31 -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=ke5mofVqTa1p4aME5lWs4zTDTEGwTQ8+S1+YuNdPaWU=; b=v/RcLTpf2MYkAZN1b+90Go8RqQZnXoThnxHrmVYl+iVrWpEtmNb5AWCUIpBzsXr7R3 75xRjcFtlgdnoyB/rkrDpfKOsUYHVYO1emk21PgoxdPji45P09LUtgoW7r6QNYDAqil0 T3MNAumIxSNhBa79U7mU3vzwpNtlpp6HZz9V85Povz5UBazwY5LwtEZkoz324y41BFPZ HnQpLL9VezlmoZWlw/RjqX+bBmpDvpcfz/2wut7MFjG0Rqnh9qZISZHFQbSLPEAyrqYi 3QjsGe0tXUo9X6d+8VWV3vBpjlIVfLxHGZ8Qv253utb9WQQxVB+veL+qgKeXu7zv/bl3 ASzQ== 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=ke5mofVqTa1p4aME5lWs4zTDTEGwTQ8+S1+YuNdPaWU=; b=b8R6toC581wi7qN2cyP0bDhoDKgYR4PYNS9dFkV6Jjpv3AW5EZnEsKKE4/xySGKjaR ZMmnthes2N0kVHoGIwPMhgOB8FEreY0bAX/4vKPfzEul8fexkhDGkjlXcu0g8rxXEVEB dtXKD7UwSpwkmGmKqZRbRhJH2xkcBW3/WlI3c5NKU5UvHScEk3F/ZxPjHXp/7UWlHtny gPfIXMViH4mPoOm7VtDv4ggqYqMUJ3DCWmoguGdLT08fCldUbeojs3z3yUgH5yLoDtet huAgoMGGLKYTlj0BbwkquUIFyst3mhKTjnSlBsudqd+MvXvxXgvq/KimJAEO+UspvrZE aghg== X-Gm-Message-State: AEkoouvqMPkn9tCIY4lAczYaBK4lINOL+HOXl503gDfQanlbTf2kawt0CPkCOiplazcMug== X-Received: by 10.66.100.230 with SMTP id fb6mr41887368pab.107.1471152334084; Sat, 13 Aug 2016 22:25:34 -0700 (PDT) Received: from Karyakshetra ([14.139.82.6]) by smtp.gmail.com with ESMTPSA id b68sm23665832pfg.85.2016.08.13.22.25.32 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 22:25:33 -0700 (PDT) Date: Sun, 14 Aug 2016 10:55:30 +0530 From: Bhaktipriya Shridhar To: Dmitry Torokhov , Hans de Goede , Pali =?iso-8859-1?Q?Roh=E1r?= , Chris Diamand , Stefan Assmann , Richard Pospesel , Lars-Peter Clausen , Takashi Iwai Cc: Tejun Heo , patches@opensource.wolfsonmicro.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] Input: touchscreen: mc13783_ts: Remove deprecated create_singletheread_workqueue Message-ID: <0fec13b74998216009d338fad3e143a3488e0b4a.1471151622.git.bhaktipriya96@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The workqueue "workqueue" has a single workitem(&priv->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. Workitem is sync cancelled in mc13783_ts_remove() to ensure that there are no workitems pending when the driver is disconnected. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo --- drivers/input/touchscreen/mc13783_ts.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" 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/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c index 913e25a..3b19035 100644 --- a/drivers/input/touchscreen/mc13783_ts.c +++ b/drivers/input/touchscreen/mc13783_ts.c @@ -37,7 +37,6 @@ struct mc13783_ts_priv { struct input_dev *idev; struct mc13xxx *mc13xxx; struct delayed_work work; - struct workqueue_struct *workq; unsigned int sample[4]; struct mc13xxx_ts_platform_data *touch; }; @@ -54,7 +53,7 @@ static irqreturn_t mc13783_ts_handler(int irq, void *data) * be rescheduled for immediate execution here. However the rearm * delay is HZ / 50 which is acceptable. */ - queue_delayed_work(priv->workq, &priv->work, 0); + schedule_delayed_work(&priv->work, 0); return IRQ_HANDLED; } @@ -106,7 +105,7 @@ static void mc13783_ts_report_sample(struct mc13783_ts_priv *priv) dev_dbg(&idev->dev, "report (%d, %d, %d)\n", x1, y1, 0x1000 - cr0); - queue_delayed_work(priv->workq, &priv->work, HZ / 50); + schedule_delayed_work(&priv->work, HZ / 50); } else dev_dbg(&idev->dev, "report release\n"); @@ -189,14 +188,6 @@ static int __init mc13783_ts_probe(struct platform_device *pdev) goto err_free_mem; } - /* - * We need separate workqueue because mc13783_adc_do_conversion - * uses keventd and thus would deadlock. - */ - priv->workq = create_singlethread_workqueue("mc13783_ts"); - if (!priv->workq) - goto err_free_mem; - idev->name = MC13783_TS_NAME; idev->dev.parent = &pdev->dev; @@ -215,14 +206,12 @@ static int __init mc13783_ts_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "register input device failed with %d\n", ret); - goto err_destroy_wq; + goto err_free_mem; } platform_set_drvdata(pdev, priv); return 0; -err_destroy_wq: - destroy_workqueue(priv->workq); err_free_mem: input_free_device(idev); kfree(priv); @@ -233,7 +222,7 @@ static int mc13783_ts_remove(struct platform_device *pdev) { struct mc13783_ts_priv *priv = platform_get_drvdata(pdev); - destroy_workqueue(priv->workq); + cancel_delayed_work_sync(&priv->work); input_unregister_device(priv->idev); kfree(priv);