From: Biju Das <biju.das.jz@bp.renesas.com>
To: William Breathitt Gray <william.gray@linaro.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Pavel Machek <pavel@denx.de>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: [PATCH v2] counter: rz-mtu3-cnt: Reorder locking sequence for consistency
Date: Fri, 21 Jul 2023 16:39:33 +0100 [thread overview]
Message-ID: <20230721153933.332108-1-biju.das.jz@bp.renesas.com> (raw)
All functions except rz_mtu3_count_enable_write(), calls
pm_runtime_{get,put} inside the lock. For consistency do the same here.
Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://patchwork.kernel.org/project/cip-dev/patch/20230606075235.183132-6-biju.das.jz@bp.renesas.com/
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
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
next reply other threads:[~2023-07-21 15:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 15:39 Biju Das [this message]
2023-07-24 14:47 ` [PATCH v2] counter: rz-mtu3-cnt: Reorder locking sequence for consistency Geert Uytterhoeven
2023-07-24 15:22 ` Biju Das
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=20230721153933.332108-1-biju.das.jz@bp.renesas.com \
--to=biju.das.jz@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-iio@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=pavel@denx.de \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=william.gray@linaro.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 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.