Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2310724ybg; Fri, 5 Jun 2020 10:36:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXuU5fyMNvihUsXz78Hzfr/N7a9tFuj7MY4cz+J0w76myQoOl7W5a0vWZp8verLzJG/I+v X-Received: by 2002:a50:a207:: with SMTP id 7mr6594528edl.92.1591378619353; Fri, 05 Jun 2020 10:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591378619; cv=none; d=google.com; s=arc-20160816; b=JQALdc0n585w58TYv5miGCphE9ik+IuqfvS93jJrQsMoNSLp822DSsSpg2au/FG4ld WnWlolS9vTldOAV91mSx7MuKgOYWmouUncaLtKCNxyhRM08YD2i6pbIJD/cjEOQt6lNY /m/QTtfiwE9t2GpXPsc1V4Y6d0rwzEna6EDGSv14u+hJey5v1SJwOG2r65ebOQL1Y4Yj DF+nPztKdwyeGIwVfx+NlvTV6Tr8oXtvFWT5UZWSR3Sbo3Jt5l27BseoxncpxD/zkWGw uYRVj18R+X5Ux2SvIDiRoOAXNPjiVexzsY/EXhzgzB2HeUmjci91zk0qmWrDXIdHGD0z Z1lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=3wShobfmOnwq5MjMmpDtpTneqjwKd7PbkWzBakZ1Ndc=; b=tdIQIoacijMqT5hsHE4YCHvKyiHZnNWxLGuVJ89p2it8ReMTMxvx3+o2CoO9cSJZYU CaskRx4yloyAcyuwNmxhtTFlvIGWKpH11ISSFq09nS2Nn2gopoxBoJ4I+mB3o3yvmFxU o2DwO437aUgUzyzewS3o+gjRCQQuDozy1CaWgTaddC4yRcBGxGAltLTIrOJv7FXPhaIr /mw7rtT1pOqtjSog1AATRsZe3X7llUjjkfS8vDoJve+Cjf1IpZR+91UorrXfQqhTBjNO cgrI6KJBDA6EJPBga0GFOwOIjgc+aWyQn9RbptNEv2JxZjIJwhwfaezs/C7pXvLkS7SH wu8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si4301278edh.53.2020.06.05.10.36.37; Fri, 05 Jun 2020 10:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728303AbgFEReY (ORCPT + 99 others); Fri, 5 Jun 2020 13:34:24 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39126 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728056AbgFERd5 (ORCPT ); Fri, 5 Jun 2020 13:33:57 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id AFFDA2A5089 From: Andrzej Pietrasiewicz To: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-input@vger.kernel.org, linux-tegra@vger.kernel.org, patches@opensource.cirrus.com, ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: "Rafael J . Wysocki" , Len Brown , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Kukjin Kim , Krzysztof Kozlowski , Dmitry Torokhov , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vladimir Zapolskiy , Sylvain Lemieux , Laxman Dewangan , Thierry Reding , Jonathan Hunter , Barry Song , Michael Hennerich , Nick Dyer , Hans de Goede , Ferruh Yigit , Sangwon Jee , Peter Hutterer , Henrique de Moraes Holschuh , Andrzej Pietrasiewicz , kernel@collabora.com Subject: [PATCH v3 5/7] iio: adc: exynos: Use input_device_enabled() Date: Fri, 5 Jun 2020 19:33:33 +0200 Message-Id: <20200605173335.13753-6-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605173335.13753-1-andrzej.p@collabora.com> References: <20200604072853.GP89269@dtor-ws> <20200605173335.13753-1-andrzej.p@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A new helper is available, so use it. Inspecting 'users' member of input_dev requires taking device's mutex. Signed-off-by: Andrzej Pietrasiewicz --- drivers/iio/adc/exynos_adc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 22131a677445..294715bafe25 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -630,10 +630,13 @@ static irqreturn_t exynos_ts_isr(int irq, void *dev_id) struct exynos_adc *info = dev_id; struct iio_dev *dev = dev_get_drvdata(info->dev); u32 x, y; - bool pressed; + bool pressed, cont; int ret; - while (info->input->users) { + mutex_lock(&info->input->mutex); + cont = input_device_enabled(info->input); + mutex_unlock(&info->input->mutex); + while (cont) { ret = exynos_read_s3c64xx_ts(dev, &x, &y); if (ret == -ETIMEDOUT) break; @@ -651,6 +654,10 @@ static irqreturn_t exynos_ts_isr(int irq, void *dev_id) input_sync(info->input); usleep_range(1000, 1100); + + mutex_lock(&info->input->mutex); + cont = input_device_enabled(info->input); + mutex_unlock(&info->input->mutex); } writel(0, ADC_V1_CLRINTPNDNUP(info->regs)); -- 2.17.1