linux/drivers/macintosh
Arnd Bergmann d851b6e04e mac: 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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
2010-09-15 21:00:47 +02:00
..
adb-iop.c
adb.c mac: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:47 +02:00
adbhid.c
ans-lcd.c
ans-lcd.h
apm_emu.c
Kconfig Input: Mac button emulation - allow compiling as a module 2010-01-30 01:48:03 -08:00
mac_hid.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
macio_asic.c powerpc/macio: Fix probing of macio devices by using the right of match table 2010-06-02 17:50:38 +10:00
macio_sysfs.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
macio-adb.c powerpc/pmac: Add missing unlocks in error path 2010-04-07 18:00:44 +10:00
Makefile
mediabay.c powerpc/macio: Fix probing of macio devices by using the right of match table 2010-06-02 17:50:38 +10:00
nvram.c drivers: Push down BKL into various drivers 2010-05-17 05:27:41 +02:00
rack-meter.c powerpc/macio: Fix probing of macio devices by using the right of match table 2010-06-02 17:50:38 +10:00
smu.c mac: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:47 +02:00
therm_adt746x.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
therm_pm72.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
therm_pm72.h powerpc: Fix G5 thermal shutdown 2010-03-09 11:55:27 +11:00
therm_windtunnel.c Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2010-08-12 10:06:29 -07:00
via-cuda.c mac68k: start CUDA early 2010-02-27 18:31:13 +01:00
via-macii.c
via-maciisi.c
via-pmu68k.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
via-pmu-backlight.c backlight: Allow properties to be passed at registration 2010-03-16 19:47:54 +00:00
via-pmu-event.c
via-pmu-event.h
via-pmu-led.c
via-pmu.c mac: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:47 +02:00
windfarm_core.c device_attributes: add sysfs_attr_init() for dynamic attributes 2010-04-07 08:38:03 -07:00
windfarm_cpufreq_clamp.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_lm75_sensor.c i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
windfarm_max6690_sensor.c i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
windfarm_pid.c
windfarm_pid.h
windfarm_pm81.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2010-05-21 11:17:05 -07:00
windfarm_pm91.c powerpc/pmac/windfarm: Correct potential double free 2010-04-07 18:00:40 +10:00
windfarm_pm112.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_pm121.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_smu_controls.c sysfs: windfarm: init sysfs attributes 2010-03-07 17:04:51 -08:00
windfarm_smu_sat.c i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
windfarm_smu_sensors.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm.h