From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B04E4C4320E for ; Tue, 27 Jul 2021 21:21:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97D466023F for ; Tue, 27 Jul 2021 21:21:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233116AbhG0VVZ (ORCPT ); Tue, 27 Jul 2021 17:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232888AbhG0VVO (ORCPT ); Tue, 27 Jul 2021 17:21:14 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FF84C0619EF for ; Tue, 27 Jul 2021 14:19:40 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id u15so366316iol.13 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=ZsNEao12ziQJCis5Q8V9KpQK1yqdLIUNFx0h2QnQg0Ck1ydQNZ3nxu0YhUKYn4XfiW Y/fTavihJRePhIoSAvQ537ish4ujOn+Zj7BjQcI9fmWC3a+4HV6/2asFDh/uzgsgdtiO U3rQehv2LYT09f9EqROLV8/wrwgC2+96jCvemxBhIrc5sUMT0uGMHUYMxLE4sFSb0z3N nEHUB9uvoGapxi74V/VOKCF6k5b9DUZ0TnhQ7Rr3Wp7Ynh53Cm7dz2LmdZvoba68kxbz hf0T6090PeFnbQrZWJM2BlrGaJm6IR+eAwc9/jlUZ1+LAMMF1amdQ6hBQGUzc0/ENMCf oMng== X-Gm-Message-State: AOAM531lcgBT0uaHM7KGG5Lww6GDLPk9bpyUh5cW9tQaEyIuTpli8pYC KgsqdqkF7bw57sect/SXQ9dtZg== X-Google-Smtp-Source: ABdhPJxfMa086pPC2uWR9P4wNz22QscLw4YvZSPqGrY38022fR+HhBZ45mKHnyQalA69izUJiAFc9Q== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; } -- 2.27.0