linux/drivers/scsi/megaraid
Arnd Bergmann c45d15d24e scsi: 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>
Cc: linux-scsi@vger.kernel.org
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
2010-09-15 21:00:45 +02:00
..
Kconfig.megaraid
Makefile
mbox_defs.h tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
mega_common.h [SCSI] replace __FUNCTION__ with __func__ 2008-07-27 10:31:49 -04:00
megaraid_ioctl.h Convert asm/semaphore.h users to linux/semaphore.h 2008-04-18 22:22:54 -04:00
megaraid_mbox.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
megaraid_mbox.h [SCSI] megaraid_mbox: fix Dell CERC firmware problem 2008-04-29 19:34:07 -05:00
megaraid_mm.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
megaraid_mm.h [SCSI] MegaRAID driver management char device moved to misc 2008-02-11 10:20:53 -06:00
megaraid_sas.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
megaraid_sas.h [SCSI] megaraid_sas: version and documentation update 2010-02-17 13:13:00 -06:00