android_kernel_xiaomi_sm8350/drivers/misc
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
..
c2port sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
cb710 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
eeprom i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
ibmasm 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
iwmc3200top 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
sgi-gru sgi-gru: use for_each_set_bit() 2010-03-12 15:52:44 -08:00
sgi-xp 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
ad525x_dpot-i2c.c ad525x_dpot: add support for one time programmable pots 2010-05-25 08:07:04 -07:00
ad525x_dpot-spi.c ad525x_dpot: add support for SPI parts 2010-05-25 08:07:04 -07:00
ad525x_dpot.c ad525x_dpot: add support for one time programmable pots 2010-05-25 08:07:04 -07:00
ad525x_dpot.h ad525x_dpot: add support for one time programmable pots 2010-05-25 08:07:04 -07:00
arm-charlcd.c ARM: 6214/2: driver for the character LCD found in ARM refdesigns 2010-07-26 10:48:28 +01:00
atmel_pwm.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
atmel_tclib.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
atmel-ssc.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
bh1780gli.c drivers/misc: ROHM BH1780GLI ambient light sensor driver 2010-08-09 20:45:05 -07:00
bmp085.c drivers/misc: support for the pressure sensor BMP085 from Bosch Sensortec 2010-08-09 20:45:05 -07:00
cs5535-mfgpt.c cs5535-mfgpt: reuse timers that have never been set up 2010-08-11 08:59:20 -07:00
ds1682.c sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
enclosure.c [SCSI] enclosure: fix error path - actually return ERR_PTR() on error 2010-07-27 12:03:48 -05:00
ep93xx_pwm.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
hmc6352.c hmc6352: add driver for the HMC6352 compass 2010-08-09 20:45:10 -07:00
hpilo.c hpilo: fix pointer warning in ilo_ccb_setup 2010-08-09 20:45:05 -07:00
hpilo.h hpilo: fix pointer warning in ilo_ccb_setup 2010-08-09 20:45:05 -07:00
ics932s401.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
ioc4.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
isl29003.c
Kconfig hmc6352: add driver for the HMC6352 compass 2010-08-09 20:45:10 -07:00
kgdbts.c kgdbts,sh: Add in breakpoint pc offset for superh 2010-04-02 14:58:17 -05:00
lkdtm.c param: remove unnecessary writable charp 2010-08-11 23:04:27 +09:30
Makefile hmc6352: add driver for the HMC6352 compass 2010-08-09 20:45:10 -07:00
phantom.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
ti_dac7512.c drivers/misc: add driver for Texas Instruments DAC7512 2009-12-15 08:53:25 -08:00
tifm_7xx1.c
tifm_core.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
tsl2550.c tsl2550: Move from i2c/chips to misc 2010-03-13 20:56:54 +01:00
vmware_balloon.c vmware balloon: clamp number of collected non-balloonable pages 2010-06-04 15:21:44 -07:00