linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c-gpio: added support for I2C_M_STOP flag
@ 2013-06-20 12:37 Renaud Cerrato
       [not found] ` <1371731837-1476-1-git-send-email-r.cerrato-6YL8BHNr0ZqHdZQakrT3ElaPQRlvutdw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Renaud Cerrato @ 2013-06-20 12:37 UTC (permalink / raw)
  To: wsa-z923LK4zBo2bacvFa/9K2g, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Renaud Cerrato

Current i2c bit algo implementation doesn't actually support I2C_M_STOP flag despite I2C_FUNC_PROTOCOL_MANGLING functionnality.
---
 drivers/i2c/algos/i2c-algo-bit.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index fad22b0..00446a6 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -557,6 +557,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
 	for (i = 0; i < num; i++) {
 		pmsg = &msgs[i];
 		nak_ok = pmsg->flags & I2C_M_IGNORE_NAK;
+		if (pmsg->flags & I2C_M_STOP) {
+			if (i) {
+				bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
+				i2c_stop(adap);
+			}
+		}
 		if (!(pmsg->flags & I2C_M_NOSTART)) {
 			if (i) {
 				bit_dbg(3, &i2c_adap->dev, "emitting "
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c-gpio: added support for I2C_M_STOP flag
       [not found] ` <1371731837-1476-1-git-send-email-r.cerrato-6YL8BHNr0ZqHdZQakrT3ElaPQRlvutdw@public.gmane.org>
@ 2013-06-20 19:39   ` Wolfram Sang
  2013-06-24  6:37     ` Cerrato Renaud
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2013-06-20 19:39 UTC (permalink / raw)
  To: Renaud Cerrato; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

On Thu, Jun 20, 2013 at 02:37:17PM +0200, Renaud Cerrato wrote:
> Current i2c bit algo implementation doesn't actually support I2C_M_STOP flag despite I2C_FUNC_PROTOCOL_MANGLING functionnality.

Signed-Off is missing :( Please run checkpatch.pl before sending
patches!

What was your testcase?

> ---
>  drivers/i2c/algos/i2c-algo-bit.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
> index fad22b0..00446a6 100644
> --- a/drivers/i2c/algos/i2c-algo-bit.c
> +++ b/drivers/i2c/algos/i2c-algo-bit.c
> @@ -557,6 +557,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
>  	for (i = 0; i < num; i++) {
>  		pmsg = &msgs[i];
>  		nak_ok = pmsg->flags & I2C_M_IGNORE_NAK;
> +		if (pmsg->flags & I2C_M_STOP) {
> +			if (i) {

Why 'if (i)'?

> +				bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
> +				i2c_stop(adap);
> +			}
> +		}
>  		if (!(pmsg->flags & I2C_M_NOSTART)) {
>  			if (i) {
>  				bit_dbg(3, &i2c_adap->dev, "emitting "
> -- 
> 1.7.2.5
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c-gpio: added support for I2C_M_STOP flag
  2013-06-20 19:39   ` Wolfram Sang
@ 2013-06-24  6:37     ` Cerrato Renaud
  0 siblings, 0 replies; 3+ messages in thread
From: Cerrato Renaud @ 2013-06-24  6:37 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

The 'if (i)' because the STOP condition should only occur after the 
first message is transmitted (and excepted for the last message, 
because there's already a STOP outside the for loop). I thought it was 
cleaner than 'if(i < num - 1)' at the bottom of the for loop.

Sorry for the missing Signed-Off... :-/ Should I submit another patch?

On jeudi 20 juin 2013 21:39:16, Wolfram Sang wrote:
> On Thu, Jun 20, 2013 at 02:37:17PM +0200, Renaud Cerrato wrote:
>> Current i2c bit algo implementation doesn't actually support I2C_M_STOP flag despite I2C_FUNC_PROTOCOL_MANGLING functionnality.
>
> Signed-Off is missing :( Please run checkpatch.pl before sending
> patches!
>
> What was your testcase?
>
>> ---
>>  drivers/i2c/algos/i2c-algo-bit.c |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
>> index fad22b0..00446a6 100644
>> --- a/drivers/i2c/algos/i2c-algo-bit.c
>> +++ b/drivers/i2c/algos/i2c-algo-bit.c
>> @@ -557,6 +557,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
>>  	for (i = 0; i < num; i++) {
>>  		pmsg = &msgs[i];
>>  		nak_ok = pmsg->flags & I2C_M_IGNORE_NAK;
>> +		if (pmsg->flags & I2C_M_STOP) {
>> +			if (i) {
>
> Why 'if (i)'?
>
>> +				bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
>> +				i2c_stop(adap);
>> +			}
>> +		}
>>  		if (!(pmsg->flags & I2C_M_NOSTART)) {
>>  			if (i) {
>>  				bit_dbg(3, &i2c_adap->dev, "emitting "
>> --
>> 1.7.2.5
>>
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-24  6:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-20 12:37 [PATCH] i2c-gpio: added support for I2C_M_STOP flag Renaud Cerrato
     [not found] ` <1371731837-1476-1-git-send-email-r.cerrato-6YL8BHNr0ZqHdZQakrT3ElaPQRlvutdw@public.gmane.org>
2013-06-20 19:39   ` Wolfram Sang
2013-06-24  6:37     ` Cerrato Renaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).