linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory/samsung: reduce unnecessary mutex lock area
@ 2020-05-08 13:13 Bernard Zhao
  2020-05-12  6:50 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Bernard Zhao @ 2020-05-08 13:13 UTC (permalink / raw)
  To: Lukasz Luba, Kukjin Kim, Krzysztof Kozlowski, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: opensource.kernel, Bernard Zhao

Maybe dmc->df->lock is unnecessary to protect function
exynos5_dmc_perf_events_check(dmc). If we have to protect,
dmc->lock is more better and more effective.
Also, it seems not needed to protect "if (ret) & dev_warn"
branch.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/memory/samsung/exynos5422-dmc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
index 22a43d662833..88e8ac8b5327 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -1345,16 +1345,14 @@ static irqreturn_t dmc_irq_thread(int irq, void *priv)
 	int res;
 	struct exynos5_dmc *dmc = priv;
 
-	mutex_lock(&dmc->df->lock);
-
 	exynos5_dmc_perf_events_check(dmc);
 
+	mutex_lock(&dmc->df->lock);
 	res = update_devfreq(dmc->df);
+	mutex_unlock(&dmc->df->lock);
 	if (res)
 		dev_warn(dmc->dev, "devfreq failed with %d\n", res);
 
-	mutex_unlock(&dmc->df->lock);
-
 	return IRQ_HANDLED;
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re: [PATCH] memory/samsung: reduce unnecessary mutex lock area
@ 2020-05-08 18:27 Markus Elfring
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2020-05-08 18:27 UTC (permalink / raw)
  To: Bernard Zhao, linux-arm-kernel, linux-pm, linux-samsung-soc
  Cc: linux-kernel, opensource.kernel, Krzysztof Kozlowski, Kukjin Kim,
	Lukasz Luba

> Maybe dmc->df->lock is unnecessary to protect function
> exynos5_dmc_perf_events_check(dmc). If we have to protect,
> dmc->lock is more better and more effective.
> Also, it seems not needed to protect "if (ret) & dev_warn"
> branch.

I suggest to improve also this commit message.

* Please reduce uncertainty.

* An imperative wording is probably preferred, isn't it?

* Will it be more appropriate to refer to the action “Reduce the lock scope”?

* Would you like to add the tag “Fixes” to the change description?

Regards,
Markus

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-12  9:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 13:13 [PATCH] memory/samsung: reduce unnecessary mutex lock area Bernard Zhao
2020-05-12  6:50 ` Krzysztof Kozlowski
2020-05-12  8:47   ` Lukasz Luba
2020-05-12  9:05     ` Krzysztof Kozlowski
2020-05-12  9:19       ` Bernard
2020-05-12  9:23       ` Lukasz Luba
2020-05-08 18:27 Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).