From patchwork Tue Jul 20 01:09:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Walls X-Patchwork-Id: 112906 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6K1G9js026574 for ; Tue, 20 Jul 2010 01:16:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758042Ab0GTBQI (ORCPT ); Mon, 19 Jul 2010 21:16:08 -0400 Received: from proofpoint-cluster.metrocast.net ([65.175.128.136]:23940 "EHLO proofpoint-cluster.metrocast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758087Ab0GTBQH (ORCPT ); Mon, 19 Jul 2010 21:16:07 -0400 Received: from [192.168.1.2] (d-216-36-24-245.cpe.metrocast.net [216.36.24.245]) (authenticated bits=0) by mango.metrocast.net (8.13.8/8.13.8) with ESMTP id o6K1Fgso029483; Tue, 20 Jul 2010 01:15:48 GMT Subject: [PATCH 02/17] cx23885: Check for slave nack on all transactions From: Andy Walls To: linux-media@vger.kernel.org Cc: Kenney Phillisjr , Steven Toth , Jean Delvare In-Reply-To: References: Date: Mon, 19 Jul 2010 21:09:31 -0400 Message-ID: <1279588171.28153.4.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.0.10011, 1.0.148, 0.0.0000 definitions=2010-07-19_07:2010-07-19, 2010-07-19, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-1005130000 definitions=main-1007190145 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 20 Jul 2010 01:16:09 +0000 (UTC) diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index 154c914..afb8d6f 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c @@ -125,6 +125,10 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, goto err; if (retval == 0) goto eio; + if (!i2c_slave_did_ack(i2c_adap)) { + retval = -ENXIO; + goto err; + } if (i2c_debug) { printk(" addr << 1, msg->buf[0]); if (!(ctrl & I2C_NOSTOP)) @@ -214,6 +218,10 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, goto err; if (retval == 0) goto eio; + if (cnt == 0 && !i2c_slave_did_ack(i2c_adap)) { + retval = -ENXIO; + goto err; + } msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; if (i2c_debug) { dprintk(1, " %02x", msg->buf[cnt]);