linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jean Delvare <khali@linux-fr.org>
Cc: linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	Linux I2C <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH] i2c-powermac: Reject unsupported I2C transactions
Date: Wed, 14 Oct 2009 16:39:48 +1100	[thread overview]
Message-ID: <1255498788.2347.37.camel@pasglop> (raw)
In-Reply-To: <20090930221435.58636363@hyperion.delvare>

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;
> 
> 

      reply	other threads:[~2009-10-14  5:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 20:14 [PATCH] i2c-powermac: Reject unsupported I2C transactions Jean Delvare
2009-10-14  5:39 ` Benjamin Herrenschmidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1255498788.2347.37.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=khali@linux-fr.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).