Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

v4l: subdev: Warn if disabling streaming failed, return success

Complain in the newly added s_stream video op wrapper if disabling
streaming failed. Also return zero in this case as there's nothing the
caller can do to return the error.

This way drivers also won't need to bother with printing error messages.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

+19 -2
+15
drivers/media/v4l2-core/v4l2-subdev.c
··· 318 318 sd->ops->pad->get_mbus_config(sd, pad, config); 319 319 } 320 320 321 + static int call_s_stream(struct v4l2_subdev *sd, int enable) 322 + { 323 + int ret; 324 + 325 + ret = sd->ops->video->s_stream(sd, enable); 326 + 327 + if (!enable && ret < 0) { 328 + dev_warn(sd->dev, "disabling streaming failed (%d)\n", ret); 329 + return 0; 330 + } 331 + 332 + return ret; 333 + } 334 + 321 335 #ifdef CONFIG_MEDIA_CONTROLLER 322 336 /* 323 337 * Create state-management wrapper for pad ops dealing with subdev state. The ··· 391 377 static const struct v4l2_subdev_video_ops v4l2_subdev_call_video_wrappers = { 392 378 .g_frame_interval = call_g_frame_interval, 393 379 .s_frame_interval = call_s_frame_interval, 380 + .s_stream = call_s_stream, 394 381 }; 395 382 396 383 const struct v4l2_subdev_ops v4l2_subdev_call_wrappers = {
+4 -2
include/media/v4l2-subdev.h
··· 440 440 * @g_input_status: get input status. Same as the status field in the 441 441 * &struct v4l2_input 442 442 * 443 - * @s_stream: used to notify the driver that a video stream will start or has 444 - * stopped. 443 + * @s_stream: start (enabled == 1) or stop (enabled == 0) streaming on the 444 + * sub-device. Failure on stop will remove any resources acquired in 445 + * streaming start, while the error code is still returned by the driver. 446 + * Also see call_s_stream wrapper in v4l2-subdev.c. 445 447 * 446 448 * @g_pixelaspect: callback to return the pixelaspect ratio. 447 449 *