[PATCH 3/6] mei: vsc: Enhance SPI transfer of IVSC rom

Wentong Wu posted 6 patches 1 year, 5 months ago
There is a newer version of this series
[PATCH 3/6] mei: vsc: Enhance SPI transfer of IVSC rom
Posted by Wentong Wu 1 year, 5 months ago
Constructing the SPI transfer command as per the specific request.

Fixes: 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc: stable@vger.kernel.org # for 6.8+
Signed-off-by: Wentong Wu <wentong.wu@intel.com>
Tested-by: Jason Chen <jason.z.chen@intel.com>
---
 drivers/misc/mei/vsc-tp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c
index 4595b1a25536..7a89e4e5d553 100644
--- a/drivers/misc/mei/vsc-tp.c
+++ b/drivers/misc/mei/vsc-tp.c
@@ -331,7 +331,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
 		return ret;
 	}
 
-	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, tp->rx_buf, len);
+	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, ibuf ? tp->rx_buf : ibuf, len);
 	if (ret)
 		return ret;
 
-- 
2.34.1
Re: [PATCH 3/6] mei: vsc: Enhance SPI transfer of IVSC rom
Posted by Sakari Ailus 1 year, 5 months ago
Hi Wentong,

On Sun, Jun 23, 2024 at 05:30:53PM +0800, Wentong Wu wrote:
> Constructing the SPI transfer command as per the specific request.
> 
> Fixes: 566f5ca97680 ("mei: Add transport driver for IVSC device")
> Cc: stable@vger.kernel.org # for 6.8+
> Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> Tested-by: Jason Chen <jason.z.chen@intel.com>
> ---
>  drivers/misc/mei/vsc-tp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c
> index 4595b1a25536..7a89e4e5d553 100644
> --- a/drivers/misc/mei/vsc-tp.c
> +++ b/drivers/misc/mei/vsc-tp.c
> @@ -331,7 +331,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
>  		return ret;
>  	}
>  
> -	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, tp->rx_buf, len);
> +	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, ibuf ? tp->rx_buf : ibuf, len);

Is this correct? I.e. use ibuf when it's NULL, otherwise use tp->rx_buf?

>  	if (ret)
>  		return ret;
>  

-- 
Kind regards,

Sakari Ailus
RE: [PATCH 3/6] mei: vsc: Enhance SPI transfer of IVSC rom
Posted by Wu, Wentong 1 year, 5 months ago
> From: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Hi Wentong,
> 
> On Sun, Jun 23, 2024 at 05:30:53PM +0800, Wentong Wu wrote:
> > Constructing the SPI transfer command as per the specific request.
> >
> > Fixes: 566f5ca97680 ("mei: Add transport driver for IVSC device")
> > Cc: stable@vger.kernel.org # for 6.8+
> > Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> > Tested-by: Jason Chen <jason.z.chen@intel.com>
> > ---
> >  drivers/misc/mei/vsc-tp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c
> > index 4595b1a25536..7a89e4e5d553 100644
> > --- a/drivers/misc/mei/vsc-tp.c
> > +++ b/drivers/misc/mei/vsc-tp.c
> > @@ -331,7 +331,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void
> *obuf, void *ibuf, size_t len)
> >  		return ret;
> >  	}
> >
> > -	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, tp->rx_buf, len);
> > +	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, ibuf ? tp->rx_buf : ibuf,
> > +len);
> 
> Is this correct? I.e. use ibuf when it's NULL, otherwise use tp->rx_buf?

Yes, the SPI framework will adjust this. If ibuf is NULL, but we give tp->rx_buf,
the actual transfer will tx more data than needed.

BR,
Wentong
> 
> >  	if (ret)
> >  		return ret;
> >
> 
> --
> Kind regards,
> 
> Sakari Ailus