[PATCH v2 09/60] i2c: cp2615: reword according to newest specification

Wolfram Sang posted 60 patches 2 months, 2 weeks ago
[PATCH v2 09/60] i2c: cp2615: reword according to newest specification
Posted by Wolfram Sang 2 months, 2 weeks ago
Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2
specifications and replace "master/slave" with more appropriate terms.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-cp2615.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c
index cf3747d87034..315a37155401 100644
--- a/drivers/i2c/busses/i2c-cp2615.c
+++ b/drivers/i2c/busses/i2c-cp2615.c
@@ -60,7 +60,7 @@ enum cp2615_i2c_status {
 	CP2615_CFG_LOCKED = -6,
 	/* read_len or write_len out of range */
 	CP2615_INVALID_PARAM = -4,
-	/* I2C slave did not ACK in time */
+	/* I2C target did not ACK in time */
 	CP2615_TIMEOUT,
 	/* I2C bus busy */
 	CP2615_BUS_BUSY,
@@ -211,7 +211,7 @@ static int cp2615_check_iop(struct usb_interface *usbif)
 }
 
 static int
-cp2615_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+cp2615_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 {
 	struct usb_interface *usbif = adap->algo_data;
 	int i = 0, ret = 0;
@@ -250,8 +250,8 @@ cp2615_i2c_func(struct i2c_adapter *adap)
 }
 
 static const struct i2c_algorithm cp2615_i2c_algo = {
-	.master_xfer	= cp2615_i2c_master_xfer,
-	.functionality	= cp2615_i2c_func,
+	.xfer = cp2615_i2c_xfer,
+	.functionality = cp2615_i2c_func,
 };
 
 /*
-- 
2.43.0
Re: [PATCH v2 09/60] i2c: cp2615: reword according to newest specification
Posted by Bence Csókás 2 months, 2 weeks ago
Hi!

On 2024. 07. 06. 13:20, Wolfram Sang wrote:
> Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2
> specifications and replace "master/slave" with more appropriate terms.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>   drivers/i2c/busses/i2c-cp2615.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c
> index cf3747d87034..315a37155401 100644
> --- a/drivers/i2c/busses/i2c-cp2615.c
> +++ b/drivers/i2c/busses/i2c-cp2615.c
> @@ -60,7 +60,7 @@ enum cp2615_i2c_status {
>   	CP2615_CFG_LOCKED = -6,
>   	/* read_len or write_len out of range */
>   	CP2615_INVALID_PARAM = -4,
> -	/* I2C slave did not ACK in time */
> +	/* I2C target did not ACK in time */
>   	CP2615_TIMEOUT,
>   	/* I2C bus busy */
>   	CP2615_BUS_BUSY,

The diff is cut short, but here would be the comment for the next enum 
element, CP2615_BUS_ERROR, which reads:
 > /* I2C bus error (ie. device NAK'd the request) */
If you're going for consistency, you might want to edit that as well.

> @@ -211,7 +211,7 @@ static int cp2615_check_iop(struct usb_interface *usbif)
>   }
>   
>   static int
> -cp2615_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
> +cp2615_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
>   {
>   	struct usb_interface *usbif = adap->algo_data;
>   	int i = 0, ret = 0;
> @@ -250,8 +250,8 @@ cp2615_i2c_func(struct i2c_adapter *adap)
>   }
>   
>   static const struct i2c_algorithm cp2615_i2c_algo = {
> -	.master_xfer	= cp2615_i2c_master_xfer,
> -	.functionality	= cp2615_i2c_func,
> +	.xfer = cp2615_i2c_xfer,
> +	.functionality = cp2615_i2c_func,
>   };
>   
>   /*

I don't understand the need for the whitespace changes.

Anyways, these are just minor things I could live with.

Reviewed-by: Bence Csókás <bence98@sch.bme.hu>

Bence
Re: [PATCH v2 09/60] i2c: cp2615: reword according to newest specification
Posted by Wolfram Sang 2 months, 2 weeks ago
Hi Bence,

> The diff is cut short, but here would be the comment for the next enum
> element, CP2615_BUS_ERROR, which reads:
> > /* I2C bus error (ie. device NAK'd the request) */
> If you're going for consistency, you might want to edit that as well.

You mean "target NAK'd"? Yes, can do this.

> > -	.master_xfer	= cp2615_i2c_master_xfer,
> > -	.functionality	= cp2615_i2c_func,
> > +	.xfer = cp2615_i2c_xfer,
> > +	.functionality = cp2615_i2c_func,
> >   };
> >   /*
> 
> I don't understand the need for the whitespace changes.

If you have only one space in such struct initializations, you can
change later only the line you are interested in. If you have aligned
them with tabs, you sometimes change one line and need to realign the
whole block. This is annoying and spoils history a little.

> Reviewed-by: Bence Csókás <bence98@sch.bme.hu>

Thanks!

   Wolfram

Re: [PATCH v2 09/60] i2c: cp2615: reword according to newest specification
Posted by Andi Shyti 2 months, 1 week ago
Hi,

> > > -	.master_xfer	= cp2615_i2c_master_xfer,
> > > -	.functionality	= cp2615_i2c_func,
> > > +	.xfer = cp2615_i2c_xfer,
> > > +	.functionality = cp2615_i2c_func,
> > >   };
> > >   /*
> > 
> > I don't understand the need for the whitespace changes.
> 
> If you have only one space in such struct initializations, you can
> change later only the line you are interested in. If you have aligned
> them with tabs, you sometimes change one line and need to realign the
> whole block. This is annoying and spoils history a little.

TBH looks also better. For just to fields in the struct I don't
see it necessary to put the elements in columns.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Andi
[PATCH v3] i2c: cp2615: reword according to newest specification
Posted by Wolfram Sang 2 months, 1 week ago
Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2
specifications and replace "master/slave" with more appropriate terms.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Change since v2:
* reworded comment about NAK for consistency as well (Thanks, Bence!)

 drivers/i2c/busses/i2c-cp2615.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c
index cf3747d87034..e7720ea4045e 100644
--- a/drivers/i2c/busses/i2c-cp2615.c
+++ b/drivers/i2c/busses/i2c-cp2615.c
@@ -60,11 +60,11 @@ enum cp2615_i2c_status {
 	CP2615_CFG_LOCKED = -6,
 	/* read_len or write_len out of range */
 	CP2615_INVALID_PARAM = -4,
-	/* I2C slave did not ACK in time */
+	/* I2C target did not ACK in time */
 	CP2615_TIMEOUT,
 	/* I2C bus busy */
 	CP2615_BUS_BUSY,
-	/* I2C bus error (ie. device NAK'd the request) */
+	/* I2C bus error (ie. target NAK'd the request) */
 	CP2615_BUS_ERROR,
 	CP2615_SUCCESS
 };
@@ -211,7 +211,7 @@ static int cp2615_check_iop(struct usb_interface *usbif)
 }
 
 static int
-cp2615_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+cp2615_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 {
 	struct usb_interface *usbif = adap->algo_data;
 	int i = 0, ret = 0;
@@ -250,8 +250,8 @@ cp2615_i2c_func(struct i2c_adapter *adap)
 }
 
 static const struct i2c_algorithm cp2615_i2c_algo = {
-	.master_xfer	= cp2615_i2c_master_xfer,
-	.functionality	= cp2615_i2c_func,
+	.xfer = cp2615_i2c_xfer,
+	.functionality = cp2615_i2c_func,
 };
 
 /*
-- 
2.43.0
Re:
Posted by Bence Csókás 2 months, 1 week ago
Hi!

On 1970. 01. 01. 1:00, Wolfram Sang wrote:
> Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2
> specifications and replace "master/slave" with more appropriate terms.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Change since v2:
> * reworded comment about NAK for consistency as well (Thanks, Bence!)
> 
>   drivers/i2c/busses/i2c-cp2615.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)

Acked-by: Bence Csókás <bence98@sch.bme.hu>

Bence