From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47B9DC433DF for ; Fri, 15 May 2020 16:52:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2874B207C3 for ; Fri, 15 May 2020 16:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726221AbgEOQw2 (ORCPT ); Fri, 15 May 2020 12:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726023AbgEOQw2 (ORCPT ); Fri, 15 May 2020 12:52:28 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4E7C061A0C; Fri, 15 May 2020 09:52:28 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id C9C712A333A From: Andrzej Pietrasiewicz To: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Kukjin Kim , Krzysztof Kozlowski , Andrzej Pietrasiewicz , kernel@collabora.com Subject: [PATCHv2 4/7] iio: adc: exynos: Use input_device_enabled() Date: Fri, 15 May 2020 18:52:10 +0200 Message-Id: <20200515165210.28813-1-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515164943.28480-1-andrzej.p@collabora.com> References: <20200515164943.28480-1-andrzej.p@collabora.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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..1253d94089a7 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); + cont = input_device_enabled(info->input); + mutex_unlock(&info->input); + 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); + cont = input_device_enabled(info->input); + mutex_unlock(&info->input); } writel(0, ADC_V1_CLRINTPNDNUP(info->regs)); -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CD42C433DF for ; Fri, 15 May 2020 16:52:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 63082206C0 for ; Fri, 15 May 2020 16:52:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lNVwazCN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63082206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=MsHNEL06jX/GaVVaxbzQIpn7y2W6JYK0rfRyuRSLEW4=; b=lNVwazCNoOtp91lCkeS1RNCy3f fFr+CO8PcTDVs3thUb8tF5FdW83eWba0sFJI+IN1f7ERfjRHO/khWRuhwiAwE1JShenTlcZDCJZdj hRQtENI9LnTu61YVeLmzbgB3da4YvcoihI2VFZPMuScUeiolXQVBBCgbg/ykQO1Wov47C90tzsZi4 BVoCmDt+2R+BLzCZYHllG+pEWqy012Dp+bN4XEbrXaCtYQmbaqWp/tS+qH5h/v8vSnn0DKP8cFRZL +NWiOqPUDtWzrOM1UoXpWdYs550xVKbS6VO0000Ah8p/O7aPHtXmhbph6JldSZyio//h1mTNjg6EA YhK6Zu4A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZdZi-0008Rg-Kd; Fri, 15 May 2020 16:52:42 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZdZU-0008HX-K6 for linux-arm-kernel@lists.infradead.org; Fri, 15 May 2020 16:52:34 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id C9C712A333A From: Andrzej Pietrasiewicz To: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCHv2 4/7] iio: adc: exynos: Use input_device_enabled() Date: Fri, 15 May 2020 18:52:10 +0200 Message-Id: <20200515165210.28813-1-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200515164943.28480-1-andrzej.p@collabora.com> References: <20200515164943.28480-1-andrzej.p@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200515_095229_016298_BD48FF46 X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lars-Peter Clausen , Krzysztof Kozlowski , Andrzej Pietrasiewicz , Kukjin Kim , Peter Meerwald-Stadler , Hartmut Knaack , kernel@collabora.com, Jonathan Cameron MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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..1253d94089a7 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); + cont = input_device_enabled(info->input); + mutex_unlock(&info->input); + 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); + cont = input_device_enabled(info->input); + mutex_unlock(&info->input); } writel(0, ADC_V1_CLRINTPNDNUP(info->regs)); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel