Skip to content
  • Sakari Ailus's avatar
    [media] v4l: of: Parse variable length properties --- link-frequencies · 698da18e
    Sakari Ailus authored
    
    
    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: default avatarSakari Ailus <sakari.ailus@iki.fi>
    Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Acked-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
    Tested-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
    698da18e