linux/drivers/char/ipmi
Arnd Bergmann 609146fdb3 ipmi: 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>
Acked-by: Corey Minyard <cminyard@mvista.com>
Cc: openipmi-developer@lists.sourceforge.net
2010-09-15 21:00:48 +02:00
..
Kconfig Use menuconfig objects II - IPMI 2007-07-16 09:05:40 -07:00
Makefile ipmi: remove unused target and action in Makefile 2008-04-29 08:06:15 -07:00
ipmi_bt_sm.c IPMI: Style fixes in the system interface code 2008-04-29 08:06:15 -07:00
ipmi_devintf.c ipmi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:48 +02:00
ipmi_kcs_sm.c drivers/char/ipmi: Use KCS_IDLE_STATE 2009-12-16 07:20:10 -08:00
ipmi_msghandler.c ipmi: update driver to use dev_printk and its constructs 2010-05-27 09:12:50 -07:00
ipmi_poweroff.c sysctl: Drop & in front of every proc_handler. 2009-11-18 08:37:40 -08:00
ipmi_si_intf.c Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
ipmi_si_sm.h IPMI: Style fixes in the system interface code 2008-04-29 08:06:15 -07:00
ipmi_smic_sm.c IPMI: Style fixes in the system interface code 2008-04-29 08:06:15 -07:00
ipmi_watchdog.c ipmi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:48 +02:00