From patchwork Sun Apr 2 16:42:44 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: 78266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1827886vqo; Sun, 2 Apr 2023 09:46:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ac2D1vUKffnR6rBIOUWO1xm5DeK5BI+qQsOsubC3Nzh49Yt3ihPc3J+aKLJkNCVrdmlQ5s X-Received: by 2002:a62:1749:0:b0:62d:df1a:167c with SMTP id 70-20020a621749000000b0062ddf1a167cmr9159015pfx.1.1680453996173; Sun, 02 Apr 2023 09:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680453996; cv=none; d=google.com; s=arc-20160816; b=tOsCi7Sw8TAcDZK1NsUstfZ4QvSnfPhH3VDUmSWrlC4mNONOtTfxscgqc54YFGV5H2 uumJZy/bQZ8QDdjb1uIGxAJwuNzbNISa0z/wpqMNVqch8CRSdcJ/DPbCn3JwKotWmspT SaNQRZWoGyAn0iHZ0biOeuZUnLlc94CMIKeSt2nLVM5FpLw4U6JQ6NH7Jszd8Gxqh9lp b57/aWayCvDKT069Bk2KQt6xDB8+Q4Sh7imMex+leWxIU33sPlo0uFEd8CLrqPBJY966 918+3I9qeUK0J14ftlMqIwZbfuUKMCPsZpEdKY1o1VpLqXTOYmResY1PwbZxRsODXxtB OJAA== 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=nzWLhIO9b9yXx9/x0jo6puIZ0zDR+M8hdZYvMF0djdA=; b=tsWeJo+lMyjA8hUe5r1Gb62pu+x+eKmj83dzC3Fq1+gHif+2vfI4YBvSBv02jY6JOZ LB6Gh3x8inAgcXu/wFKPmDh5pDMXZVtEZt0ljx+gQDZjEkyCLiOPFpcV2/rnSKZ51G/o vvcBRlNMZy4LcD6ii1Vq1hTc7xd0l9lba/CFUCtIo9ACy0Zs+/3d8wFrC5D6dr7SwApa B6gtPOrLILQWimqk88qfNXJzawGYAfXYI6n+kIxPeqO2WB/xlNXZizu6Iyhu7A+zxzv1 ECmMVIFbL1TtOZcEhGuMVChbMexPZuJomat/Wf3Nd8Orqp0x6wzDiBxWONw0iWDSEhMC pNsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b="cMdJOf7/"; 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 123-20020a630581000000b0050bcb8e3a9esi6219545pgf.234.2023.04.02.09.46.23; Sun, 02 Apr 2023 09:46:36 -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="cMdJOf7/"; 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 S231258AbjDBQno (ORCPT + 99 others); Sun, 2 Apr 2023 12:43:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231159AbjDBQna (ORCPT ); Sun, 2 Apr 2023 12:43:30 -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 2324EE38A; Sun, 2 Apr 2023 09:43:29 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id ADAD23FDB5; Sun, 2 Apr 2023 18:43:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.1 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 0FwUw6B1vgxZ; Sun, 2 Apr 2023 18:43:27 +0200 (CEST) Received: by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id D99D93FD82; Sun, 2 Apr 2023 18:43:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id D20DB937B9; Sun, 2 Apr 2023 16:43:25 +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 lIpAZZPFtJfB; Sun, 2 Apr 2023 16:43:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 6F3DD93792; Sun, 2 Apr 2023 16:43:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se 6F3DD93792 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680453798; bh=nzWLhIO9b9yXx9/x0jo6puIZ0zDR+M8hdZYvMF0djdA=; h=From:To:Date:Message-Id:MIME-Version; b=cMdJOf7/iS7ZcfxYGbb2QdmpHaVat+mlusZk3tJ0RQqDv/D8T2wxboRM5moYqd0uk fBIWutP4DLIZixHYfIm6hMh3xCBW7NMG5E9ICgBICUqV7FxkQG5916BDy3flhZSwXq BorTyM4I0KUu8elDJ+EOKTD6a4hMPPzadwYYHQ9E60ZbFm4TfF66Gat8Az8My5ykb2 iti+ju5Y+yxtljtY9w8yf8eT2scesd/Rsqu6yTpM5/F7beu/omIbXTz3FelPV7d5zo Nvy/giygc4I60ESnP5XdNMMBA/bhP/QKrp7RDLF/3l2SvzuO1AEN70TVp7ylOkHCyZ DrPy/SOU31nkA== 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 Udpnhxm-cUPj; Sun, 2 Apr 2023 16:43:18 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id BF5EB9378A; Sun, 2 Apr 2023 16:43:17 +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 v2 4/7] iio: adc: palmas: move eventX_enable into palmas_adc_event Date: Sun, 2 Apr 2023 18:42:44 +0200 Message-Id: <20230402164247.3089146-5-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230402164247.3089146-1-risca@dalakolonin.se> References: <20230402164247.3089146-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?1762083729481898882?= X-GMAIL-MSGID: =?utf-8?q?1762083729481898882?= 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 fca455a4285e..f7eb445495b6 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; }; @@ -616,7 +615,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; @@ -652,7 +651,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; @@ -727,7 +726,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) @@ -737,10 +736,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; @@ -750,7 +749,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) @@ -760,10 +759,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;