public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Cc: sshegde@linux.ibm.com, 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: [PATCH 0/6] powerpc: use lock guards for mutex Set 1
Date: Fri, 14 Mar 2025 11:15:38 +0530	[thread overview]
Message-ID: <20250314054544.1998928-1-sshegde@linux.ibm.com> (raw)

This is an effort to make the code simpler by making use of lock
guards which were introduced in [1], which works by using __cleanup 
attributes. 

[1]: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org

This series aims mainly at simplifying code around mutex with goto
statements. If it makes sense, there are more code simplification which 
can done for preempt, rcu, spinlock as well. Even for mutex, there is
more which could be done. Even there are usecases for kfree which could
use the new __free infra. 

Copying from the cover-letter of [2], summarising the effort as below.
TL;DR:

	void foo()
	{
		mutex_lock(&lock);
		if (!cond)
			goto unlock;
		...
	unlock:
		mutex_unlock(&lock);
	}

can now be written like:

	void foo()
	{
		guard(mutex)(&lock);
		if (!cond)
			return;
		...
	}

[2]: https://lore.kernel.org/all/20230801204121.929256934@infradead.org/


Please review. Code is compile/boot tested except for powernv. 
Have kept the patches separate for easier bisect. Let me if they should
be combined into one. Commit message is same for all. 

Shrikanth Hegde (6):
  powerpc: eeh: use lock guard for mutex
  powerpc: rtas: use lock guard for mutex
  powerpc: fadump: use lock guard for mutex
  powerpc: book3s: vas: use lock guard for mutex
  powerpc: powenv: oxcl: use lock guard for mutex
  powerpc: sysdev: use lock guard for mutex

 arch/powerpc/kernel/eeh.c                   | 20 +++----
 arch/powerpc/kernel/fadump.c                |  6 +-
 arch/powerpc/kernel/rtas_flash.c            | 64 +++++++--------------
 arch/powerpc/platforms/book3s/vas-api.c     | 19 ++----
 arch/powerpc/platforms/powernv/ocxl.c       | 12 +---
 arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c |  8 +--
 6 files changed, 39 insertions(+), 90 deletions(-)

-- 
2.39.3


             reply	other threads:[~2025-03-14  5:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14  5:45 Shrikanth Hegde [this message]
2025-03-14  5:45 ` [PATCH 1/6] powerpc: eeh: use lock guard for mutex Shrikanth Hegde
2025-03-14  5:45 ` [PATCH 2/6] powerpc: rtas: " Shrikanth Hegde
2025-03-14  5:45 ` [PATCH 3/6] powerpc: fadump: " Shrikanth Hegde
2025-03-14  8:22   ` Peter Zijlstra
2025-03-14  9:08     ` Shrikanth Hegde
2025-03-14  5:45 ` [PATCH 4/6] powerpc: book3s: vas: " Shrikanth Hegde
2025-03-14  8:25   ` Peter Zijlstra
2025-03-14  9:27     ` Shrikanth Hegde
2025-03-14  5:45 ` [PATCH 5/6] powerpc: powenv: oxcl: " Shrikanth Hegde
2025-03-14  6:06   ` Andrew Donnellan
2025-03-14  6:57     ` Shrikanth Hegde
2025-03-14  9:30   ` Shrikanth Hegde
2025-03-14 10:33     ` Shrikanth Hegde
2025-03-19  3:59     ` Andrew Donnellan
2025-03-14  5:45 ` [PATCH 6/6] powerpc: sysdev: " Shrikanth Hegde

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=20250314054544.1998928-1-sshegde@linux.ibm.com \
    --to=sshegde@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 \
    /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