public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: evgreen@chromium.org, subashab@codeaurora.org,
	cpratapa@codeaurora.org, bjorn.andersson@linaro.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 2/5] net: ipa: manage endpoints separate from clock
Date: Tue,  8 Sep 2020 19:21:24 -0500	[thread overview]
Message-ID: <20200909002127.21089-3-elder@linaro.org> (raw)
In-Reply-To: <20200909002127.21089-1-elder@linaro.org>

Currently, when (before) the last IPA clock reference is dropped,
all endpoints are suspended.  And whenever the first IPA clock
reference is taken, all endpoints are resumed (or started).

In most cases there's no need to start endpoints when the clock
starts.  So move the calls to ipa_endpoint_suspend() and
ipa_endpoint_resume() out of ipa_clock_put() and ipa_clock_get(),
respectiely.  Instead, only suspend endpoints when handling a system
suspend, and only resume endpoints when handling a system resume.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/ipa_clock.c | 4 ----
 drivers/net/ipa/ipa_main.c  | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c
index 398f2e47043d8..f2d61c35ef941 100644
--- a/drivers/net/ipa/ipa_clock.c
+++ b/drivers/net/ipa/ipa_clock.c
@@ -229,8 +229,6 @@ void ipa_clock_get(struct ipa *ipa)
 		goto out_mutex_unlock;
 	}
 
-	ipa_endpoint_resume(ipa);
-
 	atomic_inc(&clock->count);
 
 out_mutex_unlock:
@@ -249,8 +247,6 @@ void ipa_clock_put(struct ipa *ipa)
 	if (!atomic_dec_and_mutex_lock(&clock->count, &clock->mutex))
 		return;
 
-	ipa_endpoint_suspend(ipa);
-
 	ipa_clock_disable(ipa);
 
 	mutex_unlock(&clock->mutex);
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 6b843fc989122..b8e4a2532fc1a 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -917,6 +917,8 @@ static int ipa_suspend(struct device *dev)
 {
 	struct ipa *ipa = dev_get_drvdata(dev);
 
+	ipa_endpoint_suspend(ipa);
+
 	ipa_clock_put(ipa);
 	if (!atomic_xchg(&ipa->suspend_ref, 0))
 		dev_err(dev, "suspend: missing suspend clock reference\n");
@@ -943,6 +945,8 @@ static int ipa_resume(struct device *dev)
 		dev_err(dev, "resume: duplicate suspend clock reference\n");
 	ipa_clock_get(ipa);
 
+	ipa_endpoint_resume(ipa);
+
 	return 0;
 }
 
-- 
2.20.1


  parent reply	other threads:[~2020-09-09  0:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09  0:21 [PATCH net-next 0/5] net: ipa: wake up system on RX available Alex Elder
2020-09-09  0:21 ` [PATCH net-next 1/5] net: ipa: use atomic exchange for suspend reference Alex Elder
2020-09-09  3:27   ` David Miller
2020-09-09 13:43     ` Alex Elder
2020-09-09 21:14       ` David Miller
2020-09-09 21:23         ` Alex Elder
2020-09-09  0:21 ` Alex Elder [this message]
2020-09-09  0:21 ` [PATCH net-next 3/5] net: ipa: use device_init_wakeup() Alex Elder
2020-09-09  0:21 ` [PATCH net-next 4/5] net: ipa: enable wakeup on IPA interrupt Alex Elder
2020-09-09  0:21 ` [PATCH net-next 5/5] net: ipa: do not enable GSI interrupt for wakeup Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200909002127.21089-3-elder@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cpratapa@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=evgreen@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=subashab@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox