original_kernel/drivers/char
Arnd Bergmann 613655fa39 drivers: 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.

These drivers do not seem to be under active
maintainance from my brief investigation. Apologies
to those maintainers that I have missed.

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>
2010-10-05 15:01:04 +02:00
..
agp
hw_random
ip2 drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
ipmi
mwave drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
pcmcia drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
rio drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
tpm
xilinx_hwicap drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
.gitignore
Kconfig
Makefile
amiserial.c
apm-emulation.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
applicom.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
applicom.h
bfin-otp.c
bfin_jtag_comm.c
briq_panel.c
bsr.c
cd1865.h
consolemap.c
cp437.uni
cs5535_gpio.c
cyclades.c
defkeymap.c_shipped
defkeymap.map
digi1.h
digiFep1.h
digiPCI.h
ds1302.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
ds1620.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
dsp56k.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
dtlk.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
efirtc.c
epca.c
epca.h
epcaconfig.h
generic_nvram.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
generic_serial.c
genrtc.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
hangcheck-timer.c
hpet.c
hvc_beat.c
hvc_console.c
hvc_console.h
hvc_irq.c
hvc_iseries.c
hvc_iucv.c
hvc_rtas.c
hvc_tile.c
hvc_udbg.c
hvc_vio.c
hvc_xen.c
hvcs.c
hvsi.c
i8k.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
isicom.c
istallion.c
keyboard.c
lp.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
mbcs.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
mbcs.h
mem.c
misc.c
mmtimer.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
moxa.c
moxa.h
mspec.c
mxser.c
mxser.h
n_gsm.c
n_hdlc.c
n_r3964.c
n_tty.c
nozomi.c
nsc_gpio.c
nvram.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
nwbutton.c
nwbutton.h
nwflash.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
pc8736x_gpio.c
ppdev.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
ps3flash.c
pty.c
ramoops.c
random.c
raw.c
riscom8.c
riscom8.h
riscom8_reg.h
rocket.c
rocket.h
rocket_int.h
rtc.c
scc.h
scx200_gpio.c
selection.c
ser_a2232.c
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c
snsc.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
snsc.h
snsc_event.c
sonypi.c
specialix.c
specialix_io8.h
stallion.c
sx.c
sx.h
sxboards.h
sxwindow.h
synclink.c
synclink_gt.c
synclinkmp.c
sysrq.c
tb0219.c
tlclk.c
toshiba.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
tty_audit.c
tty_buffer.c
tty_io.c
tty_ioctl.c
tty_ldisc.c
tty_mutex.c
tty_port.c
uv_mmtimer.c
vc_screen.c
viotape.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
virtio_console.c
vme_scc.c
vt.c
vt_ioctl.c