summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core/v4l2-dev.c
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2013-12-03 10:14:29 -0300
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:54:33 +0900
commitb7882f50bdbb5b0178d7cb715d0e9b62a024d6ed (patch)
treed3702556f5cddad590d3ccf08f8bebfb52a25ff4 /drivers/media/v4l2-core/v4l2-dev.c
parenta63e7d765e0985583c63b82fa749b27544b90347 (diff)
downloadlinux-3.10-b7882f50bdbb5b0178d7cb715d0e9b62a024d6ed.tar.gz
linux-3.10-b7882f50bdbb5b0178d7cb715d0e9b62a024d6ed.tar.bz2
linux-3.10-b7882f50bdbb5b0178d7cb715d0e9b62a024d6ed.zip
upstream: [media] media: v4l2-dev: fix video device index assignment
The side effect of commit 1056e4388b045 ("v4l2-dev: Fix race condition on __video_register_device") is the increased number of index value assigned on video_device registration. Before that commit video_devices were numbered from 0, after it, the indexes starts from 1, because get_index() always count the device, which is being registered. Some device drivers rely on video_device index number for internal purposes, i.e. s5p-mfc driver stopped working after that patch. This patch restores the old method of numbering the video_device indexes. Cc: stable@vger.kernel.org # for v3.12 Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Ricardo Ribalda <ricardo.ribalda@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-dev.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index fd1e89ef2db..ec26e84123d 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -869,8 +869,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
/* Should not happen since we thought this minor was free */
WARN_ON(video_device[vdev->minor] != NULL);
- video_device[vdev->minor] = vdev;
vdev->index = get_index(vdev);
+ video_device[vdev->minor] = vdev;
mutex_unlock(&videodev_lock);
if (vdev->ioctl_ops)