From patchwork Tue Jul 27 21:19:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 486771 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp593246jas; Tue, 27 Jul 2021 14:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB6FYwiBJyc8PBvQyonxaIZB45sMkRbKFnOUG/JtPmzxufm8s2xtlDuLW3rIIWt8uG8Ak7 X-Received: by 2002:a05:6e02:1d8a:: with SMTP id h10mr13619313ila.20.1627420899244; Tue, 27 Jul 2021 14:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420899; cv=none; d=google.com; s=arc-20160816; b=A2osR64cg49S/4bJhBwpwsy4Hg2NMLMYehfZxckMEYXF4FEuJv0dkFU+BRbrzdBeRx uSsz6IDI5+hlRsSPOnSOzBeBwLDybxRvrdeZLWZtVvTCvP3hMIZSKzUyTtlAdIXNnQ+A L7TCWBmjyS7CemTqkSey5rJp1qBhcosHoM4/eyF6rVarW+dXC3W4ignXz9Kx/p46FuPB nJUg0qkNp/S/5IYBcZCcPvsZP9OYZ31cF4ZSO40URrw5i6OH/89zUZ+H5+0eCZUPUqNx poY/1BpjTgckvEBJe6erN8Ir1iMEKfg/yLu2gLwMlCJeWyhqOqkk/b9whf8Ccx4PNYLb 0p6g== 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=eQ0hc8oNad64A8+9UICGjrxeLo53QWe70jQkDi/osB0=; b=OEL9R0cg7WhCJh10i0AlG0h/Hn4Oy3F2VWyVYnjbWUfoeMAF/j8pYuXLGw51TYh7fn q7/c22ThCl/xuL8bkkiBkaTzS1kFusy6M1zUfgj4RpaDb41TrQQ8gWVGTAv4cny+SuF7 ew4QkFdHsPOUt2Lzq3Y18WwtLT6uYCXkd031o5lNyKlSsFqon+jdqp0YAM8i2QGTFOmm MAzVmnwZmTkX0H1+blFcKVzhOdDef+E1YiawUQCk58FFkN3zjyNdK1L6EU1Gu0ApQHRF BXfObwWwImLygs5L4D1l6aNzN9iAX6AuK5hdc2ic6EpKHoEe7rdM6+PSP+KLyxmPVNrW uqNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RDm8E0R5; 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 y18si4172048ily.67.2021.07.27.14.21.39; Tue, 27 Jul 2021 14:21:39 -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=RDm8E0R5; 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 S235128AbhG0VVg (ORCPT + 8 others); Tue, 27 Jul 2021 17:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233373AbhG0VVO (ORCPT ); Tue, 27 Jul 2021 17:21:14 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F88FC0619EE for ; Tue, 27 Jul 2021 14:19:40 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id r18so421551iot.4 for ; Tue, 27 Jul 2021 14:19:40 -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=eQ0hc8oNad64A8+9UICGjrxeLo53QWe70jQkDi/osB0=; b=RDm8E0R5gVFNFF6I7jWcjqO9IBb4SgKvwFEh/9SaVA4RmsBUNC4YFun3P3vrUmwO6P w8IZfZyB9YKNO30/lw/7K8IGz1N7qmQezlvS1p7YVrqDAMUwm60V/FVdO15zRturGXrO yxulgpVRo7XisVygtT7mbxJsC9bYUCZJu+PBHxjakrwAXpsf3lGlRvMnhxtf+fNvvZtq 0lWMtw3ywvOEoeebWVZ55dQJqT3De7dvkiQTH4+l8Oz0qsTLiQ8TDKxfOGLrpbEgd2S6 UrbkNwbkPxpPdEPTleHSKOygAUFdmcDnYqORTr+J4PMomnKB2ovOnoJZCbTfZgrI6Map NrrA== 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=eQ0hc8oNad64A8+9UICGjrxeLo53QWe70jQkDi/osB0=; b=fpChbpv+1vZScXCKORCfg8+CZvmN7PDL33BO4yYrfvaakdbOL5kOWSnZ/8MR9DyEZp w7bgAwbfSqVMY+4vO8hQfPYpX8RCfeecGr+vxDNBuVPfnmT4C+lkyuczshJWz4vOHdg+ sNARgT0litUp5056p2ISjPmtwel/mxr23d2xdHrEZb9NRG1TjZSNq1JN1RWnzEFM3NNV YnC54DymG6bQYfM4aU6ZMawljc/nn6UM4mTUR3RaNzpMpfkGDW8u3x7+9s07SiV1Bikd CDFDXGzm0H2hsor7fGC348HvsxVWGfnBmoFay/s3IaLM67Ihz7DeLX/LIaQEcCQa2iFU ZdrQ== X-Gm-Message-State: AOAM530Vc0O/qEA+XwG2qlqAvAcNp6UrpWbkV+HpHV5I4lxTwwPFVI/V BQ+0bAFK/ij0JXBlGN7IjpyeDA== X-Received: by 2002:a6b:fe03:: with SMTP id x3mr20190538ioh.120.1627420779526; Tue, 27 Jul 2021 14:19:39 -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 s21sm3136068iot.33.2021.07.27.14.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:19:39 -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/5] net: ipa: add a clock reference for netdev operations Date: Tue, 27 Jul 2021 16:19:32 -0500 Message-Id: <20210727211933.926593-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727211933.926593-1-elder@linaro.org> References: <20210727211933.926593-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The IPA network device can be opened at any time, and an opened network device can be stopped any time. Both of these callback functions require access to the hardware, and therefore they need the IPA clock to be operational. Take an IPA clock reference in both the ->open and ->stop callback functions, dropping the reference when they are done accessing hardware. The ->start_xmit callback requires a little different handling, and that will be added separately. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index a744b81db0d9f..4ea8287e9d237 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -45,9 +45,12 @@ static int ipa_open(struct net_device *netdev) struct ipa *ipa = priv->ipa; int ret; + ipa_clock_get(ipa); + ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); if (ret) - return ret; + goto err_clock_put; + ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); if (ret) goto err_disable_tx; @@ -58,6 +61,8 @@ static int ipa_open(struct net_device *netdev) err_disable_tx: ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); +err_clock_put: + ipa_clock_put(ipa); return ret; } @@ -73,6 +78,8 @@ static int ipa_stop(struct net_device *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]); + ipa_clock_put(ipa); + return 0; }