[1/3] media: ivsc: csi: don't count privacy on as error

Message ID 20240603082614.1567712-2-wentong.wu@intel.com (mailing list archive)
State New
Headers
Series Fix privacy issue for MEI CSI |

Commit Message

Wu, Wentong June 3, 2024, 8:26 a.m. UTC
  Prior to the ongoing command privacy is on, it would return -1 to
indicate the current privacy status, and the ongoing command would
be well executed by firmware as well, so this is not error. This
patch changes its behavior to notify privacy on directly by V4L2
privacy control instead of reporting error.

Fixes: 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule")
Reported-by: Hao Yao <hao.yao@intel.com>
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Tested-by: Jason Chen <jason.z.chen@intel.com>
---
 drivers/media/pci/intel/ivsc/mei_csi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Sakari Ailus June 7, 2024, 12:45 p.m. UTC | #1
Hi Wentong,

On Mon, Jun 03, 2024 at 04:26:12PM +0800, Wentong Wu wrote:
> Prior to the ongoing command privacy is on, it would return -1 to
> indicate the current privacy status, and the ongoing command would
> be well executed by firmware as well, so this is not error. This
> patch changes its behavior to notify privacy on directly by V4L2
> privacy control instead of reporting error.
> 
> Fixes: 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule")
> Reported-by: Hao Yao <hao.yao@intel.com>
> Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> Tested-by: Jason Chen <jason.z.chen@intel.com>
> ---
>  drivers/media/pci/intel/ivsc/mei_csi.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c
> index 89b582a221ab..004ebab0b814 100644
> --- a/drivers/media/pci/intel/ivsc/mei_csi.c
> +++ b/drivers/media/pci/intel/ivsc/mei_csi.c
> @@ -190,7 +190,11 @@ static int mei_csi_send(struct mei_csi *csi, u8 *buf, size_t len)
>  
>  	/* command response status */
>  	ret = csi->cmd_response.status;
> -	if (ret) {
> +	if (ret == -1) {
> +		/* notify privacy on instead of reporting error */
> +		ret = 0;
> +		v4l2_ctrl_s_ctrl(csi->privacy_ctrl, CSI_PRIVACY_ON);

s/CSI_PRIVACY_ON/1/

> +	} else if (ret) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
  
Wu, Wentong June 7, 2024, 12:55 p.m. UTC | #2
> From: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Hi Wentong,
> 
> On Mon, Jun 03, 2024 at 04:26:12PM +0800, Wentong Wu wrote:
> > Prior to the ongoing command privacy is on, it would return -1 to
> > indicate the current privacy status, and the ongoing command would be
> > well executed by firmware as well, so this is not error. This patch
> > changes its behavior to notify privacy on directly by V4L2 privacy
> > control instead of reporting error.
> >
> > Fixes: 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule")
> > Reported-by: Hao Yao <hao.yao@intel.com>
> > Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> > Tested-by: Jason Chen <jason.z.chen@intel.com>
> > ---
> >  drivers/media/pci/intel/ivsc/mei_csi.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c
> > b/drivers/media/pci/intel/ivsc/mei_csi.c
> > index 89b582a221ab..004ebab0b814 100644
> > --- a/drivers/media/pci/intel/ivsc/mei_csi.c
> > +++ b/drivers/media/pci/intel/ivsc/mei_csi.c
> > @@ -190,7 +190,11 @@ static int mei_csi_send(struct mei_csi *csi, u8
> > *buf, size_t len)
> >
> >  	/* command response status */
> >  	ret = csi->cmd_response.status;
> > -	if (ret) {
> > +	if (ret == -1) {
> > +		/* notify privacy on instead of reporting error */
> > +		ret = 0;
> > +		v4l2_ctrl_s_ctrl(csi->privacy_ctrl, CSI_PRIVACY_ON);
> 
> s/CSI_PRIVACY_ON/1/

Ack, thanks

BR,
Wentong
> 
> > +	} else if (ret) {
> >  		ret = -EINVAL;
> >  		goto out;
> >  	}
> 
> --
> Kind regards,
> 
> Sakari Ailus
  

Patch

diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c
index 89b582a221ab..004ebab0b814 100644
--- a/drivers/media/pci/intel/ivsc/mei_csi.c
+++ b/drivers/media/pci/intel/ivsc/mei_csi.c
@@ -190,7 +190,11 @@  static int mei_csi_send(struct mei_csi *csi, u8 *buf, size_t len)
 
 	/* command response status */
 	ret = csi->cmd_response.status;
-	if (ret) {
+	if (ret == -1) {
+		/* notify privacy on instead of reporting error */
+		ret = 0;
+		v4l2_ctrl_s_ctrl(csi->privacy_ctrl, CSI_PRIVACY_ON);
+	} else if (ret) {
 		ret = -EINVAL;
 		goto out;
 	}