aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-07-14 16:38:32 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:32 -0400
commit2b73809d06649fe6c7f4294b051ca4934a34bb91 (patch)
tree09e98d6bd544fb44fa0102637124c6d03d882d28 /drivers/i2c
parentdcb5c9239de8d3ff1c663e75f0f1c75bcb21ee20 (diff)
i2c-i801: Rename local variable temp to status
"temp" isn't a terribly well chosen name for a local variable. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-i801.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 614c9e4ffba3..73bd8552734c 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -134,18 +134,18 @@ static unsigned int i801_features;
134 134
135static int i801_transaction(int xact) 135static int i801_transaction(int xact)
136{ 136{
137 int temp; 137 int status;
138 int result = 0; 138 int result = 0;
139 int timeout = 0; 139 int timeout = 0;
140 140
141 /* Make sure the SMBus host is ready to start transmitting */ 141 /* Make sure the SMBus host is ready to start transmitting */
142 /* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ 142 /* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
143 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { 143 if ((status = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
144 dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting...\n", 144 dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting...\n",
145 temp); 145 status);
146 outb_p(temp, SMBHSTSTS); 146 outb_p(status, SMBHSTSTS);
147 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { 147 if ((status = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
148 dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", temp); 148 dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", status);
149 return -EBUSY; 149 return -EBUSY;
150 } else { 150 } else {
151 dev_dbg(&I801_dev->dev, "Successful!\n"); 151 dev_dbg(&I801_dev->dev, "Successful!\n");
@@ -159,8 +159,8 @@ static int i801_transaction(int xact)
159 /* We will always wait for a fraction of a second! */ 159 /* We will always wait for a fraction of a second! */
160 do { 160 do {
161 msleep(1); 161 msleep(1);
162 temp = inb_p(SMBHSTSTS); 162 status = inb_p(SMBHSTSTS);
163 } while ((temp & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); 163 } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
164 164
165 /* If the SMBus is still busy, we give up */ 165 /* If the SMBus is still busy, we give up */
166 if (timeout >= MAX_TIMEOUT) { 166 if (timeout >= MAX_TIMEOUT) {
@@ -173,17 +173,17 @@ static int i801_transaction(int xact)
173 outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL), SMBHSTCNT); 173 outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL), SMBHSTCNT);
174 } 174 }
175 175
176 if (temp & SMBHSTSTS_FAILED) { 176 if (status & SMBHSTSTS_FAILED) {
177 result = -EIO; 177 result = -EIO;
178 dev_dbg(&I801_dev->dev, "Error: Failed bus transaction\n"); 178 dev_dbg(&I801_dev->dev, "Error: Failed bus transaction\n");
179 } 179 }
180 180
181 if (temp & SMBHSTSTS_BUS_ERR) { 181 if (status & SMBHSTSTS_BUS_ERR) {
182 result = -EAGAIN; 182 result = -EAGAIN;
183 dev_dbg(&I801_dev->dev, "Lost arbitration\n"); 183 dev_dbg(&I801_dev->dev, "Lost arbitration\n");
184 } 184 }
185 185
186 if (temp & SMBHSTSTS_DEV_ERR) { 186 if (status & SMBHSTSTS_DEV_ERR) {
187 result = -ENXIO; 187 result = -ENXIO;
188 dev_dbg(&I801_dev->dev, "Error: no response!\n"); 188 dev_dbg(&I801_dev->dev, "Error: no response!\n");
189 } 189 }
@@ -191,9 +191,9 @@ static int i801_transaction(int xact)
191 if ((inb_p(SMBHSTSTS) & 0x1f) != 0x00) 191 if ((inb_p(SMBHSTSTS) & 0x1f) != 0x00)
192 outb_p(inb(SMBHSTSTS), SMBHSTSTS); 192 outb_p(inb(SMBHSTSTS), SMBHSTSTS);
193 193
194 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { 194 if ((status = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
195 dev_dbg(&I801_dev->dev, "Failed reset at end of transaction " 195 dev_dbg(&I801_dev->dev, "Failed reset at end of transaction "
196 "(%02x)\n", temp); 196 "(%02x)\n", status);
197 } 197 }
198 return result; 198 return result;
199} 199}
@@ -202,18 +202,18 @@ static int i801_transaction(int xact)
202static void i801_wait_hwpec(void) 202static void i801_wait_hwpec(void)
203{ 203{
204 int timeout = 0; 204 int timeout = 0;
205 int temp; 205 int status;
206 206
207 do { 207 do {
208 msleep(1); 208 msleep(1);
209 temp = inb_p(SMBHSTSTS); 209 status = inb_p(SMBHSTSTS);
210 } while ((!(temp & SMBHSTSTS_INTR)) 210 } while ((!(status & SMBHSTSTS_INTR))
211 && (timeout++ < MAX_TIMEOUT)); 211 && (timeout++ < MAX_TIMEOUT));
212 212
213 if (timeout >= MAX_TIMEOUT) { 213 if (timeout >= MAX_TIMEOUT) {
214 dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); 214 dev_dbg(&I801_dev->dev, "PEC Timeout!\n");
215 } 215 }
216 outb_p(temp, SMBHSTSTS); 216 outb_p(status, SMBHSTSTS);
217} 217}
218 218
219static int i801_block_transaction_by_block(union i2c_smbus_data *data, 219static int i801_block_transaction_by_block(union i2c_smbus_data *data,
@@ -255,7 +255,7 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
255{ 255{
256 int i, len; 256 int i, len;
257 int smbcmd; 257 int smbcmd;
258 int temp; 258 int status;
259 int result = 0; 259 int result = 0;
260 int timeout; 260 int timeout;
261 unsigned char errmask; 261 unsigned char errmask;
@@ -283,7 +283,7 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
283 outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT); 283 outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT);
284 284
285 /* Make sure the SMBus host is ready to start transmitting */ 285 /* Make sure the SMBus host is ready to start transmitting */
286 temp = inb_p(SMBHSTSTS); 286 status = inb_p(SMBHSTSTS);
287 if (i == 1) { 287 if (i == 1) {
288 /* Erroneous conditions before transaction: 288 /* Erroneous conditions before transaction:
289 * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ 289 * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
@@ -293,13 +293,13 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
293 * Failed, Bus_Err, Dev_Err, Intr */ 293 * Failed, Bus_Err, Dev_Err, Intr */
294 errmask = 0x1e; 294 errmask = 0x1e;
295 } 295 }
296 if (temp & errmask) { 296 if (status & errmask) {
297 dev_dbg(&I801_dev->dev, "SMBus busy (%02x). " 297 dev_dbg(&I801_dev->dev, "SMBus busy (%02x). "
298 "Resetting...\n", temp); 298 "Resetting...\n", status);
299 outb_p(temp, SMBHSTSTS); 299 outb_p(status, SMBHSTSTS);
300 if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) { 300 if (((status = inb_p(SMBHSTSTS)) & errmask) != 0x00) {
301 dev_err(&I801_dev->dev, 301 dev_err(&I801_dev->dev,
302 "Reset failed! (%02x)\n", temp); 302 "Reset failed! (%02x)\n", status);
303 return -EBUSY; 303 return -EBUSY;
304 } 304 }
305 if (i != 1) 305 if (i != 1)
@@ -314,9 +314,9 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
314 timeout = 0; 314 timeout = 0;
315 do { 315 do {
316 msleep(1); 316 msleep(1);
317 temp = inb_p(SMBHSTSTS); 317 status = inb_p(SMBHSTSTS);
318 } 318 }
319 while ((!(temp & SMBHSTSTS_BYTE_DONE)) 319 while ((!(status & SMBHSTSTS_BYTE_DONE))
320 && (timeout++ < MAX_TIMEOUT)); 320 && (timeout++ < MAX_TIMEOUT));
321 321
322 /* If the SMBus is still busy, we give up */ 322 /* If the SMBus is still busy, we give up */
@@ -332,14 +332,14 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
332 dev_dbg(&I801_dev->dev, "SMBus Timeout!\n"); 332 dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");
333 } 333 }
334 334
335 if (temp & SMBHSTSTS_FAILED) { 335 if (status & SMBHSTSTS_FAILED) {
336 result = -EIO; 336 result = -EIO;
337 dev_dbg(&I801_dev->dev, 337 dev_dbg(&I801_dev->dev,
338 "Error: Failed bus transaction\n"); 338 "Error: Failed bus transaction\n");
339 } else if (temp & SMBHSTSTS_BUS_ERR) { 339 } else if (status & SMBHSTSTS_BUS_ERR) {
340 result = -EAGAIN; 340 result = -EAGAIN;
341 dev_dbg(&I801_dev->dev, "Lost arbitration\n"); 341 dev_dbg(&I801_dev->dev, "Lost arbitration\n");
342 } else if (temp & SMBHSTSTS_DEV_ERR) { 342 } else if (status & SMBHSTSTS_DEV_ERR) {
343 result = -ENXIO; 343 result = -ENXIO;
344 dev_dbg(&I801_dev->dev, "Error: no response!\n"); 344 dev_dbg(&I801_dev->dev, "Error: no response!\n");
345 } 345 }
@@ -357,13 +357,13 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
357 data->block[i] = inb_p(SMBBLKDAT); 357 data->block[i] = inb_p(SMBBLKDAT);
358 if (read_write == I2C_SMBUS_WRITE && i+1 <= len) 358 if (read_write == I2C_SMBUS_WRITE && i+1 <= len)
359 outb_p(data->block[i+1], SMBBLKDAT); 359 outb_p(data->block[i+1], SMBBLKDAT);
360 if ((temp & 0x9e) != 0x00) 360 if ((status & 0x9e) != 0x00)
361 outb_p(temp, SMBHSTSTS); /* signals SMBBLKDAT ready */ 361 outb_p(status, SMBHSTSTS); /* signals SMBBLKDAT ready */
362 362
363 if ((temp = (0x1e & inb_p(SMBHSTSTS))) != 0x00) { 363 if ((status = (0x1e & inb_p(SMBHSTSTS))) != 0x00) {
364 dev_dbg(&I801_dev->dev, 364 dev_dbg(&I801_dev->dev,
365 "Bad status (%02x) at end of transaction\n", 365 "Bad status (%02x) at end of transaction\n",
366 temp); 366 status);
367 } 367 }
368 368
369 if (result < 0) 369 if (result < 0)