From patchwork Tue Aug 3 14:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490955 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677269jap; Tue, 3 Aug 2021 07:01:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwETJapMV48S+Lfz1MZhrMJ2Mca9U07sNIZoPqeOCtpz8t/VEjvE86OWdAvwJqlOdfX4jKZ X-Received: by 2002:a92:6809:: with SMTP id d9mr872966ilc.174.1627999289594; Tue, 03 Aug 2021 07:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999289; cv=none; d=google.com; s=arc-20160816; b=hLu6Me9Bp1HaDK2hZisVbBo+JaVoj0CK3/srhTGOrnamkLR3XDc671znzMJuH2udYA +dWCpJQcnDAFzhLdpNhTkhHbTCc7+Shf9c6hwzX7fU6xTPmsttnWjARA7/W7IiroFg1Z 5PxxDdbYxvYHABxURHN5l5DUhG+vsni08aC41HYBR9tOEcDpmTGNFz/o980mXB/LsRY/ F06Nx2nMbrUiBrHucEqeztv236Q8fSf/3Z/oOyUOLy1JhM9uHXSXdyJ46UA/kXRn289t /h5Hh5ggSVC19KHQGGXVE/B0Bvu/CQzlKLqmY+WXJgMnvfwONnUain7ZIQlpSvoip7SC 1cbQ== 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=PtQLPSseXwgcXWxbV0GTVE8n9SJgEFIFbxs9fZ84aRA=; b=QRSAVWGu+HCwUldzeaG50/epzmF9UjEam+lfbVw2a1R5HRopS6BhUXRN1dvRWkh47c uOGI5b5Zd/YUMd1VDFDS4V6E/4UNsB3e5AbreQFMUTgIQyDk/77ndzaumUVBRp8CjuF3 hMW/yhsfJVpd41ITEJM/uI65uY7fwSqPalMNFbxf5udwy5W5VhAcGZu7xkTi/PY7coc9 0uQmV6/n2VnehOkgrMRP4rkZRmv6Mx6n84uOvgvGFqDc02kP2884rxehlTExaZ4WwGJY ZorTZzZrFhyCKqDVB1lAqmNC4r6g4fqvklSJNuk+JSgxLl5m0eK6S138MR98IqaO0ppx mxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wbylETv5; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si17170049ils.75.2021.08.03.07.01.29; Tue, 03 Aug 2021 07:01:29 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wbylETv5; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S236562AbhHCOBi (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236386AbhHCOBX (ORCPT ); Tue, 3 Aug 2021 10:01:23 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB105C0613D5 for ; Tue, 3 Aug 2021 07:01:12 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id r6so16080068ioj.8 for ; Tue, 03 Aug 2021 07:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PtQLPSseXwgcXWxbV0GTVE8n9SJgEFIFbxs9fZ84aRA=; b=wbylETv5vnvmDPaVcbGsCeoWhKCZAnyQ+225qyafuZslTvRqdGl6+217DdQjaX5Re+ 4M7TDRY3ZzAvBuQ2BFgyCkEmyV+KZ1/tf2CQADMisFgIJG8v0M7BfFFbRgDuCO2iFT0v LZLgn0GlO/0MhUnr/Pm+F8GJdA3WswI41knmUxJNcu9DL0fcZqtpH74AyvfwOnzRCDM8 2zX9XitaX7598xTk+VI+Ac6jKeKb0X9UtvEDXhbXxdtw5D3CoCsy7QG/ffjzrHtBWMfx QJ20gzCpK1b9pcQTUGINyK+DBwSHX7TKu/8VTk7Q7t3ekUfdRrNnv5VkIzTI5QLRd2Ss dz8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PtQLPSseXwgcXWxbV0GTVE8n9SJgEFIFbxs9fZ84aRA=; b=BYr/uteUguisRztBXtTcntR8TASkotOup3rarARamHmfLqriq6dCkfNCqDzShLYaxA 6qvhEHSNmRGOCqHh0Po31FH7MmehI9GCCn9BvsvH1xn67fik6oqdIYGwT5/le6/EmDWA OMeFi58du7j7GxmASaSVEdJQSH1jcjpdx5PiLSIpulw5Jyv6YALvoSRakW3nMtayHn+m FslTVVpfKlv+MendoE8+vkEYBD+o/AbGj9oHw0mWUGPYikmg3lMiIrF6ZumbegGp3y87 zTWSbiWGtNcCngBuZE9M4W1qXpFmuR49yA8aE0tWnNiGWfT8diRYLZI3lGf26Bo7Xsi6 4pjA== X-Gm-Message-State: AOAM531FcRc4glHr9ujfNOiD4AqpdNC84c0ZYb4s4HMYdDatwIJqWHa2 yQ0mL5gpfYA0E/umXWBvJs589A== X-Received: by 2002:a5e:d905:: with SMTP id n5mr1145832iop.136.1627999272164; Tue, 03 Aug 2021 07:01:12 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:11 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/6] net: ipa: have gsi_irq_setup() return an error code Date: Tue, 3 Aug 2021 09:01:01 -0500 Message-Id: <20210803140103.1012697-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change gsi_irq_setup() so it returns an error value, and introduce gsi_irq_teardown() as its inverse. Set the interrupt type (IRQ rather than MSI) in gsi_irq_setup(). Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index a5d23a2837cb6..be069d7c4feb9 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1807,9 +1807,12 @@ static void gsi_channel_teardown(struct gsi *gsi) gsi_irq_disable(gsi); } -/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */ -static void gsi_irq_setup(struct gsi *gsi) +/* Turn off all GSI interrupts initially */ +static int gsi_irq_setup(struct gsi *gsi) { + /* Writing 1 indicates IRQ interrupts; 0 would be MSI */ + iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET); + /* Disable all interrupt types */ gsi_irq_type_update(gsi, 0); @@ -1831,6 +1834,12 @@ static void gsi_irq_setup(struct gsi *gsi) } iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); + + return 0; +} + +static void gsi_irq_teardown(struct gsi *gsi) +{ } /* Get # supported channel and event rings; there is no gsi_ring_teardown() */ @@ -1891,25 +1900,34 @@ int gsi_setup(struct gsi *gsi) return -EIO; } - gsi_irq_setup(gsi); /* No matching teardown required */ + ret = gsi_irq_setup(gsi); + if (ret) + return ret; ret = gsi_ring_setup(gsi); /* No matching teardown required */ if (ret) - return ret; + goto err_irq_teardown; /* Initialize the error log */ iowrite32(0, gsi->virt + GSI_ERROR_LOG_OFFSET); - /* Writing 1 indicates IRQ interrupts; 0 would be MSI */ - iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET); + ret = gsi_channel_setup(gsi); + if (ret) + goto err_irq_teardown; - return gsi_channel_setup(gsi); + return 0; + +err_irq_teardown: + gsi_irq_teardown(gsi); + + return ret; } /* Inverse of gsi_setup() */ void gsi_teardown(struct gsi *gsi) { gsi_channel_teardown(gsi); + gsi_irq_teardown(gsi); } /* Initialize a channel's event ring */