• Steve Longerbeam's avatar
    media: v4l2: async: Add v4l2_async_notifier_add_subdev · b47d7ff1
    Steve Longerbeam authored
    v4l2_async_notifier_add_subdev() adds an asd to the notifier. It checks
    that no other equivalent asd's have already been added to this notifier's
    asd list, or to other registered notifier's waiting or done lists, and
    increments num_subdevs.
    
    v4l2_async_notifier_add_subdev() does not make use of the notifier subdevs
    array, otherwise it would have to re-allocate the array every time the
    function was called. In place of the subdevs array, the function adds
    the newly allocated asd to a new master asd_list. The function will
    return error with a WARN() if it is ever called with the subdevs array
    allocated.
    
    Drivers are now required to call a v4l2_async_notifier_init(), before the
    first call to v4l2_async_notifier_add_subdev(), in order to initialize
    the asd_list.
    
    In v4l2_async_notifier_has_async_subdev(), __v4l2_async_notifier_register(),
    and v4l2_async_notifier_cleanup(), maintain backward compatibility with
    the subdevs array, by alternatively operate on the subdevs array or a
    non-empty notifier->asd_list.
    Signed-off-by: default avatarSteve Longerbeam <slongerbeam@gmail.com>
    Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
    b47d7ff1
v4l2-async.c 16.7 KB