[PATCH v2 00/24] Clean up locking with guard() in ALSA core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



[ I submitted v1 patches from a wrong old branch; here is the
  resubmission of the proper patches, sorry for inconvenience ]

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            | 431 +++++++++++++-------------------
 sound/core/control_compat.c     |  18 +-
 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      | 228 +++++++----------
 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 +--
 34 files changed, 1275 insertions(+), 1945 deletions(-)

-- 
2.35.3





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux