Arnd Bergmann 15fd0cd9a2 net: 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: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-07-12 20:21:47 -07:00
..
2010-06-03 03:18:23 -07:00
2010-05-10 05:01:31 -07:00
2010-07-08 23:12:27 -07:00
2010-07-12 20:21:41 -07:00
2010-06-13 18:20:53 -07:00
2010-06-03 03:18:23 -07:00
2010-06-05 03:04:50 -07:00
2010-05-10 05:01:31 -07:00
2009-09-01 01:13:50 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-06-03 03:18:23 -07:00
2010-07-10 19:42:06 -07:00
2010-07-11 18:15:08 -07:00
2010-05-10 05:01:31 -07:00
2010-07-11 18:15:08 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-07-08 23:42:40 -07:00
2010-07-07 18:24:29 -07:00
2010-05-10 05:01:31 -07:00
2009-04-04 16:51:14 -07:00
2010-07-08 23:12:27 -07:00
2010-07-04 11:44:00 -07:00
2009-08-12 23:03:00 -07:00
2010-02-17 13:35:44 -08:00
2010-02-17 13:35:44 -08:00
2009-11-05 20:00:29 -08:00
2010-07-07 15:45:00 -07:00
2010-04-23 00:10:52 -07:00
2010-02-26 02:10:14 -08:00
2010-06-25 20:37:21 -07:00
2010-06-25 20:37:20 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-06-03 03:18:23 -07:00
2009-11-11 19:22:21 -08:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-17 22:47:34 -07:00
2010-05-10 05:01:31 -07:00
2010-07-08 23:44:26 -07:00
2010-06-25 21:33:14 -07:00
2010-07-05 22:15:47 -07:00
2010-07-07 15:54:54 -07:00
2010-05-17 22:55:10 -07:00
2010-05-10 05:01:31 -07:00
2010-05-17 22:47:34 -07:00
2010-03-18 21:14:00 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-06-21 13:40:25 -07:00
2010-07-05 20:08:05 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-04-22 15:48:17 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2009-04-29 17:32:34 -07:00
2010-07-02 22:27:25 -07:00
2010-05-10 05:01:31 -07:00
2010-07-07 15:00:49 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-06-03 03:18:23 -07:00
2010-05-17 22:47:34 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00
2010-07-12 20:21:42 -07:00
2010-06-03 03:18:23 -07:00
2010-07-11 17:07:44 -07:00
2010-07-11 17:07:43 -07:00
2010-05-10 05:01:31 -07:00
2010-04-14 16:11:33 -07:00
2010-06-03 03:18:23 -07:00
2010-06-03 03:18:23 -07:00
2010-05-10 05:01:31 -07:00
2010-05-10 05:01:31 -07:00