]> git.baikalelectronics.ru Git - kernel.git/commit
sound: autoconvert trivial BKL users to private mutex
authorArnd Bergmann <arnd@arndb.de>
Tue, 14 Sep 2010 19:53:41 +0000 (21:53 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 14 Sep 2010 21:14:50 +0000 (23:14 +0200)
commit7af447016e53f07e5c45e5939752635566bd6dbf
treef5e5df85076f397690437f09cb56688b06a03dbf
parent859a2f38f4f1cdbcc78c1c80c11d828aa29c275b
sound: autoconvert trivial BKL users to private mutex

The usage of the BKL in the OSS sound drivers is
trivial, and each of them only locks against itself,
so it can be turned into per-driver mutexes.

This is the script that was used for the conversion:

file=$1
name=$2
if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
            sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
    else
            sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
    fi
    sed -i ${file} \
        -e "/^#include.*linux.mutex.h/,$ {
                1,/^\(static\|int\|long\)/ {
                     /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

} }"  \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[      ]*cycle_kernel_lock();/d'
else
    sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                -e '/cycle_kernel_lock()/d'
fi

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/oss/au1550_ac97.c
sound/oss/dmasound/dmasound_core.c
sound/oss/msnd_pinnacle.c
sound/oss/sh_dac_audio.c
sound/oss/soundcard.c
sound/oss/swarm_cs4297a.c
sound/oss/vwsnd.c