android_kernel_xiaomi_sm8350/drivers
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
..
accessibility
acpi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2010-09-07 16:00:17 -07:00
amba
ata libata-sff: Reenable Port Multiplier after libata-sff remodeling. 2010-09-09 22:31:55 -04:00
atm
auxdisplay
base PM: Prevent waiting forever on asynchronous resume after failing suspend 2010-09-09 00:49:43 +02:00
block drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
bluetooth
cdrom
char drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
clocksource
connector
cpufreq
cpuidle
crypto
dca
dio
dma
edac
eisa
firewire firewire: ohci: work around VIA and NEC PHY packet reception bug 2010-08-29 09:17:31 +02:00
firmware
gpio gpio: sx150x: correct and refine reset-on-probe behavior 2010-09-09 18:57:24 -07:00
gpu Merge branch 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel 2010-09-10 18:19:43 -07:00
hid
hwmon drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
i2c
ide
idle
ieee1394
ieee802154
infiniband Merge branches 'cxgb3' and 'nes' into for-linus 2010-09-08 14:43:28 -07:00
input drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
isdn
leds
lguest
macintosh mac: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:47 +02:00
mca
md md: resolve confusion of MD_CHANGE_CLEAN 2010-08-30 18:06:21 +10:00
media
memstick
message scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
mfd
misc drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
mmc drivers/mmc/host/imxmmc.c: adjust confusing if indentation 2010-09-09 18:57:23 -07:00
mtd mtd: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:46 +02:00
net ipheth: remove incorrect devtype to WWAN 2010-09-09 21:41:59 -07:00
nubus
of
oprofile
parisc
parport
pci drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
pcmcia
platform
pnp
power
pps
ps3
rapidio
regulator
rtc drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
s390 Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block 2010-09-10 07:26:27 -07:00
sbus drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
scsi scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
serial serial: bfin_sport_uart: restore transmit frame sync fix 2010-09-03 17:29:04 -07:00
sfi
sh
sn
spi
ssb
staging Staging: wlan-ng: Explicitly set some fields in cfg80211 interface 2010-09-03 17:37:16 -07:00
tc
telephony drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
thermal
uio
usb USB: ftdi_sio: Added custom PIDs for ChamSys products 2010-09-03 17:33:41 -07:00
uwb
vhost vhost: error handling fix 2010-09-06 09:49:39 +03:00
video ARM: pxa168fb: fix section mismatch 2010-08-30 09:59:44 +08:00
virtio
vlynq
w1
watchdog drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
xen Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-08-28 13:55:31 -07:00
zorro
Kconfig
Makefile