Skip to contentSkip to conversation

i2c-ali1535: fix styles issues

PATCH Superseded corentin.labbe 2 participants 4 messages Jun 15, 2011 – Jul 5, 2011 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-ali1535: fix styles issues

Hello

This is a fix-style patch for i2c-ali1535. (issue reported by checkpatch.pl)

drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +16 -17
@@ -1,9 +1,9 @@
 /*
-    Copyright (c) 2000  Frodo Looijaard <[email protected]>,
-                        Philip Edelbrock <[email protected]>,
-                        Mark D. Studebaker <mdsxyz123-/[email protected]>,
-                        Dan Eaton <[email protected]> and
-                        Stephen Rousset<[email protected]>
+    Copyright (c) 2000  Frodo Looijaard <[email protected]>,
+			Philip Edelbrock <[email protected]>,
+			Mark D. Studebaker <mdsxyz123-/[email protected]>,
+			Dan Eaton <[email protected]> and
+			Stephen Rousset<[email protected]>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -254,8 +254,8 @@ static int ali1535_transaction(struct i2
 	if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
 		/* do a clear-on-write */
 		outb_p(0xFF, SMBHSTSTS);
-		if ((temp = inb_p(SMBHSTSTS)) &
-		    (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
+		temp = inb_p(SMBHSTSTS);
+		if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
 			/* This is probably going to be correctable only by a
 			 * power reset as one of the bits now appears to be
 			 * stuck */
@@ -267,9 +267,8 @@ static int ali1535_transaction(struct i2
 		}
 	} else {
 		/* check and clear done bit */
-		if (temp & ALI1535_STS_DONE) {
+		if (temp & ALI1535_STS_DONE)
 			outb_p(temp, SMBHSTSTS);
-		}
 	}
 
 	/* start the transaction by writing anything to the start register */
@@ -278,7 +277,7 @@ static int ali1535_transaction(struct i2
 	/* We will always wait for a fraction of a second! */
 	timeout = 0;
 	do {
-		msleep(1);
+		usleep_range(800, 1200);
 		temp = inb_p(SMBHSTSTS);
 	} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
 		 && (timeout++ < MAX_TIMEOUT));
@@ -325,12 +324,12 @@ static int ali1535_transaction(struct i2
 	/* take consequent actions for error conditions */
 	if (!(temp & ALI1535_STS_DONE)) {
 		/* issue "kill" to reset host controller */
-		outb_p(ALI1535_KILL,SMBHSTTYP);
-		outb_p(0xFF,SMBHSTSTS);
+		outb_p(ALI1535_KILL, SMBHSTTYP);
+		outb_p(0xFF, SMBHSTSTS);
 	} else if (temp & ALI1535_STS_ERR) {
 		/* issue "timeout" to reset all devices on bus */
-		outb_p(ALI1535_T_OUT,SMBHSTTYP);
-		outb_p(0xFF,SMBHSTSTS);
+		outb_p(ALI1535_T_OUT, SMBHSTTYP);
+		outb_p(0xFF, SMBHSTSTS);
 	}
 
 	return result;
@@ -351,7 +350,7 @@ static s32 ali1535_access(struct i2c_ada
 	for (timeout = 0;
 	     (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
 	     timeout++) {
-		msleep(1);
+		usleep_range(800, 1200);
 		temp = inb_p(SMBHSTSTS);
 	}
 	if (timeout >= MAX_TIMEOUT)
@@ -480,12 +479,12 @@ static struct i2c_adapter ali1535_adapte
 	.algo		= &smbus_algorithm,
 };
 
-static const struct pci_device_id ali1535_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
 	{ },
 };
 
-MODULE_DEVICE_TABLE (pci, ali1535_ids);
+MODULE_DEVICE_TABLE(pci, ali1535_ids);
 
 static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {

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

#2 lore raw

Hi Corentin,

Quoted 13 lines · corentin.labbe

Hello

This is a fix-style patch for i2c-ali1535. (issue reported by checkpatch.pl)

drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +0 -3
@@ -1,9 +1,9 @@
 /*
-    Copyright (c) 2000  Frodo Looijaard <[email protected]>,
-                        Philip Edelbrock <[email protected]>,
-                        Mark D. Studebaker <mdsxyz123-/[email protected]>,

drivers/i2c/busses/i2c-ali1535.c line 9

Quoted 10 lines
drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +5 -2
-                        Dan Eaton <[email protected]> and
-                        Stephen Rousset<[email protected]>
+    Copyright (c) 2000  Frodo Looijaard <[email protected]>,
+			Philip Edelbrock <[email protected]>,
+			Mark D. Studebaker <mdsxyz123-/[email protected]>,
+			Dan Eaton <[email protected]> and
+			Stephen Rousset<[email protected]>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by

Your mailer stripped the trailing white-space from the original code, causing the patch to not apply.

While you're fixing this comment, please convert it to the standard multi-line style:

/*
* blah
* blah
*/

In fact the wrong format is what causes checkpatch.pl to complain: it doesn't realize it is dealing with comments and not code.

Please also restore the missing space after "Rousset".

Quoted 23 lines
drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +3 -4
@@ -254,8 +254,8 @@ static int ali1535_transaction(struct i2
 	if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
 		/* do a clear-on-write */
 		outb_p(0xFF, SMBHSTSTS);
-		if ((temp = inb_p(SMBHSTSTS)) &
-		    (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
+		temp = inb_p(SMBHSTSTS);
+		if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
 			/* This is probably going to be correctable only by a
 			 * power reset as one of the bits now appears to be
 			 * stuck */
@@ -267,9 +267,8 @@ static int ali1535_transaction(struct i2
 		}
 	} else {
 		/* check and clear done bit */
-		if (temp & ALI1535_STS_DONE) {
+		if (temp & ALI1535_STS_DONE)
 			outb_p(temp, SMBHSTSTS);
-		}
 	}
 
 	/* start the transaction by writing anything to the start register */

drivers/i2c/busses/i2c-ali1535.c static int ali1535_transaction(struct i2 · line 280

Quoted 5 lines
drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +1 -1
@@ -278,7 +277,7 @@ static int ali1535_transaction(struct i2
 	/* We will always wait for a fraction of a second! */
 	timeout = 0;
 	do {
-		msleep(1);
+		usleep_range(800, 1200);

Very nice, I didn't know about usleep_range().

Quoted 30 lines
drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +5 -5
 		temp = inb_p(SMBHSTSTS);
 	} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
 		 && (timeout++ < MAX_TIMEOUT));
@@ -325,12 +324,12 @@ static int ali1535_transaction(struct i2
 	/* take consequent actions for error conditions */
 	if (!(temp & ALI1535_STS_DONE)) {
 		/* issue "kill" to reset host controller */
-		outb_p(ALI1535_KILL,SMBHSTTYP);
-		outb_p(0xFF,SMBHSTSTS);
+		outb_p(ALI1535_KILL, SMBHSTTYP);
+		outb_p(0xFF, SMBHSTSTS);
 	} else if (temp & ALI1535_STS_ERR) {
 		/* issue "timeout" to reset all devices on bus */
-		outb_p(ALI1535_T_OUT,SMBHSTTYP);
-		outb_p(0xFF,SMBHSTSTS);
+		outb_p(ALI1535_T_OUT, SMBHSTTYP);
+		outb_p(0xFF, SMBHSTSTS);
 	}
 
 	return result;
@@ -351,7 +350,7 @@ static s32 ali1535_access(struct i2c_ada
 	for (timeout = 0;
 	     (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
 	     timeout++) {
-		msleep(1);
+		usleep_range(800, 1200);
 		temp = inb_p(SMBHSTSTS);
 	}
 	if (timeout >= MAX_TIMEOUT)

drivers/i2c/busses/i2c-ali1535.c static struct i2c_adapter ali1535_adapte · line 482

Quoted 5 lines
drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +1 -1
@@ -480,12 +479,12 @@ static struct i2c_adapter ali1535_adapte
 	.algo		= &smbus_algorithm,
 };
 
-static const struct pci_device_id ali1535_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {

I'm not particularly fond of that one, but it even checkpatch.pl says so...

drivers/i2c/busses/i2c-ali1535.c static struct i2c_adapter ali1535_adapte · line 490

Quoted 9 lines
drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +1 -1
 	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
 	{ },
 };
 
-MODULE_DEVICE_TABLE (pci, ali1535_ids);
+MODULE_DEVICE_TABLE(pci, ali1535_ids);
 
 static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {

All other changes look good. Please resend with the first part updated.

Signature · 1 line
Jean Delvare

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

#4 lore raw

PATCH v2 1/1 i2c-ali1535: fix styles issues

Hello

This is a fix-style patch for i2c-ali1535. (issue reported by checkpatch.pl)

---

drivers/i2c/busses/i2c-ali1535.c renamed from drivers/i2c/busses/i2c-ali1535.c.orig +30 -31
@@ -1,23 +1,23 @@
 /*
-    Copyright (c) 2000  Frodo Looijaard <[email protected]>,
-                        Philip Edelbrock <[email protected]>,
-                        Mark D. Studebaker <mdsxyz123-/[email protected]>,
-                        Dan Eaton <[email protected]> and
-                        Stephen Rousset<[email protected]>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Copyright (c) 2000  Frodo Looijaard <[email protected]>,
+ *                      Philip Edelbrock <[email protected]>,
+ *                      Mark D. Studebaker <mdsxyz123-/[email protected]>,
+ *                      Dan Eaton <[email protected]> and
+ *                      Stephen Rousset <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
 /*
@@ -254,8 +254,8 @@ static int ali1535_transaction(struct i2
 	if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
 		/* do a clear-on-write */
 		outb_p(0xFF, SMBHSTSTS);
-		if ((temp = inb_p(SMBHSTSTS)) &
-		    (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
+		temp = inb_p(SMBHSTSTS);
+		if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
 			/* This is probably going to be correctable only by a
 			 * power reset as one of the bits now appears to be
 			 * stuck */
@@ -267,9 +267,8 @@ static int ali1535_transaction(struct i2
 		}
 	} else {
 		/* check and clear done bit */
-		if (temp & ALI1535_STS_DONE) {
+		if (temp & ALI1535_STS_DONE)
 			outb_p(temp, SMBHSTSTS);
-		}
 	}
 
 	/* start the transaction by writing anything to the start register */
@@ -278,7 +277,7 @@ static int ali1535_transaction(struct i2
 	/* We will always wait for a fraction of a second! */
 	timeout = 0;
 	do {
-		msleep(1);
+		usleep_range(1000, 2000);
 		temp = inb_p(SMBHSTSTS);
 	} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
 		 && (timeout++ < MAX_TIMEOUT));
@@ -325,12 +324,12 @@ static int ali1535_transaction(struct i2
 	/* take consequent actions for error conditions */
 	if (!(temp & ALI1535_STS_DONE)) {
 		/* issue "kill" to reset host controller */
-		outb_p(ALI1535_KILL,SMBHSTTYP);
-		outb_p(0xFF,SMBHSTSTS);
+		outb_p(ALI1535_KILL, SMBHSTTYP);
+		outb_p(0xFF, SMBHSTSTS);
 	} else if (temp & ALI1535_STS_ERR) {
 		/* issue "timeout" to reset all devices on bus */
-		outb_p(ALI1535_T_OUT,SMBHSTTYP);
-		outb_p(0xFF,SMBHSTSTS);
+		outb_p(ALI1535_T_OUT, SMBHSTTYP);
+		outb_p(0xFF, SMBHSTSTS);
 	}
 
 	return result;
@@ -351,7 +350,7 @@ static s32 ali1535_access(struct i2c_ada
 	for (timeout = 0;
 	     (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
 	     timeout++) {
-		msleep(1);
+		usleep_range(1000, 2000);
 		temp = inb_p(SMBHSTSTS);
 	}
 	if (timeout >= MAX_TIMEOUT)
@@ -480,12 +479,12 @@ static struct i2c_adapter ali1535_adapte
 	.algo		= &smbus_algorithm,
 };
 
-static const struct pci_device_id ali1535_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
 	{ },
 };
 
-MODULE_DEVICE_TABLE (pci, ali1535_ids);
+MODULE_DEVICE_TABLE(pci, ali1535_ids);
 
 static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {

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