From patchwork Fri Dec 30 23:22:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 37782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3107430wrt; Fri, 30 Dec 2022 15:23:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXuUDhckMB3ZKIKGrcc2s3M03+5qH4HeO83nvAlZkAK6kBuCq9AeWt/wJdqVYkG5BtqRUD2H X-Received: by 2002:a17:902:ce02:b0:18f:a5b6:54f9 with SMTP id k2-20020a170902ce0200b0018fa5b654f9mr36779955plg.11.1672442616153; Fri, 30 Dec 2022 15:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672442616; cv=none; d=google.com; s=arc-20160816; b=bF0qLitKkEPA6QgZb2CCstEa8VvVbwJVBq4VRfc/9qeQ8oZcW/uiufCMyIsAc3DHEZ evP1p35j9esRkVunlR7Z9Si+G8uspldzeqyUxezIPzWo5kzZ9fKCRmkH0eO6tlFjBwHJ iCzmqd3KGzT/1iTQtIw09p9mdhzC2Bh1ARX7IosjdsLuQJQ9zNJD5MSwlBdWcgxDTYM6 rqoQzyeTv4HcmMIGISks+jO8TBaO4KgFTPtbbL5qD+OKIf3WQh7WqZp6N0aA3Vm8wS7q moQJ6dEnJiJiJrV7rd6PPkeE3i9/1OrU7LDt/61tu17KAWtXneqmXVeIEO7rX7ZknM6z kWKw== 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; bh=jLNS1jPjRsNhBYA/KqVgb16Kll0yMpBx8G2zVP5MVaM=; b=RDe2Y2L9NCeUJ6fCkjrIPaPwNJZGELtoWljRdLEo0BKYRW1H6yX3SZfCub++Moac+y sbWRjeScYhxjO3hFVZifMND89ESTgXJqtr7fLMLCFsghWiJ9kdEDtRu5+IglI8rmBMcA k2VkeWGUD9ADZsNsNbmLF3QoZH//kZWdZr0KgFiT0iTBaLTWspkmIt1lukiMpSuKkJWG fIkWErktk9lx0UoYa7QQkCCMN4j6G+rYPfZIY0J08JUk7hXbzhLCRduZnauU0yaIP5Ry PWnBLi7QaSzr3twBuo6Tkmnb4azgGBHnk17mdv4PWomTdImzeAnmpqE+IpMctoWCXsyp gL/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RY25bn77; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a170902c40d00b0018678dab05dsi25034794plk.199.2022.12.30.15.23.24; Fri, 30 Dec 2022 15:23:36 -0800 (PST) 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=@linaro.org header.s=google header.b=RY25bn77; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235721AbiL3XWu (ORCPT + 99 others); Fri, 30 Dec 2022 18:22:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235711AbiL3XWi (ORCPT ); Fri, 30 Dec 2022 18:22:38 -0500 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842531DDC1 for ; Fri, 30 Dec 2022 15:22:37 -0800 (PST) Received: by mail-il1-x136.google.com with SMTP id d14so12065464ilq.11 for ; Fri, 30 Dec 2022 15:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jLNS1jPjRsNhBYA/KqVgb16Kll0yMpBx8G2zVP5MVaM=; b=RY25bn771moxhyGB8j59tS5rFfUKBjbENFEaSk/EJZimcttEKzdxemHNjZ1wIr++Tv emzvzcg5ketdJl8xF4h76GWBR7GvYN+5mevSo7xqUwTaHWrIQOrd0FxsqCQK2W+8Efxi uulwSJd78bpwzh4/BPcJAheCv4IMuZJYyi7ElysidEut68388vUVoHnH7wHK4Pz/MJeK eq0AHEQ9/f5Hm7P5XLfjGiWWgl4U3Jazs0Hy2+8bc7BWhYtOEu0WGY8onmOfivGa0XTN 1S01iJ8qzUyBqxz/X8wuOIBVdnL+xaP+47vq20/oF5BPydJLBZbIGAQQClGmYJARpvnD cIpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jLNS1jPjRsNhBYA/KqVgb16Kll0yMpBx8G2zVP5MVaM=; b=7er6GMY5UtCgH2tVwi01LP9UnFH0hS3yBL/9pyyMG4o8q8VmZx7Eu28LrXZ7bk5TpU k6gUia2F5ZmwaDDRWS+gf7k3i/8Mpp11HqW1Rm291AaeaVFmXNzPDWGNVeIXrZgrt5+7 8/vy81WpbVclooRQaEqSsbR3Fv7+XPrj1HNGZ9aYD4H7r3XSu3198usGI37Ue1XCLAvu 2I6QzgEZ+RpR543hjZzqKoVZuxdCETKsysRoeNlRMYpTC1JdhR+XlOLSsKYG8TR3kIMT S0lcGpsq6pUEI4XiTvAJryhgaZLoaQwZhB2wHWeh8fwZdQDvU6MD1a12RymumFBY/Tz9 1Smw== X-Gm-Message-State: AFqh2kpRA99o6yxEbH+RlzNaDPkydkrBiDdhtGoMK1fEXR/kqOKpVOYQ ZATZNxulK30IRp0QR9KzvhFm0w== X-Received: by 2002:a92:d28c:0:b0:305:e0e1:56c5 with SMTP id p12-20020a92d28c000000b00305e0e156c5mr23058394ilp.19.1672442557115; Fri, 30 Dec 2022 15:22:37 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id co18-20020a0566383e1200b0038a53fb3911sm7170558jab.97.2022.12.30.15.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 15:22:36 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/6] net: ipa: enable IPA interrupt handlers separate from registration Date: Fri, 30 Dec 2022 17:22:27 -0600 Message-Id: <20221230232230.2348757-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221230232230.2348757-1-elder@linaro.org> References: <20221230232230.2348757-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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?1753683188548323531?= X-GMAIL-MSGID: =?utf-8?q?1753683188548323531?= Expose ipa_interrupt_enable() and have functions that register IPA interrupt handlers enable them directly, rather than having the registration process do that. Do the same for disabling IPA interrupt handlers. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 8 ++------ drivers/net/ipa/ipa_interrupt.h | 14 ++++++++++++++ drivers/net/ipa/ipa_power.c | 6 +++++- drivers/net/ipa/ipa_uc.c | 4 ++++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 7b7388c14806f..87f4b94d02a3f 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -135,7 +135,7 @@ static void ipa_interrupt_enabled_update(struct ipa *ipa) } /* Enable an IPA interrupt type */ -static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) { /* Update the IPA interrupt mask to enable it */ ipa->interrupt->enabled |= BIT(ipa_irq); @@ -143,7 +143,7 @@ static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) } /* Disable an IPA interrupt type */ -static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) { /* Update the IPA interrupt mask to disable it */ ipa->interrupt->enabled &= ~BIT(ipa_irq); @@ -232,8 +232,6 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt, return; interrupt->handler[ipa_irq] = handler; - - ipa_interrupt_enable(interrupt->ipa, ipa_irq); } /* Remove the handler for an IPA interrupt type */ @@ -243,8 +241,6 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) return; - ipa_interrupt_disable(interrupt->ipa, ipa_irq); - interrupt->handler[ipa_irq] = NULL; } diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h index f31fd9965fdc6..5f7d2e90ea337 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -85,6 +85,20 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); */ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt); +/** + * ipa_interrupt_enable() - Enable an IPA interrupt type + * @ipa: IPA pointer + * @ipa_irq: IPA interrupt ID + */ +void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq); + +/** + * ipa_interrupt_disable() - Disable an IPA interrupt type + * @ipa: IPA pointer + * @ipa_irq: IPA interrupt ID + */ +void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq); + /** * ipa_interrupt_config() - Configure the IPA interrupt framework * @ipa: IPA pointer diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 8420f93128a26..9148d606d5fc2 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -337,10 +337,13 @@ int ipa_power_setup(struct ipa *ipa) ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, ipa_suspend_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); ret = device_init_wakeup(&ipa->pdev->dev, true); - if (ret) + if (ret) { + ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); + } return ret; } @@ -348,6 +351,7 @@ int ipa_power_setup(struct ipa *ipa) void ipa_power_teardown(struct ipa *ipa) { (void)device_init_wakeup(&ipa->pdev->dev, false); + ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); } diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 0a890b44c09e1..af541758d047f 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -187,7 +187,9 @@ void ipa_uc_config(struct ipa *ipa) ipa->uc_powered = false; ipa->uc_loaded = false; ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_UC_0); ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_UC_1); } /* Inverse of ipa_uc_config() */ @@ -195,7 +197,9 @@ void ipa_uc_deconfig(struct ipa *ipa) { struct device *dev = &ipa->pdev->dev; + ipa_interrupt_disable(ipa, IPA_IRQ_UC_1); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); + ipa_interrupt_disable(ipa, IPA_IRQ_UC_0); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); if (ipa->uc_loaded) ipa_power_retention(ipa, false);