Skip to content

Commit 5013058

Browse files
Sakari Ailusrkhuangtao
authored andcommitted
FROMLIST: v4l: async: Allow async notifier register call succeed with no subdevs
The information on how many async sub-devices would be bindable to a notifier is typically dependent on information from platform firmware and it's not driver's business to be aware of that. Many V4L2 main drivers are perfectly usable (and useful) without async sub-devices and so if there aren't any around, just proceed call the notifier's complete callback immediately without registering the notifier itself. If a driver needs to check whether there are async sub-devices available, it can be done by inspecting the notifier's num_subdevs field which tells the number of async sub-devices. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> (cherry picked from commit 0104ac5b7f345fc7e8c28fabaab2a272a94daa76) https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd http://www.spinics.net/lists/linux-media/msg122688.html Signed-off-by: Marc Herbert <marc.herbert@intel.com> BUG=b:64133998 TEST=media device topology shows subdevs registered successfully TEST=no camera regression Change-Id: I07946a7022832968b60b5dc011b2df9201a723ce Reviewed-on: https://chromium-review.googlesource.com/693693 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
1 parent 60c05d9 commit 5013058

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/media/v4l2-core/v4l2-async.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,22 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
174174
struct v4l2_async_subdev *asd;
175175
int i;
176176

177-
if (!v4l2_dev || !notifier->num_subdevs ||
178-
notifier->num_subdevs > V4L2_MAX_SUBDEVS)
177+
if (!v4l2_dev || notifier->num_subdevs > V4L2_MAX_SUBDEVS)
179178
return -EINVAL;
180179

181180
notifier->v4l2_dev = v4l2_dev;
182181
INIT_LIST_HEAD(&notifier->waiting);
183182
INIT_LIST_HEAD(&notifier->done);
184183

184+
if (!notifier->num_subdevs) {
185+
int ret;
186+
187+
ret = v4l2_async_notifier_call_complete(notifier);
188+
notifier->v4l2_dev = NULL;
189+
190+
return ret;
191+
}
192+
185193
for (i = 0; i < notifier->num_subdevs; i++) {
186194
asd = notifier->subdevs[i];
187195

0 commit comments

Comments
 (0)