linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c-davinci: Handle signals gracefully
@ 2014-01-09 11:11 Mike Looijmans
       [not found] ` <1389265885-26777-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Looijmans @ 2014-01-09 11:11 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	wsa-z923LK4zBo2bacvFa/9K2g,
	khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mike Looijmans

When a signal is caught while the i2c-davinci bus driver is transferring,
the drive just "abandons" the transfer and leaves the controller to fend
for itself. The next I2C transaction will find the controller in an
undefined state and often results in a stream of "initiating i2c bus recovery"
messages until the controller arrives in a defined state. This behaviour
also sends out "half" or possibly even mixed messages to I2C client
devices which may put them in an undesired state as well.

This patch fixes this issue by always attempting to finish the current
transaction, and then check on a pending signal. It either reports
success if all data has been transferred, or it returns failure when
the transaction was aborted. This keeps the controller in a defined
state, and is also much friendlier towards client devices, because
it will only send complete messages.

Before this patch, reading an I2C device in a loop and interrupting it
often resulted in a "initiating i2c bus recovery" storm and not being
able to communicate via I2C for several seconds. With this patch, the
userspace call simply returns EINTR and the next I2C transaction
succeeds without errors.

Signed-off-by: Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org>
---
 drivers/i2c/busses/i2c-davinci.c |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 132369f..102673b 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -372,9 +372,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
 		flag |= DAVINCI_I2C_MDR_STP;
 	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
 
-	r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
+	r = wait_for_completion_timeout(&dev->cmd_complete,
 						      dev->adapter.timeout);
-	if (r == 0) {
+	if (unlikely(r == 0)) {
 		dev_err(dev->dev, "controller timed out\n");
 		davinci_i2c_recover_bus(dev);
 		i2c_davinci_init(dev);
@@ -384,7 +384,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
 	if (dev->buf_len) {
 		/* This should be 0 if all bytes were transferred
 		 * or dev->cmd_err denotes an error.
-		 * A signal may have aborted the transfer.
 		 */
 		if (r >= 0) {
 			dev_err(dev->dev, "abnormal termination buf_len=%i\n",
@@ -436,22 +435,30 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	ret = i2c_davinci_wait_bus_not_busy(dev, 1);
 	if (ret < 0) {
 		dev_warn(dev->dev, "timeout waiting for bus ready\n");
-		return ret;
+		goto error;
 	}
 
 	for (i = 0; i < num; i++) {
+		if (signal_pending(current)) {
+			dev_dbg(dev->dev, "%s [%d/%d] %#x ERESTARTSYS\n",
+					__func__, i + 1, num, msgs[i].addr);
+			ret = -ERESTARTSYS;
+			goto error;
+		}
 		ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
-		dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
-			ret);
+		dev_dbg(dev->dev, "%s [%d/%d] %#x ret: %d\n", __func__, i + 1,
+				num, msgs[i].addr, ret);
 		if (ret < 0)
-			return ret;
+			goto error;
 	}
+	ret = num;
 
+error:
 #ifdef CONFIG_CPU_FREQ
 	complete(&dev->xfr_complete);
 #endif
 
-	return num;
+	return ret;
 }
 
 static u32 i2c_davinci_func(struct i2c_adapter *adap)
-- 
1.7.9.5

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
       [not found] ` <1389265885-26777-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
@ 2014-03-09 20:21   ` Wolfram Sang
  2014-03-10 10:24     ` Mike Looijmans
  2014-03-14  6:42   ` Mike Looijmans
  1 sibling, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-03-09 20:21 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA


[-- Attachment #1.1: Type: text/plain, Size: 1336 bytes --]

On Thu, Jan 09, 2014 at 12:11:25PM +0100, Mike Looijmans wrote:
> When a signal is caught while the i2c-davinci bus driver is transferring,
> the drive just "abandons" the transfer and leaves the controller to fend
> for itself. The next I2C transaction will find the controller in an
> undefined state and often results in a stream of "initiating i2c bus recovery"
> messages until the controller arrives in a defined state. This behaviour
> also sends out "half" or possibly even mixed messages to I2C client
> devices which may put them in an undesired state as well.
> 
> This patch fixes this issue by always attempting to finish the current
> transaction, and then check on a pending signal. It either reports
> success if all data has been transferred, or it returns failure when
> the transaction was aborted. This keeps the controller in a defined
> state, and is also much friendlier towards client devices, because
> it will only send complete messages.

Even more, you should complete the whole transfer. There are devices
where things can really go wrong if you send a half-complete command and
then start with the next one. So, not checking signals at all is the way
to go for I2C drivers. There is some cruft left, so I am happy about
patches fixing that, with testing on real HW. Like yours here.


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

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-03-09 20:21   ` Wolfram Sang
@ 2014-03-10 10:24     ` Mike Looijmans
       [not found]       ` <531D92F7.7080509-Oq418RWZeHk@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Looijmans @ 2014-03-10 10:24 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, nsekhar-l0cyMroinI0,
	khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/

On 03/09/2014 09:21 PM, Wolfram Sang wrote:
> On Thu, Jan 09, 2014 at 12:11:25PM +0100, Mike Looijmans wrote:
>> When a signal is caught while the i2c-davinci bus driver is transferring,
>> the drive just "abandons" the transfer and leaves the controller to fend
>> for itself. The next I2C transaction will find the controller in an
>> undefined state and often results in a stream of "initiating i2c bus recovery"
>> messages until the controller arrives in a defined state. This behaviour
>> also sends out "half" or possibly even mixed messages to I2C client
>> devices which may put them in an undesired state as well.
>>
>> This patch fixes this issue by always attempting to finish the current
>> transaction, and then check on a pending signal. It either reports
>> success if all data has been transferred, or it returns failure when
>> the transaction was aborted. This keeps the controller in a defined
>> state, and is also much friendlier towards client devices, because
>> it will only send complete messages.
>
> Even more, you should complete the whole transfer. There are devices
> where things can really go wrong if you send a half-complete command and
> then start with the next one. So, not checking signals at all is the way
> to go for I2C drivers. There is some cruft left, so I am happy about
> patches fixing that, with testing on real HW. Like yours here.

I agree.

I know the Zynq (using a cadence controller) also lets signals interrupt I2C 
transfers, so I'll propose a patch to Xilinx and CC to you and linux-i2c to 
completely remove signal handling from that driver as well.

Mike


Met vriendelijke groet / kind regards,

Mike Looijmans

TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans-Oq418RWZeHk@public.gmane.org
Website: www.topic.nl

Please consider the environment before printing this e-mail

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
       [not found]       ` <531D92F7.7080509-Oq418RWZeHk@public.gmane.org>
@ 2014-03-10 10:59         ` Wolfram Sang
  2014-03-10 15:24           ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-03-10 10:59 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, nsekhar-l0cyMroinI0,
	khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/

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


> >Even more, you should complete the whole transfer. There are devices
> >where things can really go wrong if you send a half-complete command and
> >then start with the next one. So, not checking signals at all is the way
> >to go for I2C drivers. There is some cruft left, so I am happy about
> >patches fixing that, with testing on real HW. Like yours here.
> 
> I agree.
> 
> I know the Zynq (using a cadence controller) also lets signals
> interrupt I2C transfers, so I'll propose a patch to Xilinx and CC to
> you and linux-i2c to completely remove signal handling from that
> driver as well.

Cool, thanks!


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

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-03-10 10:59         ` Wolfram Sang
@ 2014-03-10 15:24           ` Wolfram Sang
  2014-03-14  6:43             ` Mike Looijmans
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-03-10 15:24 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, nsekhar-l0cyMroinI0,
	khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/

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


> > >Even more, you should complete the whole transfer. There are devices
> > >where things can really go wrong if you send a half-complete command and
> > >then start with the next one. So, not checking signals at all is the way
> > >to go for I2C drivers. There is some cruft left, so I am happy about
> > >patches fixing that, with testing on real HW. Like yours here.
> > 
> > I agree.
> > 
> > I know the Zynq (using a cadence controller) also lets signals
> > interrupt I2C transfers, so I'll propose a patch to Xilinx and CC to
> > you and linux-i2c to completely remove signal handling from that
> > driver as well.
> 
> Cool, thanks!

Are you going to update the davinci patch as well?


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

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

* [PATCH] i2c-davinci: Handle signals gracefully
       [not found] ` <1389265885-26777-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
  2014-03-09 20:21   ` Wolfram Sang
@ 2014-03-14  6:42   ` Mike Looijmans
       [not found]     ` <1394779348-4084-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Mike Looijmans @ 2014-03-14  6:42 UTC (permalink / raw)
  To: wsa-z923LK4zBo2bacvFa/9K2g, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mike Looijmans

When a signal is caught while the i2c-davinci bus driver is transferring,
the drive just "abandons" the transfer and leaves the controller to fend
for itself. The next I2C transaction will find the controller in an
undefined state and often results in a stream of "initiating i2c bus recovery"
messages until the controller arrives in a defined state. This behaviour
also sends out "half" or possibly even mixed messages to I2C client
devices which may put them in an undesired state as well.

This patch fixes this issue by always attempting to finish the current
transaction, and only abort on bus errors. This keeps the controller in a
defined state, and is also much friendlier towards client devices, because
it will only send complete messages.

Before this patch, reading an I2C device in a loop and interrupting it
often resulted in a "initiating i2c bus recovery" storm and not being
able to communicate via I2C for several seconds. With this patch, I2C
transactions will not be interrupted or otherwise halfway completed.

v2: Completely ignore signals.

Signed-off-by: Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org>
---
 drivers/i2c/busses/i2c-davinci.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index af0b583..254d897 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -372,9 +372,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
 		flag |= DAVINCI_I2C_MDR_STP;
 	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
 
-	r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
+	r = wait_for_completion_timeout(&dev->cmd_complete,
 						      dev->adapter.timeout);
-	if (r == 0) {
+	if (unlikely(r == 0)) {
 		dev_err(dev->dev, "controller timed out\n");
 		davinci_i2c_recover_bus(dev);
 		i2c_davinci_init(dev);
@@ -384,7 +384,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
 	if (dev->buf_len) {
 		/* This should be 0 if all bytes were transferred
 		 * or dev->cmd_err denotes an error.
-		 * A signal may have aborted the transfer.
 		 */
 		if (r >= 0) {
 			dev_err(dev->dev, "abnormal termination buf_len=%i\n",
@@ -436,22 +435,24 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	ret = i2c_davinci_wait_bus_not_busy(dev, 1);
 	if (ret < 0) {
 		dev_warn(dev->dev, "timeout waiting for bus ready\n");
-		return ret;
+		goto error;
 	}
 
 	for (i = 0; i < num; i++) {
 		ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
-		dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
-			ret);
+		dev_dbg(dev->dev, "%s [%d/%d] %#x ret: %d\n", __func__, i + 1,
+				num, msgs[i].addr, ret);
 		if (ret < 0)
-			return ret;
+			goto error;
 	}
+	ret = num;
 
+error:
 #ifdef CONFIG_CPU_FREQ
 	complete(&dev->xfr_complete);
 #endif
 
-	return num;
+	return ret;
 }
 
 static u32 i2c_davinci_func(struct i2c_adapter *adap)
-- 
1.7.9.5

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-03-10 15:24           ` Wolfram Sang
@ 2014-03-14  6:43             ` Mike Looijmans
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Looijmans @ 2014-03-14  6:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, nsekhar-l0cyMroinI0,
	khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/

On 03/10/2014 04:24 PM, Wolfram Sang wrote:
>
>>>> Even more, you should complete the whole transfer. There are devices
>>>> where things can really go wrong if you send a half-complete command and
>>>> then start with the next one. So, not checking signals at all is the way
>>>> to go for I2C drivers. There is some cruft left, so I am happy about
>>>> patches fixing that, with testing on real HW. Like yours here.
>>>
>>> I agree.
>>>
>>> I know the Zynq (using a cadence controller) also lets signals
>>> interrupt I2C transfers, so I'll propose a patch to Xilinx and CC to
>>> you and linux-i2c to completely remove signal handling from that
>>> driver as well.
>>
>> Cool, thanks!
>
> Are you going to update the davinci patch as well?

An amended patch is on its way now. I forgot to set the subject to "PATCHv2" 
though.

Mike.



Met vriendelijke groet / kind regards,

Mike Looijmans

TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans-Oq418RWZeHk@public.gmane.org
Website: www.topic.nl

Please consider the environment before printing this e-mail

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
       [not found]     ` <1394779348-4084-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
@ 2014-03-24 16:14       ` Wolfram Sang
  2014-05-21  8:17         ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-03-24 16:14 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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


> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index af0b583..254d897 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -372,9 +372,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
>  		flag |= DAVINCI_I2C_MDR_STP;
>  	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
>  
> -	r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
> +	r = wait_for_completion_timeout(&dev->cmd_complete,
>  						      dev->adapter.timeout);
> -	if (r == 0) {
> +	if (unlikely(r == 0)) {

Not really needed, but well yeah...

>  		dev_err(dev->dev, "controller timed out\n");
>  		davinci_i2c_recover_bus(dev);
>  		i2c_davinci_init(dev);
> @@ -384,7 +384,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
>  	if (dev->buf_len) {
>  		/* This should be 0 if all bytes were transferred
>  		 * or dev->cmd_err denotes an error.
> -		 * A signal may have aborted the transfer.
>  		 */
>  		if (r >= 0) {
>  			dev_err(dev->dev, "abnormal termination buf_len=%i\n",
> @@ -436,22 +435,24 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>  	ret = i2c_davinci_wait_bus_not_busy(dev, 1);
>  	if (ret < 0) {
>  		dev_warn(dev->dev, "timeout waiting for bus ready\n");
> -		return ret;
> +		goto error;

You are fixing the error path here to include the completion? This is a
seperate patch IMO.

>  	}
>  
>  	for (i = 0; i < num; i++) {
>  		ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
> -		dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
> -			ret);
> +		dev_dbg(dev->dev, "%s [%d/%d] %#x ret: %d\n", __func__, i + 1,
> +				num, msgs[i].addr, ret);

No need for this change. We have other debug output/tracing already. But
no need to clean up either.

>  		if (ret < 0)
> -			return ret;
> +			goto error;
>  	}
> +	ret = num;
>  
> +error:
>  #ifdef CONFIG_CPU_FREQ
>  	complete(&dev->xfr_complete);
>  #endif
>  
> -	return num;
> +	return ret;

Thanks,

   Wolfram


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

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-03-24 16:14       ` Wolfram Sang
@ 2014-05-21  8:17         ` Wolfram Sang
  2014-05-24 11:53           ` Mike Looijmans
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-05-21  8:17 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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


> >  		dev_err(dev->dev, "controller timed out\n");
> >  		davinci_i2c_recover_bus(dev);
> >  		i2c_davinci_init(dev);
> > @@ -384,7 +384,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
> >  	if (dev->buf_len) {
> >  		/* This should be 0 if all bytes were transferred
> >  		 * or dev->cmd_err denotes an error.
> > -		 * A signal may have aborted the transfer.
> >  		 */
> >  		if (r >= 0) {
> >  			dev_err(dev->dev, "abnormal termination buf_len=%i\n",
> > @@ -436,22 +435,24 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
> >  	ret = i2c_davinci_wait_bus_not_busy(dev, 1);
> >  	if (ret < 0) {
> >  		dev_warn(dev->dev, "timeout waiting for bus ready\n");
> > -		return ret;
> > +		goto error;
> 
> You are fixing the error path here to include the completion? This is a
> seperate patch IMO.

Is my remark true? I still prefer the seperate patch, but we may also
simply update the commit message.



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

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-05-21  8:17         ` Wolfram Sang
@ 2014-05-24 11:53           ` Mike Looijmans
       [not found]             ` <53808851.7060308-Oq418RWZeHk@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Looijmans @ 2014-05-24 11:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 05/21/2014 10:17 AM, Wolfram Sang wrote:
>
>>>   		dev_err(dev->dev, "controller timed out\n");
>>>   		davinci_i2c_recover_bus(dev);
>>>   		i2c_davinci_init(dev);
>>> @@ -384,7 +384,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
>>>   	if (dev->buf_len) {
>>>   		/* This should be 0 if all bytes were transferred
>>>   		 * or dev->cmd_err denotes an error.
>>> -		 * A signal may have aborted the transfer.
>>>   		 */
>>>   		if (r >= 0) {
>>>   			dev_err(dev->dev, "abnormal termination buf_len=%i\n",
>>> @@ -436,22 +435,24 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>>>   	ret = i2c_davinci_wait_bus_not_busy(dev, 1);
>>>   	if (ret < 0) {
>>>   		dev_warn(dev->dev, "timeout waiting for bus ready\n");
>>> -		return ret;
>>> +		goto error;
>>
>> You are fixing the error path here to include the completion? This is a
>> seperate patch IMO.
>
> Is my remark true? I still prefer the seperate patch, but we may also
> simply update the commit message.

Your remarks is correct. All your remarks were. Problem currently is 
that I'm not assigned to a project related to the davinci so I cannot 
spend time to fix and port it (the actual platform still runs 2.6.37).

Feel free to adap my patch or comments and commit. Or wait a few weeks 
for when I have a sponsor to split and update the patch.

-- 
Mike Looijmans

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
       [not found]             ` <53808851.7060308-Oq418RWZeHk@public.gmane.org>
@ 2014-06-01 20:11               ` Wolfram Sang
  2014-11-08 21:51                 ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-06-01 20:11 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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


> Feel free to adap my patch or comments and commit. Or wait a few weeks for
> when I have a sponsor to split and update the patch.

OK, I'll hope you can make it for 3.17. Thanks!


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

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-06-01 20:11               ` Wolfram Sang
@ 2014-11-08 21:51                 ` Wolfram Sang
  2014-11-10 14:49                   ` Mike Looijmans
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-11-08 21:51 UTC (permalink / raw)
  To: Mike Looijmans
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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

On Sun, Jun 01, 2014 at 10:11:34PM +0200, Wolfram Sang wrote:
> 
> > Feel free to adap my patch or comments and commit. Or wait a few weeks for
> > when I have a sponsor to split and update the patch.
> 
> OK, I'll hope you can make it for 3.17. Thanks!

I now picked the part removing the interruptible-call. The part with
the new exit-path would need to be resend and retested in case anyone
is still caring.


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

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

* Re: [PATCH] i2c-davinci: Handle signals gracefully
  2014-11-08 21:51                 ` Wolfram Sang
@ 2014-11-10 14:49                   ` Mike Looijmans
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Looijmans @ 2014-11-10 14:49 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, davinci-linux-open-source, linux-kernel

On 11/08/2014 10:51 PM, Wolfram Sang wrote:
> On Sun, Jun 01, 2014 at 10:11:34PM +0200, Wolfram Sang wrote:
>>
>>> Feel free to adap my patch or comments and commit. Or wait a few weeks for
>>> when I have a sponsor to split and update the patch.
>>
>> OK, I'll hope you can make it for 3.17. Thanks!
>
> I now picked the part removing the interruptible-call. The part with
> the new exit-path would need to be resend and retested in case anyone
> is still caring.
>

I think that's the right thing to do. There seems to be little interest in the 
rest of the I2C controller, and it's a tough one to test (you'd have to 
trigger an I2C error at exactly the moment that a clock frequency change is 
about to occur...).




Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/

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

end of thread, other threads:[~2014-11-10 14:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 11:11 [PATCH] i2c-davinci: Handle signals gracefully Mike Looijmans
     [not found] ` <1389265885-26777-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
2014-03-09 20:21   ` Wolfram Sang
2014-03-10 10:24     ` Mike Looijmans
     [not found]       ` <531D92F7.7080509-Oq418RWZeHk@public.gmane.org>
2014-03-10 10:59         ` Wolfram Sang
2014-03-10 15:24           ` Wolfram Sang
2014-03-14  6:43             ` Mike Looijmans
2014-03-14  6:42   ` Mike Looijmans
     [not found]     ` <1394779348-4084-1-git-send-email-mike.looijmans-Oq418RWZeHk@public.gmane.org>
2014-03-24 16:14       ` Wolfram Sang
2014-05-21  8:17         ` Wolfram Sang
2014-05-24 11:53           ` Mike Looijmans
     [not found]             ` <53808851.7060308-Oq418RWZeHk@public.gmane.org>
2014-06-01 20:11               ` Wolfram Sang
2014-11-08 21:51                 ` Wolfram Sang
2014-11-10 14:49                   ` Mike Looijmans

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).