linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] counter: rz-mtu3-cnt: Reorder locking sequence for consistency
@ 2023-07-25 15:46 Biju Das
  2023-08-03 19:22 ` William Breathitt Gray
  0 siblings, 1 reply; 2+ messages in thread
From: Biju Das @ 2023-07-25 15:46 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Biju Das, linux-iio, linux-renesas-soc, Geert Uytterhoeven,
	Pavel Machek, Prabhakar Mahadev Lad

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>
---
v2->v3:
 * Updated commit description by replacing 'calls'->'call'.
 * Added Rb tag from Geert.
v1->v2:
 * Updated commit header to make it clear this is not addressing a bug,
   rather it's just cleanup.
---
 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 48c83933aa2f..ee821493b166 100644
--- a/drivers/counter/rz-mtu3-cnt.c
+++ b/drivers/counter/rz-mtu3-cnt.c
@@ -500,8 +500,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;
@@ -510,8 +510,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


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

* Re: [PATCH v3] counter: rz-mtu3-cnt: Reorder locking sequence for consistency
  2023-07-25 15:46 [PATCH v3] counter: rz-mtu3-cnt: Reorder locking sequence for consistency Biju Das
@ 2023-08-03 19:22 ` William Breathitt Gray
  0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2023-08-03 19:22 UTC (permalink / raw)
  To: Biju Das
  Cc: linux-iio, linux-renesas-soc, Geert Uytterhoeven, Pavel Machek,
	Prabhakar Mahadev Lad

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

On Tue, Jul 25, 2023 at 04:46:11PM +0100, Biju Das wrote:
> 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>

Applied to counter-next.

Thanks,

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2023-08-03 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25 15:46 [PATCH v3] counter: rz-mtu3-cnt: Reorder locking sequence for consistency Biju Das
2023-08-03 19:22 ` William Breathitt Gray

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).