From patchwork Fri Dec 30 23:22:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 37780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3107310wrt; Fri, 30 Dec 2022 15:23:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsa5lqMCl3Q/twZxPTrj+er+tznLCpn7eipavYWdVsgtE1/BPtawE+Wn38Zq5s48zMyu1Lo X-Received: by 2002:a17:903:ca:b0:192:9fda:7665 with SMTP id x10-20020a17090300ca00b001929fda7665mr7686897plc.53.1672442590851; Fri, 30 Dec 2022 15:23:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672442590; cv=none; d=google.com; s=arc-20160816; b=LesZU1bormabGWZiGnlszN1KGK9n5E2oXuYvis+cX64erkOJ+itagb1N5HFQz/H6Q9 gaeUKjIDcWgdlTODIO6mZAqxrghQQTLXfaT+pD553Q71WbUTKFM87F6JDBsX6cDLIcXj VRGos7SsuR53YnVQ5aaPlt6lQah44PbY4ic8VOhn3nbHls/8ks63JV+sqlXFcULbxAgc Tpb86lYcV6rQUdPEbZA02TzjbcvzURrvjwHMzdMe+Wu/ckXfTjdkFjndz8rPUa0Grnpk QqQaxyAb9wxzsaz//mgzpda88RYa4pi6FOWf3iz30gqKPx9I74N1be/6YFnWE0IUQNa/ YUFA== 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=tuvu861e17Ijl/RbEjtcwZ1loIvGRCwFYk1C85CM4uND3C1MBbl7vUwaoGqUou2OLH 15Sdgnoq39H+JL9DPPHC0FrMANM8NIBal3YBotHSEFb975I3+y7aMcmhyed8EDUs/KMp kuaCYwNw4VERZsTThdB7VsKJfgtw/zMp/So3vfElnchfVo9rJsiUvsm7V8vl7lnvFxS6 iDRk4a3Pp69p3niNkclCkFXjYbHu4kuZqW43xA4327eRhJjfDYAATWhvQ9nh3ccmkAwl ULdVB806tCJYGFGt6o2zmMRYoSnQk4oxgWjOLtm95CjpuY5FK/e6tMFsf+TxlVdlIf40 FLNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZYZNnlUO; 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 t63-20020a635f42000000b0048c4f23869dsi22802083pgb.796.2022.12.30.15.22.58; Fri, 30 Dec 2022 15:23:10 -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=ZYZNnlUO; 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 S235700AbiL3XWk (ORCPT + 99 others); Fri, 30 Dec 2022 18:22:40 -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-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 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?1753683162095390715?= X-GMAIL-MSGID: =?utf-8?q?1753683162095390715?= 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() */