OpenCloudOS-Kernel/drivers/isdn/hysdn
Arnd Bergmann 76a64921da isdn: 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: Karsten Keil <isdn@linux-pingi.de>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-07-12 20:21:47 -07:00
..
Kconfig Kconfig: Remove useless and sometimes wrong comments 2009-11-09 09:40:56 +01:00
Makefile
boardergo.c hysdn: Remove cli()/sti() calls. 2008-05-14 23:25:33 -07:00
boardergo.h
hycapi.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
hysdn_boot.c isdn: misplaced parenthesis in pof_handle_data() 2010-03-15 15:47:01 -07:00
hysdn_defs.h [PATCH] drivers/isdn/hysdn: save_flags()/cli(), restore_flags() replaced appropriately 2006-10-17 08:18:48 -07:00
hysdn_init.c [ISDN] hysdn: convert to PCI hotplug API 2007-10-12 09:14:49 -04:00
hysdn_net.c ISDN: hysdn, fix potential NULL dereference 2010-06-26 22:12:02 -07:00
hysdn_pof.h hysdn: remove the packed attribute from PofTimStamp_tag 2008-07-30 16:48:05 -07:00
hysdn_procconf.c isdn: autoconvert trivial BKL users to private mutex 2010-07-12 20:21:47 -07:00
hysdn_proclog.c isdn: autoconvert trivial BKL users to private mutex 2010-07-12 20:21:47 -07:00
hysdn_sched.c [SK_BUFF]: Introduce skb_copy_from_linear_data{_offset} 2007-04-25 22:28:23 -07:00
ince1pc.h