1
linux/drivers/staging
Hans Verkuil 5126f2590b [media] v4l2-dev: add flag to have the core lock all file operations
This used to be the default if the lock pointer was set, but now that lock is by
default only used for ioctl serialization. Those drivers that already used
core locking have this flag set explicitly, except for some drivers where
it was obvious that there was no need to serialize any file operations other
than ioctl.

The drivers that didn't need this flag were:

drivers/media/radio/dsbr100.c
drivers/media/radio/radio-isa.c
drivers/media/radio/radio-keene.c
drivers/media/radio/radio-miropcm20.c
drivers/media/radio/radio-mr800.c
drivers/media/radio/radio-tea5764.c
drivers/media/radio/radio-timb.c
drivers/media/video/vivi.c
sound/i2c/other/tea575x-tuner.c

The other drivers that use core locking and where it was not immediately
obvious that this flag wasn't needed were changed so that the flag is set
together with a comment that that driver needs work to avoid having to
set that flag. This will often involve taking the core lock in the fops
themselves.

Eventually this flag should go and it should not be used in new drivers.

There are a few reasons why we want to avoid core locking of non-ioctl
fops: in the case of mmap this can lead to a deadlock in rare situations
since when mmap is called the mmap_sem is held and it is possible for
other parts of the code to take that lock as well (copy_from_user()/copy_to_user()
perform a down_read(&mm->mmap_sem) when a page fault occurs).

It is very unlikely that that happens since the core lock serializes all
fops, but the kernel warns about it if lock validation is turned on.

For poll it is also undesirable to take the core lock as that can introduce
increased latency. The same is true for read/write.

While it was possible to make flags or something to turn on/off taking the
core lock for each file operation, in practice it is much simpler to just
not take it at all except for ioctl and leave it to the driver to take the
lock. There are only a handful fops compared to the zillion ioctls we have.

I also wanted to make it obvious which drivers still take the lock for all
fops, so that's why I chose to have drivers set it explicitly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-05-14 09:19:38 -03:00
..
android Merge tag 'v3.4-rc3' into staging/for_v3.5 2012-04-19 09:23:28 -03:00
asus_oled Documentation: remove references to /etc/modprobe.conf 2012-03-30 16:03:15 -07:00
bcm
comedi Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
cptm1217
crystalhd Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
cxt1e1
echo
et131x Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
frontier
ft1000 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
iio staging: iio: hmc5843: Fix crash in probe function. 2012-04-12 14:34:31 -07:00
keucr USB merge for 3.4-rc1 2012-03-20 11:26:30 -07:00
line6
media [media] v4l2-dev: add flag to have the core lock all file operations 2012-05-14 09:19:38 -03:00
mei watchdog: fix set_timeout operations 2012-03-27 20:08:09 +02:00
nvec
octeon
olpc_dcon
omapdrm staging: drm/omap: move where DMM driver is registered 2012-04-10 09:19:29 -07:00
ozwpan staging: ozwpan: Added new maintainer for ozwpan 2012-04-10 09:18:59 -07:00
panel Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
phison
quatech_usb2
quickstart
ramster staging: ramster: unbreak my heart 2012-04-10 09:16:19 -07:00
rtl8187se usermodehelper: use UMH_WAIT_PROC consistently 2012-03-23 16:58:41 -07:00
rtl8192e usermodehelper: use UMH_WAIT_PROC consistently 2012-03-23 16:58:41 -07:00
rtl8192u Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
rtl8712
rts5139
rts_pstor Staging: rts_pstor: off by one in for loop 2012-04-10 09:18:59 -07:00
sbe-2t3e3 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sep staging: sep: Fix sign of error 2012-04-10 09:14:39 -07:00
serial
serqt_usb2
slicoss
sm7xx
speakup
ste_rmi4 ARM: More device tree support updates 2012-03-28 12:34:33 -07:00
telephony Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
tidspbridge Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
usbip
vme staging/vme: Fix module parameters 2012-04-10 09:14:39 -07:00
vt6655 Staging: vt6655-6: check keysize before memcpy() 2012-04-10 09:17:34 -07:00
vt6656 staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl() 2012-04-12 14:34:31 -07:00
winbond
wlags49_h2 Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
wlags49_h25
wlan-ng
xgifb staging/xgifb: fix display on XGI Volari Z11m cards 2012-04-10 09:51:49 -07:00
zcache Cleanups: rename of flush to invalidate, moving reporting of statistics 2012-03-22 19:52:47 -07:00
zram Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
zsmalloc staging: zsmalloc: fix memory leak 2012-04-10 09:18:59 -07:00
Kconfig Merge branch 'drm-nouveau-destage' of git://people.freedesktop.org/~airlied/linux 2012-03-22 13:27:02 -07:00
Makefile
staging.c