Skip to contentSkip to conversation

I2C: S3C2410: Fixup error codes returned rom a transfer.

PATCH Ben Dooks 2 participants 2 messages Jun 2, 2008 – Jun 3, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

The driver should be returning -ENXIO for transfers that do not pass the initial address byte stage.

Note, also small tidyups to the driver comments in the area.

drivers/i2c/busses/i2c-s3c2410.c +3 -3
Index: linux-2.6.26-rc4-quilt3/drivers/i2c/busses/i2c-s3c2410.c
===================================================================
@@ -290,12 +290,12 @@ static int i2s_s3c_irq_nextbyte(struct s
 		 * bus, or started a new i2c message
 		 */
 		
-		if (iicstat  & S3C2410_IICSTAT_LASTBIT &&
+		if (iicstat & S3C2410_IICSTAT_LASTBIT &&
 		    !(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
 			/* ack was not received... */
 
 			dev_dbg(i2c->dev, "ack was not received\n");
-			s3c24xx_i2c_stop(i2c, -EREMOTEIO);
+			s3c24xx_i2c_stop(i2c, -ENXIO);
 			goto out_ack;
 		}
 
@@ -305,7 +305,7 @@ static int i2s_s3c_irq_nextbyte(struct s
 			i2c->state = STATE_WRITE;
 
 		/* terminate the transfer if there is nothing to do
-		 * (used by the i2c probe to find devices */
+		 * as this is used by the i2c probe to find devices. */
 
 		if (is_lastmsg(i2c) && i2c->msg->len == 0) {
 			s3c24xx_i2c_stop(i2c, 0);
Signature · 8 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Ben,

Quoted 4 lines · Ben Dooks

The driver should be returning -ENXIO for transfers that do not pass the initial address byte stage.

Note, also small tidyups to the driver comments in the area.

I prefer not mixing fixes with cleanups, but if you're going to push this to Linus yourself, I don't care too much ;)

Quoted 22 lines

Index: linux-2.6.26-rc4-quilt3/drivers/i2c/busses/i2c-s3c2410.c
===================================================================

drivers/i2c/busses/i2c-s3c2410.c +2 -2
@@ -290,12 +290,12 @@ static int i2s_s3c_irq_nextbyte(struct s
 		 * bus, or started a new i2c message
 		 */
 
-		if (iicstat  & S3C2410_IICSTAT_LASTBIT &&
+		if (iicstat & S3C2410_IICSTAT_LASTBIT &&
 		    !(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
 			/* ack was not received... */
 
 			dev_dbg(i2c->dev, "ack was not received\n");
-			s3c24xx_i2c_stop(i2c, -EREMOTEIO);
+			s3c24xx_i2c_stop(i2c, -ENXIO);
 			goto out_ack;
 		}
 

drivers/i2c/busses/i2c-s3c2410.c static int i2s_s3c_irq_nextbyte(struct s · line 308

Quoted 5 lines
drivers/i2c/busses/i2c-s3c2410.c +1 -1
@@ -305,7 +305,7 @@ static int i2s_s3c_irq_nextbyte(struct s
 			i2c->state = STATE_WRITE;
 
 		/* terminate the transfer if there is nothing to do
-		 * (used by the i2c probe to find devices */
+		 * as this is used by the i2c probe to find devices. */

The "as" doesn't really fit.

drivers/i2c/busses/i2c-s3c2410.c static int i2s_s3c_irq_nextbyte(struct s

Quoted 4 lines
drivers/i2c/busses/i2c-s3c2410.c +0 -0
 		if (is_lastmsg(i2c) && i2c->msg->len == 0) {
 			s3c24xx_i2c_stop(i2c, 0);
 

Other than that, patch looks fine to me.

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c