kernel-ark/drivers/char/rio
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
..
board.h
cirrus.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
cmdblk.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
cmdpkt.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
daemon.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
errors.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
func.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
host.h long vs. unsigned long - low-hanging fruits in drivers 2007-10-14 12:41:51 -07:00
link.h
linux_compat.h
Makefile
map.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
param.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
parmmap.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
pci.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
phb.h
pkt.h
port.h
protsts.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
rio_linux.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
rio_linux.h drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
rio.h
rioboard.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
rioboot.c drivers: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:32 -04:00
riocmd.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
rioctrl.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
riodrvr.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
rioinfo.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
rioinit.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
riointr.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
rioioctl.h
rioparam.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
rioroute.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
riospace.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
riotable.c drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00
riotty.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
route.h tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
rup.h
unixrup.h drivers/char/rio/: remove VCS tags 2008-07-20 17:12:35 -07:00