From patchwork Wed Apr 5 21:22:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= X-Patchwork-Id: 79958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3d4a:b0:114:e959:cc0c with SMTP id b10csp630219rwc; Wed, 5 Apr 2023 14:30:13 -0700 (PDT) X-Google-Smtp-Source: AKy350aPRDDBBN3T4rd99scuUYvvFl2+TzqyCSyJE3IOElfAsgyIhPCSqtfa0qw93qq0vINgS3DQ X-Received: by 2002:a17:906:5e53:b0:946:bd15:b13f with SMTP id b19-20020a1709065e5300b00946bd15b13fmr3846029eju.44.1680730212821; Wed, 05 Apr 2023 14:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680730212; cv=none; d=google.com; s=arc-20160816; b=cb3VSTYE7IGVAiyh2rbxZD0pRKAAgdujn6bw3vloC3c670fDepYQQSGRqeOYiDSInB mx9GX1BFHmkmOEmRcFyQM7t8pUFNtNbKd44pXgXiyUokb/qwDnHiRA3NR5b3t5o+fbSP hz6P6TdsaNxDnfS6fs4hSAyIYfZewVCp1w3zob4XNWxQmMS/62PDggrsKwPkAZkiY7Vj 0YrnXrXVYPjbme/92DydLuVy5GfilgpPzjF1ADmSSu6P1M+FIk6Ues7nuhV0f71y/VOf tr5SQHUai/LZ+QO/kRs9IqsNJyNJQaq9pXwFAqydh3dQlrL+SFbXRPcXjIIhuz6luEWe faJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=TmuWTPcVR6kjhWZxrkfB1qR/xKdRysUauxZUpzZtF7k=; b=OilhboKef/Py/+XJOkfkhKzc9ZgDTTZzLsfcHVKoVkPbG1J0K4lk+CkXcJsFoIgBJ/ yzJpk0IRPEzTMacDWAgNVbAUkcvzHZ+7ZA1Iyygy+I3XnWNT4a55/Om3Q00vp2dTltkm kIMgxf8xF5t9vbBvSKFGuO8kZ2NWR/2/5N8Cl/O5MX78IE6eK+3/W88olx4r2wM6QLyf fiNRIt4cx8jOVsWLl5eb9B4BgQQoWqPwCnjHvcf7T3d26ArKa5ztxKFJv00vGHXMODR4 Vu0wUkqBpC9WHIWT4Wgp8wSxRZlWQng8qMet+Iy2cJYxtFALi/HIrohx3t2ZG0hewzWE gMEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=PSPEYxqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dalakolonin.se Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a17090694d500b0092cdece0c4csi12753757ejy.201.2023.04.05.14.29.46; Wed, 05 Apr 2023 14:30:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=PSPEYxqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dalakolonin.se Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234297AbjDEVXf (ORCPT + 99 others); Wed, 5 Apr 2023 17:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233855AbjDEVX3 (ORCPT ); Wed, 5 Apr 2023 17:23:29 -0400 Received: from pio-pvt-msa1.bahnhof.se (pio-pvt-msa1.bahnhof.se [79.136.2.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DD97DA4; Wed, 5 Apr 2023 14:23:14 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 62BBF3FA21; Wed, 5 Apr 2023 23:23:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.099 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Authentication-Results: pio-pvt-msa1.bahnhof.se (amavisd-new); dkim=pass (2048-bit key) header.d=dalakolonin.se Received: from pio-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IcLgFRpfqez1; Wed, 5 Apr 2023 23:23:12 +0200 (CEST) Received: by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id 6B7123F870; Wed, 5 Apr 2023 23:23:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id F3D0B94E01; Wed, 5 Apr 2023 21:23:08 +0000 (UTC) Received: from zimbra.dalakolonin.se ([127.0.0.1]) by localhost (zimbra.dalakolonin.se [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mHGQsfKd3kNV; Wed, 5 Apr 2023 21:23:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id DA7C694DE1; Wed, 5 Apr 2023 21:22:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se DA7C694DE1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680729778; bh=TmuWTPcVR6kjhWZxrkfB1qR/xKdRysUauxZUpzZtF7k=; h=From:To:Date:Message-Id:MIME-Version; b=PSPEYxqePHdQP9cLR80UV50OIXfmQU2Chwoq5lbcziAM7e0A6IUs6LMYPldLAlChF C66rMH+yhRkh8tAOrjUdei9uEiAcmvl2V2pZXYa4qISknTCpxVDUPundcTVvDyDoQK OntzqsIIseATFk4XoXWnamZTN3OLWYbLmM0WNOSdY7FoqHyPGJiwRRGICK/MaE0tkb DRPMSU2Lm/F/HLBMoOPJR481qN1ZPiz1c/FO67YdMEhN9c+RXm77TA0CA6Fa0sjdMt NoMD+oqyZHHOez1DZNx2bQd0U9ssHJU8TdBebbVWVIpGMoP1mZMNYtRn92m6cXcucG +Cga0AS/RsH+A== X-Virus-Scanned: amavisd-new at dalakolonin.se Received: from zimbra.dalakolonin.se ([127.0.0.1]) by localhost (zimbra.dalakolonin.se [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FO5mvdtNXwa9; Wed, 5 Apr 2023 21:22:57 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id C1D6A94DDA; Wed, 5 Apr 2023 21:22:56 +0000 (UTC) From: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com, pgoudagunta@nvidia.com, hns@goldelico.com, jic23@kernel.org, lars@metafoo.de, linux-omap@vger.kernel.org, =?utf-8?q?Pa?= =?utf-8?q?trik_Dahlstr=C3=B6m?= Subject: [PATCH v3 4/7] iio: adc: palmas: move eventX_enable into palmas_adc_event Date: Wed, 5 Apr 2023 23:22:30 +0200 Message-Id: <20230405212233.4167986-5-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230405212233.4167986-1-risca@dalakolonin.se> References: <20230405212233.4167986-1-risca@dalakolonin.se> MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762373363639515308?= X-GMAIL-MSGID: =?utf-8?q?1762373363639515308?= It just makes more sense to have all information regarding adc events in one place. Signed-off-by: Patrik Dahlström --- drivers/iio/adc/palmas_gpadc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 205a7628b235..8c6ea4a3cd2e 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -77,6 +77,7 @@ static struct palmas_gpadc_info palmas_gpadc_info[] = { }; struct palmas_adc_event { + bool enabled; int channel; int raw_thresh; enum iio_event_direction direction; @@ -119,8 +120,6 @@ struct palmas_gpadc { struct completion conv_completion; struct palmas_adc_event event0; struct palmas_adc_event event1; - bool event0_enable; - bool event1_enable; int auto_conversion_period; struct mutex lock; }; @@ -617,7 +616,7 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc) } conv = 0; - if (adc->event0_enable) { + if (adc->event0.enabled) { struct palmas_adc_event *ev = &adc->event0; int polarity; @@ -653,7 +652,7 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc) } } - if (adc->event1_enable) { + if (adc->event1.enabled) { struct palmas_adc_event *ev = &adc->event1; int polarity; @@ -728,7 +727,7 @@ static int palmas_gpadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct palmas_gpadc *adc = iio_priv(indio_dev); - int wakeup = adc->event0_enable || adc->event1_enable; + int wakeup = adc->event0.enabled || adc->event1.enabled; int ret; if (!device_may_wakeup(dev) || !wakeup) @@ -738,10 +737,10 @@ static int palmas_gpadc_suspend(struct device *dev) if (ret < 0) return ret; - if (adc->event0_enable) + if (adc->event0.enabled) enable_irq_wake(adc->irq_auto_0); - if (adc->event1_enable) + if (adc->event1.enabled) enable_irq_wake(adc->irq_auto_1); return 0; @@ -751,7 +750,7 @@ static int palmas_gpadc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct palmas_gpadc *adc = iio_priv(indio_dev); - int wakeup = adc->event0_enable || adc->event1_enable; + int wakeup = adc->event0.enabled || adc->event1.enabled; int ret; if (!device_may_wakeup(dev) || !wakeup) @@ -761,10 +760,10 @@ static int palmas_gpadc_resume(struct device *dev) if (ret < 0) return ret; - if (adc->event0_enable) + if (adc->event0.enabled) disable_irq_wake(adc->irq_auto_0); - if (adc->event1_enable) + if (adc->event1.enabled) disable_irq_wake(adc->irq_auto_1); return 0;