From patchwork Wed Feb 10 22:33:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 380258 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1568251jah; Wed, 10 Feb 2021 14:36:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCZ5LpxOBLDVt2YvPH/sKGNaG0U2RKxWdY+epPcsPLRegKx5pFbxaFasENlKgtI7ciLSAv X-Received: by 2002:a05:6402:50c6:: with SMTP id h6mr5326346edb.117.1612996604730; Wed, 10 Feb 2021 14:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996604; cv=none; d=google.com; s=arc-20160816; b=w6cyBbPISPqkhp7R/NBjl4rto1b/5bcwrug5guM/s+5mprjXAb8votDXraykyfY11S 1fGYfehMfzlukIaWfvBB2/sCv6YFgDtI9VFHPxuhTLwZpcDYNKfwC133WEEtB6d11Sks BqdahnY+fV86PNB7RkxpGrRc8gM/8Lze1vyRQ8Ol61YQwQKZeN8DNQSDQTWnOghNOaUH 6YQZFH7n2EsnFQ0ZCinIeLiPlvJNzHkIsak9LxNxBiICWtKHOHqkIiXIBRr5CIRUV5HJ EaFJ0Z8PNF8KpqEumjCFu9AkRHwYx72MG8zGdxQP7sx2m2stBWFm8W9XigNU1AJm+DeM lJsQ== 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=7FCuQIhoM4UnSeDf+V9T1zVw5r1nx3mRIbuQj9L1BYA=; b=pTwG3/PBlnfesz0E0am+roFGZDBeTlXIXbvALvguxpLna5hTn7YtYEsdiFKWFU4/xq bmYcwcubQfk6y00vZRrr6TkxUjn72oZFDe0hGrqpcPoGB9kRfjRMFEmYixXqxeSedUje Sq+TUTdJwW4pC6R0PEyJdZkx8AZAUvy8Pk7nU8Dhh68x/Sxln6INfsreIAx7YW1MzpMC frG9eKHRaCyDoARNgUb2xYZ2yt6CzPHeXW5XW0Db6feNKFF8e1EFg7rnfR6h88ugKJBg GmyOrZ/mcMFgnJkWviFMCVcmWe9fjNX+cwa8sO9FBqADROJOjmaCBL+VG+wuYBG92S9C 1msA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Rd/yJmUW"; 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 de1si2253910edb.555.2021.02.10.14.36.44; Wed, 10 Feb 2021 14:36:44 -0800 (PST) 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="Rd/yJmUW"; 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 S233742AbhBJWgX (ORCPT + 9 others); Wed, 10 Feb 2021 17:36:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233711AbhBJWfv (ORCPT ); Wed, 10 Feb 2021 17:35:51 -0500 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 4FDB7C0617AA for ; Wed, 10 Feb 2021 14:33:29 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id z21so2330281iob.7 for ; Wed, 10 Feb 2021 14:33:29 -0800 (PST) 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=7FCuQIhoM4UnSeDf+V9T1zVw5r1nx3mRIbuQj9L1BYA=; b=Rd/yJmUWl/CbjQMXYAj81h5dkBwFZoIiFyzebIXqmV6DFK9Qtj9EkWHVY3rV1A/GT+ jHv17UrnbOkI3wbe4ApcNKXs4L6No+EBJ2tsgAlQyV0Sjs9+OEo3aI2DT+AgD6duxV1H LtIwyRHbsl8CtEfljXn4SqVpgMWXIqksSyR4UEILQWBvKwZ+bOU/Xoj/w1w4g4px9nyU Tsh5RNdBhuIwN0AmjIgHkNLCyvZ4GcHuOljB2CAtkq8pvR4oIl9qVwVwooCLQoqT50aY BIhbNnmr6rVSvaDcLmfhFW9vIZImUVfEkjRsC2seur/r9ExLYkngZdpeYVGnp65WPNuZ EeNA== 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=7FCuQIhoM4UnSeDf+V9T1zVw5r1nx3mRIbuQj9L1BYA=; b=QXQrTSYfpCpVbFauCZqbtein1CYW7VnMCXwz8wrwGfvncJmvKRGcyTCIrYKt8SEBUI sy3LPbVujVtvcec+EUGZnPWofNTgfNpvG+sahu2CIwMoipRIS4MrU9c16UU0O14H0p1k ABsP5Hm3FA7SdzQR3a6Y/F1qShoyFCWFRwPxbmxileTrOALp1jqRtRjvtpnkieM7DoCg wA0Zb4JB2AjpfJfG1I9HGtgvGsFPlNv5ng3wSD98TAa4LI0LgVa/uE1XazM7iINunFXe HYAb4juVOrmvmjXZKAJ6NgGLZ5uBAJOqMbpw+PesP4Hsbe6dYA7NMGr+IeoG/59lvFNV Zsjg== X-Gm-Message-State: AOAM533hmjn1BZEyItQEh74ZutgBY5K2CNcJSK8fViorw2T5WIpJGYsV QWM2aaGRsth4s8WxbaovRx/NyQ== X-Received: by 2002:a5e:9612:: with SMTP id a18mr2732161ioq.209.1612996408710; Wed, 10 Feb 2021 14:33:28 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id e23sm1484525ioc.34.2021.02.10.14.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:33:28 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: elder@kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/5] net: ipa: introduce gsi_channel_initialized() Date: Wed, 10 Feb 2021 16:33:20 -0600 Message-Id: <20210210223320.11269-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210223320.11269-1-elder@linaro.org> References: <20210210223320.11269-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Create a simple helper function that indicates whether a channel has been initialized. This abstacts/hides the details of how this is determined. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index d33686da15420..2406363bba2e8 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -175,6 +175,12 @@ static u32 gsi_channel_id(struct gsi_channel *channel) return channel - &channel->gsi->channel[0]; } +/* An initialized channel has a non-null GSI pointer */ +static bool gsi_channel_initialized(struct gsi_channel *channel) +{ + return !!channel->gsi; +} + /* Update the GSI IRQ type register with the cached value */ static void gsi_irq_type_update(struct gsi *gsi, u32 val) { @@ -1638,8 +1644,8 @@ static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id) u32 evt_ring_id = channel->evt_ring_id; int ret; - if (!channel->gsi) - return 0; /* Ignore uninitialized channels */ + if (!gsi_channel_initialized(channel)) + return 0; ret = gsi_evt_ring_alloc_command(gsi, evt_ring_id); if (ret) @@ -1675,8 +1681,8 @@ static void gsi_channel_teardown_one(struct gsi *gsi, u32 channel_id) struct gsi_channel *channel = &gsi->channel[channel_id]; u32 evt_ring_id = channel->evt_ring_id; - if (!channel->gsi) - return; /* Ignore uninitialized channels */ + if (!gsi_channel_initialized(channel)) + return; netif_napi_del(&channel->napi); @@ -1770,8 +1776,8 @@ static int gsi_channel_setup(struct gsi *gsi) while (channel_id < GSI_CHANNEL_COUNT_MAX) { struct gsi_channel *channel = &gsi->channel[channel_id++]; - if (!channel->gsi) - continue; /* Ignore uninitialized channels */ + if (!gsi_channel_initialized(channel)) + continue; dev_err(gsi->dev, "channel %u not supported by hardware\n", channel_id - 1); @@ -2088,8 +2094,8 @@ static int gsi_channel_init_one(struct gsi *gsi, /* Inverse of gsi_channel_init_one() */ static void gsi_channel_exit_one(struct gsi_channel *channel) { - if (!channel->gsi) - return; /* Ignore uninitialized channels */ + if (!gsi_channel_initialized(channel)) + return; if (channel->command) ipa_cmd_pool_exit(channel);