[17/57] media: atomisp: Only set default_run_mode on first open of a stream/asd

Message ID 20230123125205.622152-18-hdegoede@redhat.com (mailing list archive)
State Accepted
Headers
Series media: atomisp: Big power-management changes + lots of fixes |

Commit Message

Hans de Goede Jan. 23, 2023, 12:51 p.m. UTC
  Calling v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode) when
the stream is already active (through another /dev/video# node) causes
the stream to stop.

Move the call to set the default run-mode so that it is only done
on the first open of one of the 4 /dev/video# nodes of one of
the 2 streams (atomisp-sub-devices / asd-s).

Fixes: 2c45e343c581 ("media: atomisp: set per-device's default mode")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/staging/media/atomisp/pci/atomisp_fops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Andy Shevchenko Jan. 23, 2023, 5:42 p.m. UTC | #1
On Mon, Jan 23, 2023 at 01:51:25PM +0100, Hans de Goede wrote:
> Calling v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode) when
> the stream is already active (through another /dev/video# node) causes
> the stream to stop.
> 
> Move the call to set the default run-mode so that it is only done
> on the first open of one of the 4 /dev/video# nodes of one of
> the 2 streams (atomisp-sub-devices / asd-s).

As mentioned before, perhaps move it closer to the beginning of the series?

Reviewed-by: Andy Shevchenko <andy@kernel.org>

> Fixes: 2c45e343c581 ("media: atomisp: set per-device's default mode")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_fops.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
> index 7f4934ff9cab..78af97a64362 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
> @@ -764,13 +764,13 @@ static int atomisp_open(struct file *file)
>  		goto done;
>  
>  	atomisp_subdev_init_struct(asd);

+ Blank line?

> +	/* Ensure that a mode is set */
> +	v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode);
>  
>  done:
>  	pipe->users++;
>  	mutex_unlock(&isp->mutex);
>  
> -	/* Ensure that a mode is set */
> -	v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode);
>  
>  	return 0;
>  
> -- 
> 2.39.0
>
  

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 7f4934ff9cab..78af97a64362 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -764,13 +764,13 @@  static int atomisp_open(struct file *file)
 		goto done;
 
 	atomisp_subdev_init_struct(asd);
+	/* Ensure that a mode is set */
+	v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode);
 
 done:
 	pipe->users++;
 	mutex_unlock(&isp->mutex);
 
-	/* Ensure that a mode is set */
-	v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode);
 
 	return 0;