]> git.baikalelectronics.ru Git - kernel.git/commit
[media] media-device: map new functions into old types for legacy API
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Sat, 5 Mar 2016 10:13:39 +0000 (07:13 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 10 Mar 2016 18:10:59 +0000 (15:10 -0300)
commitc5d8f0eede69c22569127cae9f1716f20d8e288d
tree9464dd1d85ef2fb0bcb958d7043fc4ec0d593029
parent5390ee2e48d944b6da9b18c64b51b281619b36ca
[media] media-device: map new functions into old types for legacy API

The legacy media controller userspace API exposes entity types that
carry both type and function information. The new API replaces the type
with a function. It preserves backward compatibility by defining legacy
functions for the existing types and using them in drivers.

This works fine, as long as newer entity functions won't be added.

Unfortunately, some tools, like media-ctl with --print-dot argument
rely on the now legacy MEDIA_ENT_T_V4L2_SUBDEV and MEDIA_ENT_T_DEVNODE
numeric ranges to identify what entities will be shown.

Also, if the entity doesn't match those ranges, it will ignore the
major/minor information on devnodes, and won't be getting the devnode
name via udev or sysfs.

As we're now adding devices outside the old range, the legacy ioctl
needs to map the new entity functions into a type at the old range,
or otherwise we'll have a regression.

Detected on all released media-ctl versions (e. g. versions <= 1.10).

Fix this by deriving the type from the function to emulate the legacy
API if the function isn't in the legacy functions range.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-device.c
include/uapi/linux/media.h