On 09/04/15 23:25, Sakari Ailus wrote: > 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@xxxxxx> > Acked-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> It's a bit sad we need to introduce the ERR_PTR() patter, nevertheless I can't see a better alternative now. I think in long term we need to get rid of v4l2_of_parse_endpoint() function. Acked-by: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html