Skip to contentSkip to conversation

i2c-i801: Fix alignment issues

PATCH Superseded Ivo Manca 2 participants 3 messages Jul 23, 2008 – Aug 12, 2008 2 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore

Ivo Manca

author
#0 lore raw

PATCH 2/3 i2c-i801: Fix alignment issues

This patch fixes alignment issues introduced by previous patch.

---
This patch depends on: [PATCH 01/03] i2c-i801: Add basic interrupt support

i2c-i801.c renamed from i2c-i801-nolayout.c +16 -16
@@ -210,24 +210,24 @@ static int i801_transaction(int xact)
 					((temp = i801_get_status(algo_data))
 					& I801_HST_STS_MASK_NORM), HZ/2);
 	} else {
-	outb_p(xact | I801_START, SMBHSTCNT);
+		outb_p(xact | I801_START, SMBHSTCNT);
 
-	/* We will always wait for a fraction of a second! */
-	do {
-		msleep(1);
-		temp = inb_p(SMBHSTSTS);
-	} while ((temp & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
+		/* We will always wait for a fraction of a second! */
+		do {
+			msleep(1);
+			temp = inb_p(SMBHSTSTS);
+		} while ((temp & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
 
-	/* If the SMBus is still busy, we give up */
-	if (timeout >= MAX_TIMEOUT) {
-		dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");
-		result = -1;
-		/* try to stop the current command */
-		dev_dbg(&I801_dev->dev, "Terminating the current operation\n");
-		outb_p(inb_p(SMBHSTCNT) | SMBHSTCNT_KILL, SMBHSTCNT);
-		msleep(1);
-		outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL), SMBHSTCNT);
-	}
+		/* If the SMBus is still busy, we give up */
+		if (timeout >= MAX_TIMEOUT) {
+			dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");
+			result = -1;
+			/* try to stop the current command */
+			dev_dbg(&I801_dev->dev, "Terminating the current operation\n");
+			outb_p(inb_p(SMBHSTCNT) | SMBHSTCNT_KILL, SMBHSTCNT);
+			msleep(1);
+			outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL), SMBHSTCNT);
+		}
 	}
 
 	if (temp & SMBHSTSTS_FAILED) {

_______________________________________________
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
Quoted 39 lines · Ivo Manca

This patch fixes alignment issues introduced by previous patch.

---
This patch depends on: [PATCH 01/03] i2c-i801: Add basic interrupt support

i2c-i801.c renamed from i2c-i801-nolayout.c +9 -16
@@ -210,24 +210,24 @@ static int i801_transaction(int xact)
 					((temp = i801_get_status(algo_data))
 					& I801_HST_STS_MASK_NORM), HZ/2);
 	} else {
-	outb_p(xact | I801_START, SMBHSTCNT);
+		outb_p(xact | I801_START, SMBHSTCNT);
 
-	/* We will always wait for a fraction of a second! */
-	do {
-		msleep(1);
-		temp = inb_p(SMBHSTSTS);
-	} while ((temp & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
+		/* We will always wait for a fraction of a second! */
+		do {
+			msleep(1);
+			temp = inb_p(SMBHSTSTS);
+		} while ((temp & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
 
-	/* If the SMBus is still busy, we give up */
-	if (timeout >= MAX_TIMEOUT) {
-		dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");
-		result = -1;
-		/* try to stop the current command */
-		dev_dbg(&I801_dev->dev, "Terminating the current operation\n");
-		outb_p(inb_p(SMBHSTCNT) | SMBHSTCNT_KILL, SMBHSTCNT);
-		msleep(1);
-		outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL), SMBHSTCNT);
-	}
+		/* If the SMBus is still busy, we give up */
+		if (timeout >= MAX_TIMEOUT) {
+			dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");

i2c-i801.c static int i801_transaction(int xact) · line 233

Quoted 10 lines
i2c-i801.c renamed from i2c-i801-nolayout.c +7 -0
+			result = -1;
+			/* try to stop the current command */
+			dev_dbg(&I801_dev->dev, "Terminating the current operation\n");
+			outb_p(inb_p(SMBHSTCNT) | SMBHSTCNT_KILL, SMBHSTCNT);
+			msleep(1);
+			outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL), SMBHSTCNT);
+		}
 	}
 
 	if (temp & SMBHSTSTS_FAILED) {

OK. There's no real need to make this a separate patch. In fact I think your first patch would be easier to read with these alignment issues fixed, as it makes it easier to figure out what code paths your changes are replacing. As a matter of fact, I applied this second patch before reviewing the first one.

Signature · 6 lines
Jean Delvare

_______________________________________________
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]

author
#4 lore raw
Quoted 7 lines · Jean Delvare

OK. There's no real need to make this a separate patch. In fact I think your first patch would be easier to read with these alignment issues fixed, as it makes it easier to figure out what code paths your changes are replacing. As a matter of fact, I applied this second patch before reviewing the first one.

Hey Jean,

First of all, thanks a lot for reviewing. It's very appriciated. I've read and noted your comments, but will reply more detailed to the first patch later. Quite busy lately (new house, graduated => new job)..

I thought it was easier (and even required) to seperate the patches this way, but I seem to have been wrong ;p. Anyway, next time, this patch will be incorporated with the first patch. I'll leave the third patch in place, since it's completely unrelated.

Thanks,
Ivo

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