From nobody Tue Sep 16 17:56:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F082C4332F for ; Fri, 30 Dec 2022 23:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235724AbiL3XWl (ORCPT ); Fri, 30 Dec 2022 18:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiL3XWg (ORCPT ); Fri, 30 Dec 2022 18:22:36 -0500 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507761DDC2 for ; Fri, 30 Dec 2022 15:22:35 -0800 (PST) Received: by mail-il1-x133.google.com with SMTP id m15so12098052ilq.2 for ; Fri, 30 Dec 2022 15:22:35 -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=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=ZYZNnlUOkpTkj9RFdJdH5nqOqbvVZ6akzpzo3bs2kmgroaVZ2XWbhB+wWuG/xwOnDv LBhH5Xqo8vL9xzjIGtbVdt4qFpZWLV6DidrbkP5SkL+1broFvO+0ZnVsia5L6Ksl3ykz gDVqKrvgWI7Uon77gbweRmur3AjCAb4o8OGGoRyqyNDVTolRK8cShKrR0I4KEZJ1iJen Anwj4MKvDd+Fr3nfbULRJExr2nvJtOz5ttJGJW4BPpK+WzkUpUDLjMCvOi3x7oLLtWDN 5yzvZL8/yCwGVMDps/VACLEnIB7S3YaPF9uyxpbnHPOg8krLP23UUChtq5Frei1K6oHV Mq/A== 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=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=gJSU4TzTVHQBKdTVvMsIwZ/IAX08pajVbNZDnYSyhDveaOD5X/PKpUOZ2YUVLhv2g0 sVUj4VLRa98xybmg7q/QzgtMJSHP+lNvWVN9F54UKMum90yWnJE8SH3m18cwWVhtS7SO YL69xdwNpAoy1VN1c8ZHCj6TPDk9RQ/s7itSSt69eZy2mIRwBcHQABHULaK25EYVnYX/ 1Z5ximPOgY6tUVgGJY3ebEB55RS2+pumaQItDqD7+GGhCYODS5bL2+H4n7+uj3ZvFdv6 s6J1rBSkI/1VuC3m8FxxGF058+8RHkJ/YOVaS+0RUZUmOtkl+xJzpvA7xwQJWZDdXpBp o09w== X-Gm-Message-State: AFqh2krnJKjVyIP5QghwIUniD3aMr6S6cfyaFJKtyz8k60o3wYzY++Er N/HkjMQWXoIIwP4yVsv3wRY5AQ== X-Google-Smtp-Source: AMrXdXvdocMfWO8HGIymmgpF7Pf8/58co9uNQyH3dB6OF6qzOshTwLzLIkVw2cAja4wlZKCzyqiTWg== X-Received: by 2002:a92:c501:0:b0:30b:e92a:aa8f with SMTP id r1-20020a92c501000000b0030be92aaa8fmr16796909ilg.15.1672442554689; Fri, 30 Dec 2022 15:22:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 15:22:34 -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 1/6] net: ipa: introduce a common microcontroller interrupt handler Date: Fri, 30 Dec 2022 17:22:25 -0600 Message-Id: <20221230232230.2348757-2-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The prototype for an IPA interrupt handler supplies the IPA interrupt ID, so it's possible to use a single function to handle any type of microcontroller interrupt. Introduce ipa_uc_interrupt_handler(), which calls the event or the response handler depending on the IRQ ID provided. Register the new function as the handler for both microcontroller IPA interrupt types. The called functions don't use their "irq_id" arguments, so remove them. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_uc.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index f0ee472810153..0a890b44c09e1 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -124,7 +124,7 @@ static struct ipa_uc_mem_area *ipa_uc_shared(struct ipa= *ipa) } =20 /* Microcontroller event IPA interrupt handler */ -static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +static void ipa_uc_event_handler(struct ipa *ipa) { struct ipa_uc_mem_area *shared =3D ipa_uc_shared(ipa); struct device *dev =3D &ipa->pdev->dev; @@ -138,7 +138,7 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum = ipa_irq_id irq_id) } =20 /* Microcontroller response IPA interrupt handler */ -static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) +static void ipa_uc_response_hdlr(struct ipa *ipa) { struct ipa_uc_mem_area *shared =3D ipa_uc_shared(ipa); struct device *dev =3D &ipa->pdev->dev; @@ -170,13 +170,24 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enu= m ipa_irq_id irq_id) } } =20 +static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_= id) +{ + /* Silently ignore anything unrecognized */ + if (irq_id =3D=3D IPA_IRQ_UC_0) + ipa_uc_event_handler(ipa); + else if (irq_id =3D=3D IPA_IRQ_UC_1) + ipa_uc_response_hdlr(ipa); +} + /* Configure the IPA microcontroller subsystem */ void ipa_uc_config(struct ipa *ipa) { + struct ipa_interrupt *interrupt =3D ipa->interrupt; + ipa->uc_powered =3D false; ipa->uc_loaded =3D false; - ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler); - ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr); + ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler); + ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler); } =20 /* Inverse of ipa_uc_config() */ --=20 2.34.1 From nobody Tue Sep 16 17:56:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF45FC4332F for ; Fri, 30 Dec 2022 23:22:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235732AbiL3XWr (ORCPT ); Fri, 30 Dec 2022 18:22:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235650AbiL3XWh (ORCPT ); Fri, 30 Dec 2022 18:22:37 -0500 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829321D0E9 for ; Fri, 30 Dec 2022 15:22:36 -0800 (PST) Received: by mail-il1-x12f.google.com with SMTP id p15so1080823ilg.9 for ; Fri, 30 Dec 2022 15:22:36 -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=K4WtVwRcqcCUgmYfEzecLg1NkgyQK2BLzDcfIQJWkbQ=; b=yR2Hc5lazanlE/E/Zka7pU/a8AlDQgQOVymRxPsg72chP1ZPDjKfOTjM5yKOkLxvhH en/BWfpXJlC28tVJVnALRUO41fMi820pw1D4OY39x1ufyYa4TAKCYZNYcBxkSSZOpkfD 6QEofGFYQP/RFvfNsLitODzGh1PsEyZioSapKhGNOo3yuG9M+8KN4BOKftQq6CiVRCLp mSpxVl4NTxurXxAD481XSHegiipvU7eV0g3B1DcswDVder8H2GZNlBgAjnNz7x5Wcnw1 Gct/bp4+98R9qJm9xuTdAfihtCYhWsJZmfJu1PN+iDJvPEt/AlOQxHeOS+zEiW8hBIlY C/iQ== 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=K4WtVwRcqcCUgmYfEzecLg1NkgyQK2BLzDcfIQJWkbQ=; b=0jQBZZAuiJzfjeyzGq12UY7sBE06vVh2j8EtHHyzRvGT7gdm1sZNgV84DbepEBn3JC QFi/T3YY40GRAg5NZRxFTMJ7eAHo53lt8FpHpNFMtw/SyaB3K+ltm+CkwwWKO3MmeU+C z9CSeKF1ag0gv/ODkkjqDtmqk5LIhpa0kD7ltj4qexjtC/W3UQe6h4s07C8Li7g6TkAw 5HxroYOtH4A3/VAl+Hn4J5kuqIRKHcdXyb9nLHSO/o7ge+Jk4XEo0ruiWsh5mKR+1v/s 59VJQhk7w1cfMDa3Nux7twpwfzpJoXs+20Av8ZymOkcOqn50EQAgYnbldjH4L4MSCeck t7hg== X-Gm-Message-State: AFqh2kp0yPzxJLjr/IITRKGVBwjnmHAC+32gEGECp+79qFOA3bsgaPvq BLmA+/PR7JYqjhCqYltkqvJxzw== X-Google-Smtp-Source: AMrXdXsLV4A+gBum9yoI2gfwK4bHonG4xj06Cnj1QR3kD6dP36KOnLkE8QQH4bBdvz7UV/z0kvfZoQ== X-Received: by 2002:a05:6e02:1ba1:b0:302:c07e:49f8 with SMTP id n1-20020a056e021ba100b00302c07e49f8mr39063946ili.32.1672442555862; Fri, 30 Dec 2022 15:22:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 15:22:35 -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 2/6] net: ipa: introduce ipa_interrupt_enable() Date: Fri, 30 Dec 2022 17:22:26 -0600 Message-Id: <20221230232230.2348757-3-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Create new function ipa_interrupt_enable() to encapsulate enabling one of the IPA interrupt types. Introduce ipa_interrupt_disable() to reverse that operation. Add a helper function to factor out the common register update used by both. Use these in ipa_interrupt_add() and ipa_interrupt_remove(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 41 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrup= t.c index a49f66efacb87..7b7388c14806f 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -127,6 +127,29 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_i= d) return IRQ_HANDLED; } =20 +static void ipa_interrupt_enabled_update(struct ipa *ipa) +{ + const struct ipa_reg *reg =3D ipa_reg(ipa, IPA_IRQ_EN); + + iowrite32(ipa->interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg)); +} + +/* Enable an IPA interrupt type */ +static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +{ + /* Update the IPA interrupt mask to enable it */ + ipa->interrupt->enabled |=3D BIT(ipa_irq); + ipa_interrupt_enabled_update(ipa); +} + +/* Disable an IPA interrupt type */ +static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +{ + /* Update the IPA interrupt mask to disable it */ + ipa->interrupt->enabled &=3D ~BIT(ipa_irq); + ipa_interrupt_enabled_update(ipa); +} + /* Common function used to enable/disable TX_SUSPEND for an endpoint */ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt, u32 endpoint_id, bool enable) @@ -205,36 +228,22 @@ void ipa_interrupt_simulate_suspend(struct ipa_interr= upt *interrupt) void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) { - struct ipa *ipa =3D interrupt->ipa; - const struct ipa_reg *reg; - if (WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT)) return; =20 interrupt->handler[ipa_irq] =3D handler; =20 - /* Update the IPA interrupt mask to enable it */ - interrupt->enabled |=3D BIT(ipa_irq); - - reg =3D ipa_reg(ipa, IPA_IRQ_EN); - iowrite32(interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg)); + ipa_interrupt_enable(interrupt->ipa, ipa_irq); } =20 /* Remove the handler for an IPA interrupt type */ void ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_= irq) { - struct ipa *ipa =3D interrupt->ipa; - const struct ipa_reg *reg; - if (WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT)) return; =20 - /* Update the IPA interrupt mask to disable it */ - interrupt->enabled &=3D ~BIT(ipa_irq); - - reg =3D ipa_reg(ipa, IPA_IRQ_EN); - iowrite32(interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg)); + ipa_interrupt_disable(interrupt->ipa, ipa_irq); =20 interrupt->handler[ipa_irq] =3D NULL; } --=20 2.34.1 From nobody Tue Sep 16 17:56:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18745C3DA7D for ; Fri, 30 Dec 2022 23:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235746AbiL3XWw (ORCPT ); Fri, 30 Dec 2022 18:22:52 -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-Google-Smtp-Source: AMrXdXtg3zmJHOHKF5bOxIIvWLS1v7cSxzS+mNeBrzTt4gXtqrZzaKq55DZIR7sjGl+6NUlpvrg9Dg== 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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_interrup= t.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 *ip= a) } =20 /* 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 |=3D BIT(ipa_irq); @@ -143,7 +143,7 @@ static void ipa_interrupt_enable(struct ipa *ipa, enum = ipa_irq_id ipa_irq) } =20 /* 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 &=3D ~BIT(ipa_irq); @@ -232,8 +232,6 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt, return; =20 interrupt->handler[ipa_irq] =3D handler; - - ipa_interrupt_enable(interrupt->ipa, ipa_irq); } =20 /* Remove the handler for an IPA interrupt type */ @@ -243,8 +241,6 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, e= num ipa_irq_id ipa_irq) if (WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT)) return; =20 - ipa_interrupt_disable(interrupt->ipa, ipa_irq); - interrupt->handler[ipa_irq] =3D NULL; } =20 diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrup= t.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_interrup= t *interrupt); */ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt); =20 +/** + * 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) =20 ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, ipa_suspend_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); =20 ret =3D 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); + } =20 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); } =20 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 =3D false; ipa->uc_loaded =3D 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); } =20 /* Inverse of ipa_uc_config() */ @@ -195,7 +197,9 @@ void ipa_uc_deconfig(struct ipa *ipa) { struct device *dev =3D &ipa->pdev->dev; =20 + 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); --=20 2.34.1 From nobody Tue Sep 16 17:56:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28A2EC3DA7D for ; Fri, 30 Dec 2022 23:22:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235758AbiL3XW4 (ORCPT ); Fri, 30 Dec 2022 18:22:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235717AbiL3XWj (ORCPT ); Fri, 30 Dec 2022 18:22:39 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98811D0F5 for ; Fri, 30 Dec 2022 15:22:38 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id n63so11803121iod.7 for ; Fri, 30 Dec 2022 15:22:38 -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=/QwLXlyTB2wFg+f6fFku0I75a5v4iUbGFGBGgx1ehZU=; b=Hm/2P/6UQt95HbAVFv1sCJXkTom3AbsammWHPMUG40G54OIgo/cqYR6oXISj+b4q/E LEllnhOipFjtKw3vVMwA/4UWuq/QgXonkOyHF3CXsO7uhj/QqZCllWF+gvdQPKJsfaWQ Ftv7BtQ/D/RTcpVQNciTyc+OrXwPNNAR/rjh7eT0rHOXkDJAlEoj5AkHU3+nezzWhKYU +7NyRTcDqLVgWJNkJCvO+ZB7VQ/E3SIkIwF6SKy8YY3Ac74iyZbBQ2Wlaw2g1os9JCg/ I8j+ZGuCigaCvXArs9FOCSL9nG9Axldnblge5aDsL2b/ZW+b0Iodq4Q0mAmnMtnzArS2 8EQw== 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=/QwLXlyTB2wFg+f6fFku0I75a5v4iUbGFGBGgx1ehZU=; b=Ca1ThAQk/Su6vpx1dXitcmSUijJk1Ve8heacO6PPYxrxEXc3N6MmBx4tEwa42uHv0v Suh2e3u/v/uVd7LA3WD8qYWEIjLAoa1lma+jeCPIXrEOczY8TJUsn0bpiYIdBOoyuT2e MQo0k7daR1V14VaNvqyEM118Kdn1q+6RoxKjP/r+/zW+P7CjR6Nfnbzaa4bSMOytVHPt atzvkOewbgo7xq1EQ6epvuuabcIVEfY3T2L+GHHCOKu9MTTy77cDFOtZsqSyoxWP89bj FvqWA38UorxXp/uk9bKO+3QFbGLr3t6rhrUuCNzsZk/ES8tnwxOkMmD3AbbsjbonjPtV QWNw== X-Gm-Message-State: AFqh2koedqmUOl98gD99kvvCl61sxeEVlCy7kPlswHTq1TJeDqaZ1cPr 9k/doCn+b0wCyIU7AbQKdvq5eA== X-Google-Smtp-Source: AMrXdXu+YeBztMH+Q3qXIzekNBvvKfknXvWCruTAa/AdlVS1m4dMccVfiveGyeTatllaczAPr2zQKQ== X-Received: by 2002:a5d:8b11:0:b0:6df:de92:91ab with SMTP id k17-20020a5d8b11000000b006dfde9291abmr22002441ion.10.1672442558277; Fri, 30 Dec 2022 15:22:38 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 15:22:38 -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 4/6] net: ipa: register IPA interrupt handlers directly Date: Fri, 30 Dec 2022 17:22:28 -0600 Message-Id: <20221230232230.2348757-5-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Declare the microcontroller IPA interrupt handler publicly, and assign it directly in ipa_interrupt_config(). Make the SUSPEND IPA interrupt handler public, and rename it ipa_power_suspend_handler(). Assign it directly in ipa_interrupt_config() as well. This makes it unnecessary to do this in ipa_interrupt_add(). Make similar changes for removing IPA interrupt handlers. The next two patches will finish the cleanup, removing the add/remove functions and the handler array entirely. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 16 ++++++++-------- drivers/net/ipa/ipa_power.c | 14 ++------------ drivers/net/ipa/ipa_power.h | 12 ++++++++++++ drivers/net/ipa/ipa_uc.c | 2 +- drivers/net/ipa/ipa_uc.h | 8 ++++++++ 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrup= t.c index 87f4b94d02a3f..f32ac40a79372 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -26,6 +26,8 @@ #include "ipa.h" #include "ipa_reg.h" #include "ipa_endpoint.h" +#include "ipa_power.h" +#include "ipa_uc.h" #include "ipa_interrupt.h" =20 /** @@ -228,20 +230,14 @@ void ipa_interrupt_simulate_suspend(struct ipa_interr= upt *interrupt) void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) { - if (WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT)) - return; - - interrupt->handler[ipa_irq] =3D handler; + WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT); } =20 /* Remove the handler for an IPA interrupt type */ void ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_= irq) { - if (WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT)) - return; - - interrupt->handler[ipa_irq] =3D NULL; + WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT); } =20 /* Configure the IPA interrupt framework */ @@ -284,6 +280,10 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa = *ipa) goto err_free_irq; } =20 + interrupt->handler[IPA_IRQ_UC_0] =3D ipa_uc_interrupt_handler; + interrupt->handler[IPA_IRQ_UC_1] =3D ipa_uc_interrupt_handler; + interrupt->handler[IPA_IRQ_TX_SUSPEND] =3D ipa_power_suspend_handler; + return interrupt; =20 err_free_irq: diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 9148d606d5fc2..4198f8e97e40b 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -202,17 +202,7 @@ u32 ipa_core_clock_rate(struct ipa *ipa) return ipa->power ? (u32)clk_get_rate(ipa->power->core) : 0; } =20 -/** - * ipa_suspend_handler() - Handle the suspend IPA interrupt - * @ipa: IPA pointer - * @irq_id: IPA interrupt type (unused) - * - * If an RX endpoint is suspended, and the IPA has a packet destined for - * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP - * that it should resume the endpoint. If we get one of these interrupts - * we just wake up the system. - */ -static void ipa_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) { /* To handle an IPA interrupt we will have resumed the hardware * just to handle the interrupt, so we're done. If we are in a @@ -336,7 +326,7 @@ int ipa_power_setup(struct ipa *ipa) int ret; =20 ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, - ipa_suspend_handler); + ipa_power_suspend_handler); ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); =20 ret =3D device_init_wakeup(&ipa->pdev->dev, true); diff --git a/drivers/net/ipa/ipa_power.h b/drivers/net/ipa/ipa_power.h index 896f052e51a1c..3a4c59ea1222b 100644 --- a/drivers/net/ipa/ipa_power.h +++ b/drivers/net/ipa/ipa_power.h @@ -10,6 +10,7 @@ struct device; =20 struct ipa; struct ipa_power_data; +enum ipa_irq_id; =20 /* IPA device power management function block */ extern const struct dev_pm_ops ipa_pm_ops; @@ -47,6 +48,17 @@ void ipa_power_modem_queue_active(struct ipa *ipa); */ void ipa_power_retention(struct ipa *ipa, bool enable); =20 +/** + * ipa_power_suspend_handler() - Handler for SUSPEND IPA interrupts + * @ipa: IPA pointer + * @irq_id: IPA interrupt ID (unused) + * + * If an RX endpoint is suspended, and the IPA has a packet destined for + * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP + * that it should resume the endpoint. + */ +void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id); + /** * ipa_power_setup() - Set up IPA power management * @ipa: IPA pointer diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index af541758d047f..6b7d289cfaffa 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -170,7 +170,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa) } } =20 -static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_= id) +void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) { /* Silently ignore anything unrecognized */ if (irq_id =3D=3D IPA_IRQ_UC_0) diff --git a/drivers/net/ipa/ipa_uc.h b/drivers/net/ipa/ipa_uc.h index 8514096e6f36f..85aa0df818c23 100644 --- a/drivers/net/ipa/ipa_uc.h +++ b/drivers/net/ipa/ipa_uc.h @@ -7,6 +7,14 @@ #define _IPA_UC_H_ =20 struct ipa; +enum ipa_irq_id; + +/** + * ipa_uc_interrupt_handler() - Handler for microcontroller IPA interrupts + * @ipa: IPA pointer + * @irq_id: IPA interrupt ID + */ +void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id); =20 /** * ipa_uc_config() - Configure the IPA microcontroller subsystem --=20 2.34.1 From nobody Tue Sep 16 17:56:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCF71C4332F for ; Fri, 30 Dec 2022 23:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235470AbiL3XW7 (ORCPT ); Fri, 30 Dec 2022 18:22:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235723AbiL3XWk (ORCPT ); Fri, 30 Dec 2022 18:22:40 -0500 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1D191DDC3 for ; Fri, 30 Dec 2022 15:22:39 -0800 (PST) Received: by mail-il1-x133.google.com with SMTP id m15so12098124ilq.2 for ; Fri, 30 Dec 2022 15:22:39 -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=/5hYek3nB0dmId6hp5MbMyiFoPLMoLSONTQq8CabMoo=; b=ThNXYLsEVsgBPhzs5Uq7WacMqSL5M7UajFCbfbhPx5wOLapYvV1osW5+VDozSkPYOI ut4z+T/fz4zFWaYz1P3w2cFBc3/Lq0jjU51J0i0A3IRAqy5PQqnp3nqDDzy6AZrGOkBx veXgFUdmpJga3FgDZuirF6OHbfubI+JD5QO2sOQMem17XO2kTdaIPhdozHZO0WHPrSfR ZXogBQQmks8srE/gDmd4kTfr2+BlHTi290JanaEKjiMsogBf5lSM0BJkMRqLqv2haFRG UE/spAzS9ccUc7FxoqvKYGwSUkn9UnsxaDnpgni686T8Wi+nem5Tc82WpF/kaLQxcZrb /jsg== 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=/5hYek3nB0dmId6hp5MbMyiFoPLMoLSONTQq8CabMoo=; b=LKbldGppa2BISnGmcknunLk3PyKkSSIA/9fE6fqtnRFMQrwfKk6oHLlNF5VfsSvAdG fPvktwASM7u+G+dxH2Np+o08odPCODEkeuluZbRe+uMAC8itHoF74Z5goas/20KDzN2b yogctJqCNxPsEROj8EVeEDQ8lxi+W9JpfCnf2rxSm/lqnN5xw8W3QDDJDv6oWZ27uR0f K0OkoY8ncCT3mqzC66vnVQbP8kC9DJ/kDl8Ko3yQ7/HXTJmkqWApq5MNbMDgzQPm4b8o CeT5RtTErHXpXeuxacmvOmSHryh0FlCZsK6LL2CS+2UI/POKC+5+yXoH9SgnNXhFEexK wH6g== X-Gm-Message-State: AFqh2kqF8Fe2vHD9F3inhgCyjWA4brbqYiBHlIUmiBlIeVC5hnfaq3bb XW+MiZxqzvVQPpOIc1xCnpiGNg== X-Google-Smtp-Source: AMrXdXuOwnnWmSMz2q/fl3VFwD3Njo9F6YqQcUoyIMiAkbUKdRfoqdlsdAP12rCRviz/70r4S3K0Kg== X-Received: by 2002:a05:6e02:68c:b0:300:60df:e13e with SMTP id o12-20020a056e02068c00b0030060dfe13emr20628795ils.25.1672442559371; Fri, 30 Dec 2022 15:22:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 15:22:39 -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 5/6] net: ipa: kill ipa_interrupt_add() Date: Fri, 30 Dec 2022 17:22:29 -0600 Message-Id: <20221230232230.2348757-6-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The dynamic assignment of IPA interrupt handlers isn't needed; we only handle three IPA interrupt types, and their handler functions are now assigned directly. We can get rid of ipa_interrupt_add() and ipa_interrupt_remove() now, because they serve no purpose. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 16 ++-------------- drivers/net/ipa/ipa_interrupt.h | 33 --------------------------------- drivers/net/ipa/ipa_power.c | 7 +------ drivers/net/ipa/ipa_uc.c | 6 ------ 4 files changed, 3 insertions(+), 59 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrup= t.c index f32ac40a79372..f0a68b0a242c1 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -30,6 +30,8 @@ #include "ipa_uc.h" #include "ipa_interrupt.h" =20 +typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id); + /** * struct ipa_interrupt - IPA interrupt information * @ipa: IPA pointer @@ -226,20 +228,6 @@ void ipa_interrupt_simulate_suspend(struct ipa_interru= pt *interrupt) ipa_interrupt_process(interrupt, IPA_IRQ_TX_SUSPEND); } =20 -/* Add a handler for an IPA interrupt */ -void ipa_interrupt_add(struct ipa_interrupt *interrupt, - enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) -{ - WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT); -} - -/* Remove the handler for an IPA interrupt type */ -void -ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_= irq) -{ - WARN_ON(ipa_irq >=3D IPA_IRQ_COUNT); -} - /* Configure the IPA interrupt framework */ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) { diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrup= t.h index 5f7d2e90ea337..c1df054be8fab 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -12,39 +12,6 @@ struct ipa; struct ipa_interrupt; =20 -/** - * typedef ipa_irq_handler_t - IPA interrupt handler function type - * @ipa: IPA pointer - * @irq_id: interrupt type - * - * Callback function registered by ipa_interrupt_add() to handle a specific - * IPA interrupt type - */ -typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id); - -/** - * ipa_interrupt_add() - Register a handler for an IPA interrupt type - * @interrupt: IPA interrupt structure - * @irq_id: IPA interrupt type - * @handler: Handler function for the interrupt - * - * Add a handler for an IPA interrupt and enable it. IPA interrupt - * handlers are run in threaded interrupt context, so are allowed to - * block. - */ -void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id ir= q_id, - ipa_irq_handler_t handler); - -/** - * ipa_interrupt_remove() - Remove the handler for an IPA interrupt type - * @interrupt: IPA interrupt structure - * @irq_id: IPA interrupt type - * - * Remove an IPA interrupt handler and disable it. - */ -void ipa_interrupt_remove(struct ipa_interrupt *interrupt, - enum ipa_irq_id irq_id); - /** * ipa_interrupt_suspend_enable - Enable TX_SUSPEND for an endpoint * @interrupt: IPA interrupt structure diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 4198f8e97e40b..a282512ebd2d8 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -325,15 +325,11 @@ int ipa_power_setup(struct ipa *ipa) { int ret; =20 - ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, - ipa_power_suspend_handler); ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); =20 ret =3D 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); - } =20 return ret; } @@ -342,7 +338,6 @@ 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); } =20 /* Initialize IPA power management */ diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 6b7d289cfaffa..cb8a76a75f21d 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -182,13 +182,9 @@ void ipa_uc_interrupt_handler(struct ipa *ipa, enum ip= a_irq_id irq_id) /* Configure the IPA microcontroller subsystem */ void ipa_uc_config(struct ipa *ipa) { - struct ipa_interrupt *interrupt =3D ipa->interrupt; - ipa->uc_powered =3D false; ipa->uc_loaded =3D 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); } =20 @@ -198,9 +194,7 @@ void ipa_uc_deconfig(struct ipa *ipa) struct device *dev =3D &ipa->pdev->dev; =20 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); =20 --=20 2.34.1 From nobody Tue Sep 16 17:56:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 165A1C4332F for ; Fri, 30 Dec 2022 23:23:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235733AbiL3XXD (ORCPT ); Fri, 30 Dec 2022 18:23:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235730AbiL3XWr (ORCPT ); Fri, 30 Dec 2022 18:22:47 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE6CD1DDCD for ; Fri, 30 Dec 2022 15:22:40 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id g2so8900562ila.4 for ; Fri, 30 Dec 2022 15:22:40 -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=25pBUtrT1XiV3gX50trdZQF7DviwuSyPLPkde8po6zE=; b=E0JZ88iBO8dIMiyDZgV2f3Ta5893v6HdzLJZvj4IHdoC0mPBYmxK78JT5vpGFuNGGQ KxcLb1saMJG5Yb71HlwJydIyn97Y9Fa5iEuXnCxJqMRhABAjmdlWAuZzbPxjDrNRzRa1 TLqKgpHkN1RuuDNEM4Mi0OrOf82ZAtEzo0rh55XmdRTig47EV0u5F7l4Dxs5jd3H51vq y23M5KWwvN2LjG+UwfFyhVtV94qfPNQ1Ts7+eTA3Q81Oz/CTqYhn9GHVV1dfmIaIMGQe iQTipTj53kOAa0Eeqbl7zqr+OmZq3+J2dtxPT8vnGUYwEsWdZ74mgs+y9nXCa0COfVak 6S5w== 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=25pBUtrT1XiV3gX50trdZQF7DviwuSyPLPkde8po6zE=; b=DDyG8CUZNZaKSkpu7svOdsxfqylL+BihArPHW0iXkVPrXupXqf09dVpP0jfv0vdQiF 4+8tcNEJfYPmCHIKxDKeqEM4/znvnj/40TrnV4sYORILQcbMeLBnpD2A6/8RWcTeHjwf tkpf8jRGhOal4KKHIsPhXdXQLRbkqnVL3xUXluIX4pG0HDJTOei8Uf7oxfz+mf3RlNGQ RahnSyJRZbdLtf3rzJG42n7eQ1LcJ/qYejeeYSwH1zRBzIfZ7ZSlXZXCEaaZvVpymSZt NYXwrDf//mhliqQ+63+bBkva/Pr6eSv+ex+xXhHlCBs+tWD+EsGihXOODV914DMlIHLj BVBA== X-Gm-Message-State: AFqh2kpnqlOYxfsSAzGd3ecOYehcR4EcAOWJJNHDDa1CUzla21/m9nMm GiBtOpeerTWrIoXv4t5cpVOLEg== X-Google-Smtp-Source: AMrXdXuTHFAs3nyjnITnt9LaOIbfJafXJakYiMb2bBzFUekT87v98SPg+IhTDRV1fZNx3B95QA+mdQ== X-Received: by 2002:a92:cc8b:0:b0:304:bf1c:559a with SMTP id x11-20020a92cc8b000000b00304bf1c559amr22444308ilo.11.1672442560471; Fri, 30 Dec 2022 15:22:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 15:22:40 -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 6/6] net: ipa: don't maintain IPA interrupt handler array Date: Fri, 30 Dec 2022 17:22:30 -0600 Message-Id: <20221230232230.2348757-7-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We can call the two IPA interrupt handler functions directly; there's no need to maintain the array of handler function pointers any more. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 46 ++++++++++++++------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrup= t.c index f0a68b0a242c1..5f047b29e6ef0 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -30,54 +30,52 @@ #include "ipa_uc.h" #include "ipa_interrupt.h" =20 -typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id); - /** * struct ipa_interrupt - IPA interrupt information * @ipa: IPA pointer * @irq: Linux IRQ number used for IPA interrupts * @enabled: Mask indicating which interrupts are enabled - * @handler: Array of handlers indexed by IPA interrupt ID */ struct ipa_interrupt { struct ipa *ipa; u32 irq; u32 enabled; - ipa_irq_handler_t handler[IPA_IRQ_COUNT]; }; =20 -/* Returns true if the interrupt type is associated with the microcontroll= er */ -static bool ipa_interrupt_uc(struct ipa_interrupt *interrupt, u32 irq_id) -{ - return irq_id =3D=3D IPA_IRQ_UC_0 || irq_id =3D=3D IPA_IRQ_UC_1; -} - /* Process a particular interrupt type that has been received */ static void ipa_interrupt_process(struct ipa_interrupt *interrupt, u32 irq= _id) { - bool uc_irq =3D ipa_interrupt_uc(interrupt, irq_id); struct ipa *ipa =3D interrupt->ipa; const struct ipa_reg *reg; u32 mask =3D BIT(irq_id); u32 offset; =20 - /* For microcontroller interrupts, clear the interrupt right away, - * "to avoid clearing unhandled interrupts." - */ reg =3D ipa_reg(ipa, IPA_IRQ_CLR); offset =3D ipa_reg_offset(reg); - if (uc_irq) + + switch (irq_id) { + case IPA_IRQ_UC_0: + case IPA_IRQ_UC_1: + /* For microcontroller interrupts, clear the interrupt right + * away, "to avoid clearing unhandled interrupts." + */ iowrite32(mask, ipa->reg_virt + offset); + ipa_uc_interrupt_handler(ipa, irq_id); + break; =20 - if (irq_id < IPA_IRQ_COUNT && interrupt->handler[irq_id]) - interrupt->handler[irq_id](interrupt->ipa, irq_id); + case IPA_IRQ_TX_SUSPEND: + /* Clearing the SUSPEND_TX interrupt also clears the + * register that tells us which suspended endpoint(s) + * caused the interrupt, so defer clearing until after + * the handler has been called. + */ + ipa_power_suspend_handler(ipa, irq_id); + fallthrough; =20 - /* Clearing the SUSPEND_TX interrupt also clears the register - * that tells us which suspended endpoint(s) caused the interrupt, - * so defer clearing until after the handler has been called. - */ - if (!uc_irq) + default: /* Silently ignore (and clear) any other condition */ iowrite32(mask, ipa->reg_virt + offset); + break; + } } =20 /* IPA IRQ handler is threaded */ @@ -268,10 +266,6 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa = *ipa) goto err_free_irq; } =20 - interrupt->handler[IPA_IRQ_UC_0] =3D ipa_uc_interrupt_handler; - interrupt->handler[IPA_IRQ_UC_1] =3D ipa_uc_interrupt_handler; - interrupt->handler[IPA_IRQ_TX_SUSPEND] =3D ipa_power_suspend_handler; - return interrupt; =20 err_free_irq: --=20 2.34.1