Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 00/24] Clean up locking with guard() in ALSA core
@ 2024-02-23 16:27 Takashi Iwai
  2024-02-23 16:27 ` [PATCH 01/24] ALSA: ump: Use guard() for locking Takashi Iwai
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: Takashi Iwai @ 2024-02-23 16:27 UTC (permalink / raw)
  To: linux-sound

Hi,

this is a patch set for cleaning up the locking code in ALSA core with
the recently introduced guard() macros, i.e. the automatic cleanup
mechanism.

I started poking it in a few days ago, and since then I was very
impressed by how easily and well it simplifies the code.  It'd help
for avoiding leaking unbalanced locks, and reduce the LOC.

Most of changes are pretty systematic, just replacing the lock/unlock
with guard() or scoped_guard().  Some unnecessary variable
substitutions could be reduced by the reduction of unlock.
Also, some got slight code refactoring so that guard() macro can be
applied more cleanly, too.

The remaining lock/unlock are mostly for the cases where temporary
re-locking happens, for example in read/write or open loops.
Those could be improved in future.  Let's see.

The patches cover only the ALSA core area.  The other drivers can
receive benefits in a similar way, I suppose.


Takashi

===

Takashi Iwai (24):
  ALSA: ump: Use guard() for locking
  ALSA: compress_offload: Use guard() for locking
  ALSA: timer: Use guard() for locking
  ALSA: hrtimer: Use guard() for locking
  ALSA: hwdep: Use guard() for locking
  ALSA: info: Use guard() for locking
  ALSA: mixer_oss: Use guard() for locking
  ALSA: control: Use guard() for locking
  ALSA: rawmidi: Use guard() for locking
  ALSA: jack: Use guard() for locking
  ALSA: core: Use guard() for locking
  ALSA: seq: fifo: Use guard() for locking
  ALSA: seq: memory: Use guard() for locking
  ALSA: seq: ports: Use guard() for locking
  ALSA: seq: queue: Use guard() for locking
  ALSA: seq: timer: Use guard() for locking
  ALSA: seq: midi: Use guard() for locking
  ALSA: seq: ump: Use guard() for locking
  ALSA: seq: virmidi: Use guard() for locking
  ALSA: seq: prioq: Use guard() for locking
  ALSA: pcm: Use guard() for locking
  ALSA: pcm: Use guard() for PCM stream locks
  ALSA: pcm: oss: Use guard() for setup
  ALSA: control_led: Use guard() for locking

 include/sound/pcm.h             |  12 +
 sound/core/compress_offload.c   |  98 +++-----
 sound/core/control.c            | 429 +++++++++++++-------------------
 sound/core/control_led.c        | 150 +++++------
 sound/core/hrtimer.c            |  24 +-
 sound/core/hwdep.c              |  49 ++--
 sound/core/info.c               |  93 +++----
 sound/core/info_oss.c           |  10 +-
 sound/core/init.c               | 199 +++++++--------
 sound/core/jack.c               |  25 +-
 sound/core/oss/mixer_oss.c      | 153 +++++-------
 sound/core/oss/pcm_oss.c        |  41 ++-
 sound/core/pcm.c                |  90 +++----
 sound/core/pcm_compat.c         |  66 +++--
 sound/core/pcm_lib.c            |  10 +-
 sound/core/pcm_memory.c         |  30 +--
 sound/core/pcm_native.c         | 340 +++++++++++--------------
 sound/core/rawmidi.c            | 232 ++++++-----------
 sound/core/seq/seq_fifo.c       |  55 ++--
 sound/core/seq/seq_memory.c     |  28 +--
 sound/core/seq/seq_midi.c       |  16 +-
 sound/core/seq/seq_midi_event.c |  14 +-
 sound/core/seq/seq_ports.c      | 114 ++++-----
 sound/core/seq/seq_prioq.c      |  59 ++---
 sound/core/seq/seq_queue.c      |  78 +++---
 sound/core/seq/seq_timer.c      | 163 +++++-------
 sound/core/seq/seq_ump_client.c |  13 +-
 sound/core/seq/seq_virmidi.c    |  18 +-
 sound/core/sound.c              |  28 +--
 sound/core/sound_oss.c          |  17 +-
 sound/core/timer.c              | 429 +++++++++++++-------------------
 sound/core/timer_compat.c       |   7 +-
 sound/core/ump.c                |  35 +--
 33 files changed, 1244 insertions(+), 1881 deletions(-)

-- 
2.35.3


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

end of thread, other threads:[~2024-02-23 16:28 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 16:27 [PATCH 00/24] Clean up locking with guard() in ALSA core Takashi Iwai
2024-02-23 16:27 ` [PATCH 01/24] ALSA: ump: Use guard() for locking Takashi Iwai
2024-02-23 16:27 ` [PATCH 02/24] ALSA: compress_offload: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 03/24] ALSA: timer: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 04/24] ALSA: hrtimer: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 05/24] ALSA: hwdep: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 06/24] ALSA: info: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 07/24] ALSA: mixer_oss: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 08/24] ALSA: control: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 09/24] ALSA: rawmidi: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 10/24] ALSA: jack: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 11/24] ALSA: core: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 12/24] ALSA: seq: fifo: " Takashi Iwai
2024-02-23 16:27 ` [PATCH 13/24] ALSA: seq: memory: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 14/24] ALSA: seq: ports: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 15/24] ALSA: seq: queue: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 16/24] ALSA: seq: timer: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 17/24] ALSA: seq: midi: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 18/24] ALSA: seq: ump: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 19/24] ALSA: seq: virmidi: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 20/24] ALSA: seq: prioq: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 21/24] ALSA: pcm: " Takashi Iwai
2024-02-23 16:28 ` [PATCH 22/24] ALSA: pcm: Use guard() for PCM stream locks Takashi Iwai
2024-02-23 16:28 ` [PATCH 23/24] ALSA: pcm: oss: Use guard() for setup Takashi Iwai
2024-02-23 16:28 ` [PATCH 24/24] ALSA: control_led: Use guard() for locking Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox