media: media: v4l2-dev: fix video device index assignment
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 3 Dec 2013 13:14:29 +0000 (10:14 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Feb 2014 21:50:19 +0000 (13:50 -0800)
commitd7a0fbadd815376fb4a75a3de51acbc22f305468
tree05e5674413c3f8ab88bc0f1a07fd873d0e31d038
parentb9627a5dd610c6d5f55f15dd7c4296e175485e7a
media: media: v4l2-dev: fix video device index assignment

commit 6c3df5da67f1f53df78c7e20cd53a481dc28eade upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-dev.c