From patchwork Wed Sep 30 20:14:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 34627 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 17B161008CF for ; Thu, 1 Oct 2009 06:14:46 +1000 (EST) Received: by ozlabs.org (Postfix) id 71B6AB7BA6; Thu, 1 Oct 2009 06:14:40 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from poutre.nerim.net (poutre.nerim.net [62.4.16.124]) by ozlabs.org (Postfix) with ESMTP id 24530B7BBB for ; Thu, 1 Oct 2009 06:14:39 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by poutre.nerim.net (Postfix) with ESMTP id 517F139DE6F; Wed, 30 Sep 2009 22:14:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at nerim.net Received: from poutre.nerim.net ([127.0.0.1]) by localhost (poutre.nerim.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KfKCTdIUxnaS; Wed, 30 Sep 2009 22:14:33 +0200 (CEST) Received: from hyperion.delvare (jdelvare.pck.nerim.net [62.212.121.182]) by poutre.nerim.net (Postfix) with ESMTP id 353E639DE74; Wed, 30 Sep 2009 22:14:33 +0200 (CEST) Date: Wed, 30 Sep 2009 22:14:35 +0200 From: Jean Delvare To: Linux I2C , linuxppc-dev@ozlabs.org Subject: [PATCH] i2c-powermac: Reject unsupported I2C transactions Message-ID: <20090930221435.58636363@hyperion.delvare> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.14.4; i586-suse-linux-gnu) Mime-Version: 1.0 Cc: Paul Mackerras X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org 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 Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Acked-by: Benjamin Herrenschmidt --- 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;