From patchwork Wed Jan 4 17:52:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5274839wrt; Wed, 4 Jan 2023 09:57:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXvUxHRzX9PWsXF6doItP8nI8ST5HpmuvPjbRPG3x3hoZ59cmRPDLZXa+JNYrJEYhbej1+Vf X-Received: by 2002:a17:906:d8ac:b0:7bc:9a78:bc3a with SMTP id qc12-20020a170906d8ac00b007bc9a78bc3amr40964510ejb.68.1672855059880; Wed, 04 Jan 2023 09:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855059; cv=none; d=google.com; s=arc-20160816; b=vbpYIF94ChJC7pvTM1bMdgo2UN1rb4jg5vTc2RP10mj5NnCFK65x0wYw0bWXp+86pz qX9FtCeDVA86QmlmuPNc2cAb2wzZIJ8JmAv9cGymnoqAig/y5S7mucb6jPbg/m/MyuQz W6izIagpk4KPy3gI23jX6ZJTQW78iMk5D3pUIZemDM9FTKFcCCsuT5SFjmiFqjKSEo6o vxn0u+DTPWZY7Wy0UB1OEYr7Gfr8lJTUCrUcRPRngaUs8I5OTSYIMabwtloOV5xg3vTx VLeGBTvk98bktAzxnwJzyYbiXQ6Msdp9iMWjwTVi7PW0MPxvnoEcliyEoh2S1vxhZD4N udnQ== 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=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=iPVOiXUXgv2xiJVwkEInGeXvWwVH1pahKDV4JFq2b+aWLTfd8kcL/7yAd/IbhcT+Qp ewhNkWdn02eIkYCkrM+KdP/f1bDMDGoliwryia98Xy3fo3NwUdJLfG6Gk2gjbA9fAxNt sb9hmFMbyOt7hRtaxgW4nU1EnOV0aSVTPh8vJSfcew1iIJWUF8SChKBWzjOOLBV1albH k0hIhQDCk/BHO3O9bsPrJ4YP767dmCCDNlNUSu6lunZ4vr04aDE502tdFF18mSDmipdH 8dlzTM9aEIJ2bE1QQksihcciBZ6pILsewDl4Mef7NvwiDh/WmMwZe6bASTQ8jH92qLwm l3cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pUy9/yLc"; 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 ne35-20020a1709077ba300b0077d854aa10dsi31075934ejc.57.2023.01.04.09.57.15; Wed, 04 Jan 2023 09:57:39 -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="pUy9/yLc"; 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 S239961AbjADRwx (ORCPT + 99 others); Wed, 4 Jan 2023 12:52:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239932AbjADRwn (ORCPT ); Wed, 4 Jan 2023 12:52:43 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CAC739F88 for ; Wed, 4 Jan 2023 09:52:39 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id u8so12246625ilg.0 for ; Wed, 04 Jan 2023 09:52: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=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=pUy9/yLcTSPL3IuDyGbacdjkCGV31SZWZXUcFAvvR5SuvUSK9t8Ql7NYsCklIYZQYu J1SB9h06cnJXtaX8CHbdgXVSwh6wRc8rYlNGPNLPOFnSeY2cjK0o6K9LUeq2IhuRacCB uZWEb+gRXm3c8uEgmCqg3MbOpnxDCO5JXVqdTDnSvFoQxXbr5SQibLFbWpcI8pxZeSce ykTTiX+O8btx+tXQCpX7SgtGJHD/GBo3XrlX1kJNryu7m4U3Lc0cCoEeC2DRj0Cu5au+ z41K1/eSknnnxN45DKYEAj+nEi05h4+ZyanQJ6SFFO0VeZFbFZuRQs837KU/gLduUz7K K1ww== 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=yvk7/8pWIUAIT5fYi20cbf/qdMYtVI+C5gooZnbrHK7lH+PDsm8/yBKlv+89RkFBx0 BzyqZwSpAzCEP53wXX4kr4sSJ17iiaCpIOSI0oRjOhuTiiNENGbwWm3snrLyPfrIVSEA h05jsNmhe8b+e0SRHa8+edqy9LETn49fw/r2Ttcn1rgiSJl2uKT+Sd1McqngJb2HmAvK 4uYJvSsvDlGqNEbYNMAzsiyHvQxop9OIeHfDcxDZeMeCxBDeAhNTS5+4J99yZS7aKM7l DAhbheUAdlQ1JshorBYkSqjOCdwoAEkqXFg77emTczXS7kDFazgcKWX5M2QXZ8SsYNYu lN/g== X-Gm-Message-State: AFqh2krtyODkb36kJW4SRzOF2b9XL4KsAAIDu+rWv63sBzd53QawB+e1 Wy/em2BS2uH9ilWYGm0g22HqBw== X-Received: by 2002:a92:c748:0:b0:30b:f2a7:92c2 with SMTP id y8-20020a92c748000000b0030bf2a792c2mr25965907ilp.7.1672854758677; Wed, 04 Jan 2023 09:52:38 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52: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 v2 1/6] net: ipa: introduce a common microcontroller interrupt handler Date: Wed, 4 Jan 2023 11:52:28 -0600 Message-Id: <20230104175233.2862874-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-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=unavailable 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?1754115666998311891?= X-GMAIL-MSGID: =?utf-8?q?1754115666998311891?= 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) } /* 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 = ipa_uc_shared(ipa); struct device *dev = &ipa->pdev->dev; @@ -138,7 +138,7 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id) } /* 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 = ipa_uc_shared(ipa); struct device *dev = &ipa->pdev->dev; @@ -170,13 +170,24 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) } } +static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +{ + /* Silently ignore anything unrecognized */ + if (irq_id == IPA_IRQ_UC_0) + ipa_uc_event_handler(ipa); + else if (irq_id == 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 = ipa->interrupt; + ipa->uc_powered = false; ipa->uc_loaded = 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); } /* Inverse of ipa_uc_config() */