linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c-powermac: Reject unsupported I2C transactions
@ 2009-09-30 20:14 Jean Delvare
  2009-10-14  5:39 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2009-09-30 20:14 UTC (permalink / raw)
  To: Linux I2C, linuxppc-dev; +Cc: Paul Mackerras

The i2c-powermac driver doesn't support arbitrary multi-message I2C
transactions, only SMBus ones. Make it clear by returning an error if
a multi-message I2C transaction is attempted. This is better than only
processing the first message, because most callers won't recover from
the short transaction. Anyone wishing to issue multi-message
transactions should use the SMBus API instead of the raw I2C API.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
---
 drivers/i2c/busses/i2c-powermac.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- linux-2.6.32-rc1.orig/drivers/i2c/busses/i2c-powermac.c	2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.32-rc1/drivers/i2c/busses/i2c-powermac.c	2009-09-30 20:29:42.000000000 +0200
@@ -146,6 +146,12 @@ static int i2c_powermac_master_xfer(	str
 	int			read;
 	int			addrdir;
 
+	if (num != 1) {
+		dev_err(&adap->dev,
+			"Multi-message I2C transactions not supported\n");
+		return -EOPNOTSUPP;
+	}
+
 	if (msgs->flags & I2C_M_TEN)
 		return -EINVAL;
 	read = (msgs->flags & I2C_M_RD) != 0;


-- 
Jean Delvare

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

* Re: [PATCH] i2c-powermac: Reject unsupported I2C transactions
  2009-09-30 20:14 [PATCH] i2c-powermac: Reject unsupported I2C transactions Jean Delvare
@ 2009-10-14  5:39 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2009-10-14  5:39 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linuxppc-dev, Paul Mackerras, Linux I2C

On Wed, 2009-09-30 at 22:14 +0200, Jean Delvare wrote:
> The i2c-powermac driver doesn't support arbitrary multi-message I2C
> transactions, only SMBus ones. Make it clear by returning an error if
> a multi-message I2C transaction is attempted. This is better than only
> processing the first message, because most callers won't recover from
> the short transaction. Anyone wishing to issue multi-message
> transactions should use the SMBus API instead of the raw I2C API.
> 
> Signed-off-by: Jean Delvare <khali@linux-fr.org>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> Cc: Paul Mackerras <paulus@samba.org>
> ---
>  drivers/i2c/busses/i2c-powermac.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> --- linux-2.6.32-rc1.orig/drivers/i2c/busses/i2c-powermac.c	2009-06-10 05:05:27.000000000 +0200
> +++ linux-2.6.32-rc1/drivers/i2c/busses/i2c-powermac.c	2009-09-30 20:29:42.000000000 +0200
> @@ -146,6 +146,12 @@ static int i2c_powermac_master_xfer(	str
>  	int			read;
>  	int			addrdir;
>  
> +	if (num != 1) {
> +		dev_err(&adap->dev,
> +			"Multi-message I2C transactions not supported\n");
> +		return -EOPNOTSUPP;
> +	}
> +
>  	if (msgs->flags & I2C_M_TEN)
>  		return -EINVAL;
>  	read = (msgs->flags & I2C_M_RD) != 0;
> 
> 

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

end of thread, other threads:[~2009-10-14  5:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30 20:14 [PATCH] i2c-powermac: Reject unsupported I2C transactions Jean Delvare
2009-10-14  5:39 ` Benjamin Herrenschmidt

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