linux/include/media
Mauro Carvalho Chehab e2c91d4d78 [media] media-device: get rid of the spinlock
Right now, the lock schema for media_device struct is messy,
since sometimes, it is protected via a spin lock, while, for
media graph traversal, it is protected by a mutex.

Solve this conflict by always using a mutex.

As a side effect, this prevents a bug when the media notifiers
is called at atomic context, while running the notifier callback:

 BUG: sleeping function called from invalid context at mm/slub.c:1289
 in_atomic(): 1, irqs_disabled(): 0, pid: 3479, name: modprobe
 4 locks held by modprobe/3479:
 #0:  (&dev->mutex){......}, at: [<ffffffff81ce8933>] __driver_attach+0xa3/0x160
 #1:  (&dev->mutex){......}, at: [<ffffffff81ce8941>] __driver_attach+0xb1/0x160
 #2:  (register_mutex#5){+.+.+.}, at: [<ffffffffa10596c7>] usb_audio_probe+0x257/0x1c90 [snd_usb_audio]
 #3:  (&(&mdev->lock)->rlock){+.+.+.}, at: [<ffffffffa0e6051b>] media_device_register_entity+0x1cb/0x700 [media]
 CPU: 2 PID: 3479 Comm: modprobe Not tainted 4.5.0-rc3+ #49
 Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
 0000000000000000 ffff8803b3f6f288 ffffffff81933901 ffff8803c4bae000
 ffff8803c4bae5c8 ffff8803b3f6f2b0 ffffffff811c6af5 ffff8803c4bae000
 ffffffff8285d7f6 0000000000000509 ffff8803b3f6f2f0 ffffffff811c6ce5
 Call Trace:
 [<ffffffff81933901>] dump_stack+0x85/0xc4
 [<ffffffff811c6af5>] ___might_sleep+0x245/0x3a0
 [<ffffffff811c6ce5>] __might_sleep+0x95/0x1a0
 [<ffffffff8155aade>] kmem_cache_alloc_trace+0x20e/0x300
 [<ffffffffa0e66e3d>] ? media_add_link+0x4d/0x140 [media]
 [<ffffffffa0e66e3d>] media_add_link+0x4d/0x140 [media]
 [<ffffffffa0e69931>] media_create_pad_link+0xa1/0x600 [media]
 [<ffffffffa0fe11b3>] au0828_media_graph_notify+0x173/0x360 [au0828]
 [<ffffffffa0e68a6a>] ? media_gobj_create+0x1ba/0x480 [media]
 [<ffffffffa0e606fb>] media_device_register_entity+0x3ab/0x700 [media]

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-20 13:12:02 -03:00
..
blackfin [media] v4l2: blackfin: select proper pinctrl state in ppi_set_params if CONFIG_PINCTRL is enabled 2014-07-26 17:15:16 -03:00
davinci [media] media: videobuf2: Restructure vb2_buffer 2015-10-01 09:04:43 -03:00
drv-intf [media] media, sound: tea575x: constify snd_tea575x_ops structures 2015-12-03 11:26:45 -02:00
i2c [media] tvp5150: move input definition header to dt-bindings 2016-02-11 11:10:59 -02:00
i2c-addr.h
lirc_dev.h [media] lirc_dev.h: Make checkpatch happy 2015-10-05 13:50:42 -03:00
lirc.h [media] bz#75751: Move internal header file lirc.h to uapi/ 2015-11-17 06:47:43 -02:00
media-device.h [media] media-device: get rid of the spinlock 2016-04-20 13:12:02 -03:00
media-devnode.h [media] media-devnode.h: document the remaining struct/functions 2016-01-11 12:19:13 -02:00
media-entity.h [media] media: Rename is_media_entity_v4l2_io to is_media_entity_v4l2_video_device 2016-04-13 17:20:48 -03:00
rc-core.h [media] rc-core: allow calling rc_open with device not initialized 2016-03-03 06:16:14 -03:00
rc-map.h [media] media: rc: improve RC_BIT_ constant definition 2015-11-19 11:39:58 -02:00
soc_camera.h [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2 2015-10-01 08:48:18 -03:00
tuner-types.h [media] DocBook: add documentation for tuner-types.h 2015-10-05 11:37:15 -03:00
tuner.h [media] v4l2-mc.h: move tuner PAD definitions to this new header 2016-02-01 07:19:44 -02:00
tveeprom.h [media] DocBook: Document tveeprom.h 2015-10-05 13:49:02 -03:00
v4l2-async.h [media] Docbook: Fix comments at v4l2-async.h 2015-08-22 05:17:27 -03:00
v4l2-clk.h [media] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE 2015-11-17 15:19:11 -02:00
v4l2-common.h [media] v4l2-common: move v4l2_ctrl_check to cx2341x 2014-11-25 08:25:36 -02:00
v4l2-ctrls.h [media] v4l2-ctrls: remove unclaimed v4l2_ctrl_add_ctrl() interface 2016-02-10 09:34:00 -02:00
v4l2-dev.h [media] v4l2: add device_caps to struct video_device 2016-04-13 16:40:29 -03:00
v4l2-device.h [media] v4l2-core: remove the old .ioctl BKL replacement 2015-03-02 17:06:56 -03:00
v4l2-dv-timings.h [media] v4l2-dv-timings: add new arg to v4l2_match_dv_timings 2015-12-03 11:26:14 -02:00
v4l2-event.h [media] v4l2-event.h: fix comments and add to DocBook 2015-08-22 09:05:52 -03:00
v4l2-fh.h [media] V4L: Add mem2mem ioctl and file operation helpers 2013-12-04 15:34:24 -02:00
v4l2-flash-led-class.h [media] Docbook: fix comments at v4l2-flash-led-class.h 2015-08-22 05:28:44 -03:00
v4l2-image-sizes.h [media] media: v4l2-image-sizes.h: correct the SVGA height definition 2014-12-04 13:56:56 -02:00
v4l2-ioctl.h [media] v4l2: add support for SDR transmitter 2015-10-20 15:40:50 -02:00
v4l2-mc.h [media] v4l2-mc.h: fix yet more compiler errors 2016-03-04 07:56:43 -03:00
v4l2-mediabus.h [media] v4l2-mediabus: Add to DocBook 2015-08-22 09:05:55 -03:00
v4l2-mem2mem.h [media] media: videobuf2: Restructure vb2_buffer 2015-10-01 09:04:43 -03:00
v4l2-of.h [media] v4l2-of: fix compiler errors if CONFIG_OF is undefined 2015-04-28 08:33:45 -03:00
v4l2-subdev.h [media] v4l: subdev: Add pad config allocator and init 2016-04-13 17:23:37 -03:00
videobuf2-core.h [media] vb2: fix nasty vb2_thread regression 2016-02-04 09:13:46 -02:00
videobuf2-dma-contig.h ARM: 8508/2: videobuf2-dc: Let drivers specify DMA attrs 2016-02-11 15:33:38 +00:00
videobuf2-dma-sg.h [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2 2015-10-01 08:48:18 -03:00
videobuf2-dvb.h [media] add media controller support to videobuf2-dvb 2016-02-10 07:23:41 -02:00
videobuf2-memops.h [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2 2015-10-01 08:48:18 -03:00
videobuf2-v4l2.h [media] media: videobuf2: Move vb2_fileio_data and vb2_thread to core part 2015-12-18 13:58:09 -02:00
videobuf2-vmalloc.h [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2 2015-10-01 08:48:18 -03:00
videobuf-core.h treewide: fix typos in comment blocks 2015-08-07 14:46:24 +02:00
videobuf-dma-contig.h [media] videobuf-dma-contig: remove support for cached mem 2013-04-25 09:50:19 -03:00
videobuf-dma-sg.h [media] videobuf: make unused exported functions static 2015-01-27 10:01:33 -02:00
videobuf-dvb.h [media] media: remove emacs editor variables 2014-12-22 17:52:20 -02:00
videobuf-vmalloc.h V4L/DVB: videobuf: add ext_lock argument to the queue init functions 2010-10-21 01:06:14 -02:00
vsp1.h [media] v4l: vsp1: Add global alpha support for DRM pipeline 2016-04-13 19:15:23 -03:00