All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Pavel Machek <pavel@denx.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: [PATCH 6.1.y-cip 09/15] counter: rz-mtu3-cnt: Reorder locking sequence for consistency
Date: Tue, 12 Sep 2023 20:59:09 +0100	[thread overview]
Message-ID: <20230912195915.607664-10-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20230912195915.607664-1-biju.das.jz@bp.renesas.com>

commit 39266b642ccdc154b48eae11263920956fa0e89e upstream.

All functions except rz_mtu3_count_enable_write(), call
pm_runtime_{get,put} inside the lock. For consistency do the same here.

Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://lore.kernel.org/r/ZH8Fmom8vZ4DwxqA@duo.ucw.cz
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230725154611.227556-1-biju.das.jz@bp.renesas.com/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/counter/rz-mtu3-cnt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c
index a371bab68499..d761e74d6aa3 100644
--- a/drivers/counter/rz-mtu3-cnt.c
+++ b/drivers/counter/rz-mtu3-cnt.c
@@ -496,8 +496,8 @@ static int rz_mtu3_count_enable_write(struct counter_device *counter,
 	int ret = 0;
 
 	if (enable) {
-		pm_runtime_get_sync(ch->dev);
 		mutex_lock(&priv->lock);
+		pm_runtime_get_sync(ch->dev);
 		ret = rz_mtu3_initialize_counter(counter, count->id);
 		if (ret == 0)
 			priv->count_is_enabled[count->id] = true;
@@ -506,8 +506,8 @@ static int rz_mtu3_count_enable_write(struct counter_device *counter,
 		mutex_lock(&priv->lock);
 		rz_mtu3_terminate_counter(counter, count->id);
 		priv->count_is_enabled[count->id] = false;
-		mutex_unlock(&priv->lock);
 		pm_runtime_put(ch->dev);
+		mutex_unlock(&priv->lock);
 	}
 
 	return ret;
-- 
2.25.1



  parent reply	other threads:[~2023-09-12 19:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 19:59 [PATCH 6.1.y-cip 00/15] Enable MTU3 PWM/Counter support on RZ/G2L SMARC Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 01/15] dmaengine: sh: rz-dmac: Improve cleanup order in probe()/remove() Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 02/15] dmaengine: sh: rz-dmac: Fix destination and source data size setting Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 03/15] clk: renesas: r9a07g043: Add MTU3a clock and reset entry Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 04/15] mfd: rz-mtu3: Fix COMPILE_TEST build error Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 05/15] mfd: rz-mtu3: Link time dependencies Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 06/15] mfd: rz-mtu3: Reduce critical sections Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 07/15] mfd: rz-mtu3: Replace raw_spin_lock->spin_lock() Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 08/15] Documentation: ABI: sysfs-bus-counter: Fix indentation Biju Das
2023-09-12 19:59 ` Biju Das [this message]
2023-09-12 19:59 ` [PATCH 6.1.y-cip 10/15] pwm: rz-mtu3: Fix build warning 'num_channel_ios' not described Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 11/15] arm64: defconfig: Enable Renesas MTU3a PWM config Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 12/15] arm64: dts: renesas: rzg2l-smarc: Add support for enabling MTU3 Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 13/15] arm64: dts: renesas: rzg2lc-smarc: " Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 14/15] arm64: dts: renesas: r9a07g043: Add MTU3a node Biju Das
2023-09-12 19:59 ` [PATCH 6.1.y-cip 15/15] arm64: dts: renesas: rzg2ul-smarc: Add support for enabling MTU3 Biju Das
2023-09-12 21:27 ` [PATCH 6.1.y-cip 00/15] Enable MTU3 PWM/Counter support on RZ/G2L SMARC Pavel Machek
2023-09-13 15:51   ` Pavel Machek

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=20230912195915.607664-10-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.