[media] v4l: of: Parse variable length properties --- link-frequencies
authorSakari Ailus <sakari.ailus@iki.fi>
Sun, 22 Mar 2015 20:48:26 +0000 (17:48 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 27 Apr 2015 19:04:28 +0000 (16:04 -0300)
commit698da18e082c8fdfa675bee6338e3f9864d5d7ee
tree36400cabe4da4f3c47b8588e81cf6797f3197d0e
parent161aadaec11cd0f610950da56f82bd1778be4156
[media] v4l: of: Parse variable length properties --- link-frequencies

The link-frequencies property is a variable length array of link frequencies
in an endpoint. The array is needed by an increasing number of drivers, so
it makes sense to add it to struct v4l2_of_endpoint.

However, the length of the array is variable and the size of struct
v4l2_of_endpoint is fixed since it is allocated by the caller. The options
here are

1. to define a fixed maximum limit of link frequencies that has to be the
global maximum of all boards. This is seen as problematic since the maximum
could be largish, and everyone hitting the problem would need to submit a
patch to fix it, or

2. parse the property in every driver. This doesn't sound appealing as two
of the three implementations submitted to linux-media were wrong, and one of
them was even merged before this was noticed, or

3. change the interface so that allocating and releasing memory according to
the size of the array is possible. This is what the patch does.

v4l2_of_alloc_parse_endpoint() is just like v4l2_of_parse_endpoint(), but it
will allocate the memory resources needed to store struct v4l2_of_endpoint
and the additional arrays pointed to by this struct. A corresponding release
function v4l2_of_free_endpoint() is provided to release the memory allocated
by v4l2_of_alloc_parse_endpoint().

In addition to this, the link-frequencies property is parsed as well, and
the result is stored to struct v4l2_of_endpoint field link_frequencies.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/v4l2-of.c
include/media/v4l2-of.h
This page took 0.045143 seconds and 5 git commands to generate.