From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
npiggin@gmail.com, christophe.leroy@csgroup.eu,
mpe@ellerman.id.au, peterz@infradead.org, fbarrat@linux.ibm.com,
ajd@linux.ibm.com, mahesh@linux.ibm.com, oohall@gmail.com,
hbathini@linux.ibm.com, dhowells@redhat.com, haren@linux.ibm.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/6] powerpc: sysdev: use lock guard for mutex
Date: Wed, 30 Apr 2025 18:40:10 +0530 [thread overview]
Message-ID: <aBIhMiNTpu6t8Hej@linux.ibm.com> (raw)
In-Reply-To: <20250314114502.2083434-7-sshegde@linux.ibm.com>
* Shrikanth Hegde <sshegde@linux.ibm.com> [2025-03-14 17:15:02]:
> use guard(mutex) for scope based resource management of mutex
> This would make the code simpler and easier to maintain.
>
> More details on lock guards can be found at
> https://lore.kernel.org/all/20230612093537.614161713@infradead.org/T/#u
>
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> ---
> arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
> index ce6c739c51e5..bbfc7c39b957 100644
> --- a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
> +++ b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
> @@ -75,7 +75,7 @@ static ssize_t fsl_timer_wakeup_store(struct device *dev,
> if (kstrtoll(buf, 0, &interval))
> return -EINVAL;
>
> - mutex_lock(&sysfs_lock);
> + guard(mutex)(&sysfs_lock);
>
> if (fsl_wakeup->timer) {
> disable_irq_wake(fsl_wakeup->timer->irq);
> @@ -84,14 +84,12 @@ static ssize_t fsl_timer_wakeup_store(struct device *dev,
> }
>
> if (!interval) {
> - mutex_unlock(&sysfs_lock);
> return count;
> }
Nit: Here and the next change, due to the current change, there is no need
for curly braces.
Other than this nit looks good to me.
Reviewed-by: Srikar Dronamraju <srikar@linux.ibm.com>
--
Thanks and Regards
Srikar Dronamraju
next prev parent reply other threads:[~2025-04-30 13:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 11:44 [PATCH v2 0/6] powerpc: use lock guards for mutex Set 1 Shrikanth Hegde
2025-03-14 11:44 ` [PATCH v2 1/6] powerpc: eeh: use lock guard for mutex Shrikanth Hegde
2025-03-14 11:44 ` [PATCH v2 2/6] powerpc: rtas: " Shrikanth Hegde
2025-03-14 11:44 ` [PATCH v2 3/6] powerpc: fadump: " Shrikanth Hegde
2025-03-14 11:45 ` [PATCH v2 4/6] powerpc: book3s: vas: " Shrikanth Hegde
2025-03-14 11:45 ` [PATCH v2 5/6] powerpc: powernv: ocxl: " Shrikanth Hegde
2025-03-19 4:00 ` Andrew Donnellan
2025-03-14 11:45 ` [PATCH v2 6/6] powerpc: sysdev: " Shrikanth Hegde
2025-04-30 13:10 ` Srikar Dronamraju [this message]
2025-05-05 4:02 ` Shrikanth Hegde
2025-04-30 13:29 ` [PATCH v2 0/6] powerpc: use lock guards for mutex Set 1 Srikar Dronamraju
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=aBIhMiNTpu6t8Hej@linux.ibm.com \
--to=srikar@linux.ibm.com \
--cc=ajd@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dhowells@redhat.com \
--cc=fbarrat@linux.ibm.com \
--cc=haren@linux.ibm.com \
--cc=hbathini@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=peterz@infradead.org \
--cc=sshegde@linux.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).