Thread (16 messages) 16 messages, 3 authors, 2025-03-19
STALE447d
Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH 0/6] powerpc: use lock guards for mutex Set 1

From: Shrikanth Hegde <hidden>
Date: 2025-03-14 05:46:28
Also in: lkml

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/ (local)


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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help