[3/3] media: subdev: Add debug prints to enable/disable_streams

Message ID 20230619112707.239565-3-tomi.valkeinen@ideasonboard.com
State New
Headers
Series [1/3] media: subdev: Drop implicit zeroing of stream field |

Commit Message

Tomi Valkeinen June 19, 2023, 11:27 a.m. UTC
  It is often useful to see when streaming for a device is being enabled
or disabled. Add debug prints for this to v4l2_subdev_enable_streams()
and v4l2_subdev_disable_streams().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
  

Comments

Jacopo Mondi July 17, 2023, 2:18 p.m. UTC | #1
Hi Tomi

On Mon, Jun 19, 2023 at 02:27:07PM +0300, Tomi Valkeinen wrote:
> It is often useful to see when streaming for a device is being enabled
> or disabled. Add debug prints for this to v4l2_subdev_enable_streams()
> and v4l2_subdev_disable_streams().
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  drivers/media/v4l2-core/v4l2-subdev.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 73f716a42569..0f86a165b202 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -1977,11 +1977,16 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
>  		goto done;
>  	}
>
> +	dev_dbg(dev, "enable streams %u:%#llx\n", pad, streams_mask);

With the use of the # incantation clarified offline:

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>


> +
>  	/* Call the .enable_streams() operation. */
>  	ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad,
>  			       streams_mask);
> -	if (ret)
> +	if (ret) {
> +		dev_dbg(dev, "enable streams %u:%#llx failed: %d\n", pad,
> +			streams_mask, ret);
>  		goto done;
> +	}
>
>  	/* Mark the streams as enabled. */
>  	for (i = 0; i < state->stream_configs.num_configs; ++i) {
> @@ -2089,11 +2094,16 @@ int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad,
>  		goto done;
>  	}
>
> +	dev_dbg(dev, "disable streams %u:%#llx\n", pad, streams_mask);
> +
>  	/* Call the .disable_streams() operation. */
>  	ret = v4l2_subdev_call(sd, pad, disable_streams, state, pad,
>  			       streams_mask);
> -	if (ret)
> +	if (ret) {
> +		dev_dbg(dev, "disable streams %u:%#llx failed: %d\n", pad,
> +			streams_mask, ret);
>  		goto done;
> +	}
>
>  	/* Mark the streams as disabled. */
>  	for (i = 0; i < state->stream_configs.num_configs; ++i) {
> --
> 2.34.1
>
  

Patch

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 73f716a42569..0f86a165b202 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1977,11 +1977,16 @@  int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
 		goto done;
 	}
 
+	dev_dbg(dev, "enable streams %u:%#llx\n", pad, streams_mask);
+
 	/* Call the .enable_streams() operation. */
 	ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad,
 			       streams_mask);
-	if (ret)
+	if (ret) {
+		dev_dbg(dev, "enable streams %u:%#llx failed: %d\n", pad,
+			streams_mask, ret);
 		goto done;
+	}
 
 	/* Mark the streams as enabled. */
 	for (i = 0; i < state->stream_configs.num_configs; ++i) {
@@ -2089,11 +2094,16 @@  int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad,
 		goto done;
 	}
 
+	dev_dbg(dev, "disable streams %u:%#llx\n", pad, streams_mask);
+
 	/* Call the .disable_streams() operation. */
 	ret = v4l2_subdev_call(sd, pad, disable_streams, state, pad,
 			       streams_mask);
-	if (ret)
+	if (ret) {
+		dev_dbg(dev, "disable streams %u:%#llx failed: %d\n", pad,
+			streams_mask, ret);
 		goto done;
+	}
 
 	/* Mark the streams as disabled. */
 	for (i = 0; i < state->stream_configs.num_configs; ++i) {