android_kernel_xiaomi_sm8350/drivers/scsi
Arnd Bergmann c45d15d24e scsi: 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: linux-scsi@vger.kernel.org
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
2010-09-15 21:00:45 +02:00
..
aacraid scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
aic7xxx
aic7xxx_old
aic94xx drivers/scsi/aic94xx/aic94xx_init.c: correct the size argument to kmalloc 2010-08-11 08:59:00 -07:00
arcmsr arcmsr_hba: Missing slab.h include 2010-08-17 18:07:43 -07:00
arm
be2iscsi [SCSI] be2iscsi: Fix for Login failure 2010-09-02 17:13:09 -03:00
bfa Merge branch 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2010-08-12 10:01:59 -07:00
bnx2i scsi: fix bnx2i build errors 2010-08-11 08:59:01 -07:00
cxgb3i
device_handler
dpt
fcoe Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
fnic scsi: remove private BIT macros 2010-08-11 08:59:01 -07:00
ibmvscsi [SCSI] ibmvfc: Driver version 1.0.9 2010-08-06 12:26:39 -05:00
libfc [SCSI] libfc: call fc_remote_port_chkready under the host lock. 2010-08-06 11:00:26 -05:00
libsas
lpfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-14 12:34:34 -07:00
megaraid scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
mpt2sas scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
mvsas
osd [SCSI] fix bio.bi_rw handling 2010-09-02 17:11:55 -03:00
pcmcia
pm8001 [SCSI] pm8001: introduce missing kfree 2010-08-06 12:06:08 -05:00
qla2xxx [SCSI] qla2xxx: Update version number to 8.03.04-k0. 2010-09-05 15:22:55 -03:00
qla4xxx drivers/scsi/qla4xxx: fix build 2010-08-20 09:34:56 -07:00
sym53c8xx_2 [SCSI] sd, sym53c8xx: Remove warnings after vsprintf %pV introducation. 2010-09-02 17:23:20 -03:00
.gitignore
3w-9xxx.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
3w-9xxx.h
3w-sas.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
3w-sas.h
3w-xxxx.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
3w-xxxx.h
53c700_d.h_shipped
53c700.c scsi: 53c700: remove dma_is_consistent usage 2010-08-11 08:59:21 -07:00
53c700.h
53c700.scr
a100u2w.c
a100u2w.h
a2091.c
a2091.h
a3000.c
a3000.h
a4000t.c
advansys.c
aha152x.c
aha152x.h
aha1542.c aha1532: remove ISA_DMA_THRESHOLD usage 2010-08-07 18:15:46 +02:00
aha1542.h
aha1740.c
aha1740.h
aic7xxx_old.c
atari_NCR5380.c
atari_scsi.c
atari_scsi.h
atp870u.c
atp870u.h
BusLogic.c
BusLogic.h
bvme6000_scsi.c
ch.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
constants.c [SCSI] Fix warning: zero-length gnu_printf format string 2010-09-02 17:15:31 -03:00
dc395x.c dc395x: decrease iteration for tag_number of max_command in start_scsi() 2010-08-11 08:59:00 -07:00
dc395x.h
dmx3191d.c
dpt_i2o.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
dpti.h
dtc.c
dtc.h
eata_generic.h
eata_pio.c
eata_pio.h
eata.c
esp_scsi.c
esp_scsi.h
fd_mcs.c
fdomain.c
fdomain.h
FlashPoint.c
g_NCR5380_mmio.c
g_NCR5380.c g_NCR5380: fix broken MMIO compilation 2010-08-11 08:59:00 -07:00
g_NCR5380.h g_NCR5380: fix broken MMIO compilation 2010-08-11 08:59:00 -07:00
gdth_ioctl.h
gdth_proc.c
gdth_proc.h
gdth.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
gdth.h
gvp11.c
gvp11.h
hosts.c
hpsa_cmd.h
hpsa.c [SCSI] hpsa: disable doorbell reset on reset_devices 2010-09-02 17:14:44 -03:00
hpsa.h
hptiop.c
hptiop.h
ibmmca.c
imm.c
imm.h
in2000.c
in2000.h
initio.c drivers/scsi: remove unnecessary NULL test 2010-08-11 08:59:00 -07:00
initio.h
ipr.c
ipr.h
ips.c
ips.h
iscsi_boot_sysfs.c [SCSI] iscsi boot: mv iscsi_boot_sysfs to drivers/scsi 2010-08-06 10:45:07 -05:00
iscsi_tcp.c
iscsi_tcp.h
jazz_esp.c
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-14 12:34:34 -07:00
lasi700.c
libiscsi_tcp.c
libiscsi.c
libsrp.c
mac53c94.c
mac53c94.h
mac_esp.c
mac_scsi.c
mac_scsi.h
Makefile [SCSI] iscsi boot: mv iscsi_boot_sysfs to drivers/scsi 2010-08-06 10:45:07 -05:00
megaraid.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
megaraid.h
mesh.c
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
ncr53c8xx.c
ncr53c8xx.h
NCR53c406a.c
NCR5380.c NCR5380: bit MR_DMA_MODE set twice in NCR5380_transfer_dma() 2010-08-11 08:59:00 -07:00
NCR5380.h
NCR_D700.c
NCR_D700.h
NCR_Q720.c
NCR_Q720.h
nsp32_debug.c
nsp32_io.h
nsp32.c
nsp32.h
osst_detect.h
osst_options.h
osst.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
osst.h
pas16.c
pas16.h
pmcraid.c
pmcraid.h
ppa.c
ppa.h
ps3rom.c
qla1280.c
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
qlogicpti.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
qlogicpti.h of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
raid_class.c
script_asm.pl
scsi_debug.c
scsi_devinfo.c
scsi_error.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-14 12:34:34 -07:00
scsi_ioctl.c
scsi_lib_dma.c
scsi_lib.c [SCSI] fix use-after-free in scsi_init_io() 2010-09-09 09:58:18 -05:00
scsi_logging.h
scsi_module.c
scsi_netlink.c
scsi_pm.c
scsi_priv.h SCSI: remove fake "address-of" expression 2010-08-06 09:17:02 -07:00
scsi_proc.c
scsi_sas_internal.h
scsi_scan.c
scsi_sysctl.c
scsi_sysfs.c SCSI: remove fake "address-of" expression 2010-08-06 09:17:02 -07:00
scsi_tgt_if.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
scsi_tgt_lib.c [SCSI] tgt: fix warning 2010-08-11 00:55:42 -04:00
scsi_tgt_priv.h
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc_internal.h
scsi_transport_fc.c drivers: scsi: use newly introduced hex_to_bin() method 2010-08-11 08:59:02 -07:00
scsi_transport_iscsi.c
scsi_transport_sas.c
scsi_transport_spi.c
scsi_transport_srp_internal.h
scsi_transport_srp.c
scsi_typedefs.h
scsi_wait_scan.c
scsi.c
scsi.h
scsicam.c
sd_dif.c
sd.c [SCSI] sd: fix medium-removal bug 2010-09-07 10:31:54 -05:00
sd.h scsi/sd: remove big kernel lock 2010-08-07 18:26:08 +02:00
ses.c
sg.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
sgiwd93.c
sim710.c
sni_53c710.c
sr_ioctl.c
sr_vendor.c
sr.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
sr.h
st_options.h
st.c
st.h
stex.c
sun3_NCR5380.c block: remove wrappers for request type/flags 2010-08-07 18:17:56 +02:00
sun3_scsi_vme.c block: remove wrappers for request type/flags 2010-08-07 18:17:56 +02:00
sun3_scsi.c block: remove wrappers for request type/flags 2010-08-07 18:17:56 +02:00
sun3_scsi.h
sun3x_esp.c
sun_esp.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
sym53c416.c
sym53c416.h
t128.c
t128.h
tmscsim.c
tmscsim.h
u14-34f.c
ultrastor.c
ultrastor.h
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd7000.c
zalon.c
zorro7xx.c