Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2458239pxy; Tue, 3 Aug 2021 07:04:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXalFP04lEmhzdVOVav6EMybmlry1eUeYow8QI3r78pjt898QRHTn4v0+tpHlYLwGCwDv/ X-Received: by 2002:a02:908a:: with SMTP id x10mr18960083jaf.30.1627999449766; Tue, 03 Aug 2021 07:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999449; cv=none; d=google.com; s=arc-20160816; b=Fyf9yGQa6or8AiymjU8+H7xDEBhHtBnkTILEOk6LquNkqvUjBSRubnVGkWtjtn6n+N Dpf0/fPMETnV2KvGGRijsCvtCCq5yPy7zBy3IUpcubw0AitGYSD9tKOCEdcCkgN+plcK F5gkT//bfsullE2ofsrwhI5JjIRB0CEpXSA70wasffDDWJOp9gsTzuIDa/c67em76Z12 f7nwJxzFCW7ehc+dDB1fHIRCG0Jh5Z5bXKKdrWcdWofOIijJCzbyZJImU7cLQzUTpFN1 9uWw6PdM87SSD6OdhJh46vepAanszys5j8qReQehHCWWj/fsfGEbsM/06ub1VQbUQneq 8Tfg== 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=FYIBgJsGSKBcoqAuAtNvLom5saQiP+7f/kpmfiU1hVWyD2JpJxlc9AQ2+K6AucGmUU ZWeCIJ1fXLEpd3eJDGFTZ5QlJBsgk2CoI41KLTiyk4kXmpUj/TkA8KO8RPFFupSl+Eic VFgU7rOKzob3iwwUt06951FZBpKwMXYrkoOt/bpl27Aq8axNxG5J6+BBM6CbTvl/Bz5Q gpK3ORNHMWn1+jb+kumXjS01kkVwY3YQi/QzlQhg2i8HCsZyQ/RnzTqRONA5YLtrSL1U EHtB77PsjvVX4bJrvOtEapU+rS9lKwA0NcH0WHLNw05PfhUYjXPYRrFVuf6C9ul5gLnM WwZw== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 n13si15854850ioj.25.2021.08.03.07.03.55; Tue, 03 Aug 2021 07:04:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236566AbhHCOBi (ORCPT + 99 others); Tue, 3 Aug 2021 10:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236451AbhHCOBX (ORCPT ); Tue, 3 Aug 2021 10:01:23 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AABE5C061764 for ; Tue, 3 Aug 2021 07:01:12 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id y1so1184110iod.10 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=HNPjwMA9XLsJeWlXsX2VRgVj+dFlONTIBxCEBCA9wbgpafhcLmhmdJtRo3b8epPML0 GyL/2bOCQBeWxSBpBJoTx2dsrqvES3SttekbFxBSIzRVN4nzkxB7Mldyv9Bo9snfwp5+ P3LaOMMr0DxxDqDel6YZOH+bWqf7Mrt5sOLnPotBblrNl9r4ceb0By/SHntJw58V7kcg uiFJUPdTJbVXnYGdT0ZbMMtdzhCJB3zyPbV3AIjHhKanT3/5zhLj3IJkbsR1OMnVGfLg hFJphdfadHoSx6ZKZ1E+VroHyVs9pkw7yaQ9mSZQgQgJZJ9GOVGClSESoeHGZGw7SyjH TtsA== X-Gm-Message-State: AOAM530Mz4RxkvSgIdi68eWTFsCqUf9BO1rbUnt15CcHcH8UuD2A4ktu OP9/ik6efRSAal0pe6pwMmbI0g== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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 */ -- 2.27.0