Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp178058pxb; Thu, 12 Aug 2021 13:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCyxTOBn4BH2d0A8ra8oUH/U7OPd1kBwYjg4MrrGrBJFVSygzxOiLFJIv4Z3fGGMZLQ/Gt X-Received: by 2002:a05:6638:37a9:: with SMTP id w41mr5441084jal.142.1628800980204; Thu, 12 Aug 2021 13:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628800980; cv=none; d=google.com; s=arc-20160816; b=KaBfxZ0ECN2qBB0AmMwTRo9lOXxQM4gn7/+9OVTSeInLmYSIRTMNgJVfr2axzXT1h8 VRQbcmLi+LK7DnoqoPytA2dTwVkllLsmMGtaDoYGzYiuOQDUwXV7qLh+Wxfq+0mgIRcg +lERQ/jhrahhp95cKreWy6VjujbafDt1k8esUKZnsz1z9/Pon3lG1Y2bURW+sIbuODAT gtk+Q7bL6iEiktZaT7yEAAL0Itr2c1BdOwteBazfqmd+VLpBnikDAqYcBW1R7I/uVq4Q UnD6aCOmF3tjBGFTIpLj0CdvouPBA8yRpMUdEh1UxlGtcnBogWA9QcW0zH+/kfSBWY09 sONA== 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=pVDXj/c2GhrmP3JpxAGc+59S/Eh6qUoCDMrEnYN38ig=; b=hrAV/mqZ61pn0tGr/abL5YJv2K976IQmeVqD/ENkaIpb7jWa3kdKYFKm9hriaG7Q5p D1QG41trbc8nk4WoatcyD8aR4AT49g1VgVFX2tws3MzAcglphpBvKYuUWlhP9uAeO5aN XZCV9YT0z3oUzf0DQIrLnxwjaJqVamFylP2KKsKr9GIsQUgKj7iMdEWHHHJYyvM5B3EZ SqOo0ahrohGygRFbYWCgcaLO2hPOmzwxZOEO+0xpY86Ckk+sS4NKDnKL0hLUi5XmxFuA 8vOQFGMVmo+nHRl2ewbouD+xmxsca5NoosM0vhDlWJGrfqkAtEoaQJs/isEi35LTFBRK t4Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qu6hMONK; 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 z16si4316524jat.29.2021.08.12.13.42.48; Thu, 12 Aug 2021 13:43:00 -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=Qu6hMONK; 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 S234978AbhHLTvX (ORCPT + 99 others); Thu, 12 Aug 2021 15:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236319AbhHLTvM (ORCPT ); Thu, 12 Aug 2021 15:51:12 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AA15C061756 for ; Thu, 12 Aug 2021 12:50:44 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id d22so9969355ioy.11 for ; Thu, 12 Aug 2021 12:50:44 -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=pVDXj/c2GhrmP3JpxAGc+59S/Eh6qUoCDMrEnYN38ig=; b=Qu6hMONKHaomHVzVDk6h4d9M7HVT/cFdSqp48XMihTQ1wme3tBEzYfaYsLulMcH6L6 EpNwWR5pwiQUTEC8RpgY2saOsqfd9athwfhrY6wJzsU3r/DWoMJX7KfjBq03QwPG7wGl u8yTVqWyj7p0WUvIdIJSQSMQhp/t5QJ/II0KGcTW386p7MNryUBVeXj75FQSxkPF0ViQ p2icnL69wR1soSjAmsdXZcEWsJzRdDCVDTT1N3gcgfRe8FlVGwNPX3MEsXI7YSL68hJO 3c7n6f8b8bTkK8fSDErufEVZTIYpk1yAwIrjKlLPJc2ILQmYyFGhBnxSy/Q7P/fa6oPe dFng== 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=pVDXj/c2GhrmP3JpxAGc+59S/Eh6qUoCDMrEnYN38ig=; b=Apn9YZ34G2hiZndBy8ib+OxQMilSN3PyeLJWFfp+kpoWRAga21B+nHu7VK/ZE1I96s JCMECPFeQG6ERp0M6+ZFLrzAnlUuA/Myl32AaxL/nSV/x5h/rgM95AuEdEShPpo3kroj /4TZQnndhbSMjDNiKyRya8jJuLwVTowrz865HOuktTJLiWcTuAnaZ29froMWxmPW5yqO OfsUEcj0J1D3sPYWl4XegueHvsTYEskvAX+Lf2GbMcca/D18vuj+9ViWGDjZ8qWjuCyB VWsUNHgj5ZVeiNwcr07TF9p3i+Z2x1917aDNwfoeIHF371/8Yz3s2ZNtseOI6YsahSjO voWg== X-Gm-Message-State: AOAM532Z8xOPbJ1N7cKhNl5Mqqt+HoCumQR92Mw/5pXnYR7XQb/2Y6rT dOGj+aZ5flYU7uB5Cq3YgflqoA== X-Received: by 2002:a5e:8f43:: with SMTP id x3mr4318023iop.206.1628797843642; Thu, 12 Aug 2021 12:50:43 -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 s16sm2058821iln.5.2021.08.12.12.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 12:50:43 -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 6/6] net: ipa: don't hold clock reference while netdev open Date: Thu, 12 Aug 2021 14:50:35 -0500 Message-Id: <20210812195035.2816276-7-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210812195035.2816276-1-elder@linaro.org> References: <20210812195035.2816276-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently a clock reference is taken whenever the ->ndo_open callback for the modem netdev is called. That reference is dropped when the device is closed, in ipa_stop(). We no longer need this, because ipa_start_xmit() now handles the situation where the hardware power state is not active. Drop the clock reference in ipa_open() when we're done, and take a new reference in ipa_stop() before we begin closing the interface. Finally (and unrelated, but trivial), change the return type of ipa_start_xmit() to be netdev_tx_t instead of int. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index b176910d72868..c8724af935b85 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -65,6 +65,8 @@ static int ipa_open(struct net_device *netdev) netif_start_queue(netdev); + (void)ipa_clock_put(ipa); + return 0; err_disable_tx: @@ -80,12 +82,17 @@ static int ipa_stop(struct net_device *netdev) { struct ipa_priv *priv = netdev_priv(netdev); struct ipa *ipa = priv->ipa; + int ret; + + ret = ipa_clock_get(ipa); + if (WARN_ON(ret < 0)) + goto out_clock_put; netif_stop_queue(netdev); ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); - +out_clock_put: (void)ipa_clock_put(ipa); return 0; @@ -99,7 +106,8 @@ static int ipa_stop(struct net_device *netdev) * NETDEV_TX_OK: Success * NETDEV_TX_BUSY: Error while transmitting the skb. Try again later */ -static int ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) +static netdev_tx_t +ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) { struct net_device_stats *stats = &netdev->stats; struct ipa_priv *priv = netdev_priv(netdev); -- 2.27.0