linux-stable/drivers/usb/misc
Arnd Bergmann 925ce689bb USB: autoconvert trivial BKL users to private mutex
All these files use the big kernel lock in a trivial
way to serialize their private file operations,
typically resulting from an earlier semi-automatic
pushdown from VFS.

None of these drivers appears to want to lock against
other code, and they all use the BKL as the top-level
lock in their file operations, meaning that there
is no lock-order inversion problem.

Consequently, we can remove the BKL completely,
replacing it with a per-file mutex in every case.
Using a scripted approach means we can avoid
typos.

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: Greg Kroah-Hartman <gregkh@suse.de>
2010-08-10 14:35:39 -07:00
..
sisusbvga USB: sisusbvga: Fix for USB 3.0 2010-07-26 12:00:58 -07:00
adutux.c USB: Convert concatenated __FILE__ to %s, __FILE__ 2010-03-02 14:54:59 -08:00
appledisplay.c USB: rename usb_buffer_alloc() and usb_buffer_free() users 2010-05-20 13:21:38 -07:00
cypress_cy7c63.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cytherm.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
emi26.c USB misc: make USB device id constant 2010-03-02 14:54:17 -08:00
emi62.c USB misc: make USB device id constant 2010-03-02 14:54:17 -08:00
ftdi-elan.c USB: rename usb_buffer_alloc() and usb_buffer_free() users 2010-05-20 13:21:38 -07:00
idmouse.c USB: BKL removal: idmouse 2010-03-02 14:54:28 -08:00
iowarrior.c USB: autoconvert trivial BKL users to private mutex 2010-08-10 14:35:39 -07:00
isight_firmware.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Kconfig USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers 2010-03-02 14:55:08 -08:00
ldusb.c USB: Convert concatenated __FILE__ to %s, __FILE__ 2010-03-02 14:54:59 -08:00
legousbtower.c USB: Convert concatenated __FILE__ to %s, __FILE__ 2010-03-02 14:54:59 -08:00
Makefile USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers 2010-03-02 14:55:08 -08:00
rio500.c USB: autoconvert trivial BKL users to private mutex 2010-08-10 14:35:39 -07:00
rio500_usb.h
trancevibrator.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
usb_u132.h
usblcd.c USB: autoconvert trivial BKL users to private mutex 2010-08-10 14:35:39 -07:00
usbled.c USB misc: make USB device id constant 2010-03-02 14:54:17 -08:00
usbsevseg.c USB: fixed bug in usbsevseg using USB autosuspend incorrectly 2010-04-22 15:18:21 -07:00
usbtest.c USB-BKL: Convert usb_driver ioctl to unlocked_ioctl 2010-08-10 14:35:35 -07:00
uss720.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00