diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 2 | ||||
-rw-r--r-- | drivers/i2c/algos/i2c-algo-pca.c | 11 | ||||
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ali1535.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ali15x3.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-amd756.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-cpm.c | 16 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 8 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-isch.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 34 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-nforce2.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sis5595.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sis630.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sis96x.c | 2 |
15 files changed, 57 insertions, 40 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index d420cc5f5633..e25e13980af3 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap) | |||
104 | * chips may hold it low ("clock stretching") while they | 104 | * chips may hold it low ("clock stretching") while they |
105 | * are processing data internally. | 105 | * are processing data internally. |
106 | */ | 106 | */ |
107 | if (time_after_eq(jiffies, start + adap->timeout)) | 107 | if (time_after(jiffies, start + adap->timeout)) |
108 | return -ETIMEDOUT; | 108 | return -ETIMEDOUT; |
109 | cond_resched(); | 109 | cond_resched(); |
110 | } | 110 | } |
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index 6318f7ddc1d4..78d42aae0089 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -287,10 +287,21 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
287 | 287 | ||
288 | case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */ | 288 | case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */ |
289 | DEB2("NOT ACK received after data byte\n"); | 289 | DEB2("NOT ACK received after data byte\n"); |
290 | pca_stop(adap); | ||
290 | goto out; | 291 | goto out; |
291 | 292 | ||
292 | case 0x38: /* Arbitration lost during SLA+W, SLA+R or data bytes */ | 293 | case 0x38: /* Arbitration lost during SLA+W, SLA+R or data bytes */ |
293 | DEB2("Arbitration lost\n"); | 294 | DEB2("Arbitration lost\n"); |
295 | /* | ||
296 | * The PCA9564 data sheet (2006-09-01) says "A | ||
297 | * START condition will be transmitted when the | ||
298 | * bus becomes free (STOP or SCL and SDA high)" | ||
299 | * when the STA bit is set (p. 11). | ||
300 | * | ||
301 | * In case this won't work, try pca_reset() | ||
302 | * instead. | ||
303 | */ | ||
304 | pca_start(adap); | ||
294 | goto out; | 305 | goto out; |
295 | 306 | ||
296 | case 0x58: /* Data byte has been received; NOT ACK has been returned */ | 307 | case 0x58: /* Data byte has been received; NOT ACK has been returned */ |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index a48c8aee0218..f1c6ca7e2852 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -467,7 +467,7 @@ config I2C_PXA_SLAVE | |||
467 | 467 | ||
468 | config I2C_S3C2410 | 468 | config I2C_S3C2410 |
469 | tristate "S3C2410 I2C Driver" | 469 | tristate "S3C2410 I2C Driver" |
470 | depends on ARCH_S3C2410 | 470 | depends on ARCH_S3C2410 || ARCH_S3C64XX |
471 | help | 471 | help |
472 | Say Y here to include support for I2C controller in the | 472 | Say Y here to include support for I2C controller in the |
473 | Samsung S3C2410 based System-on-Chip devices. | 473 | Samsung S3C2410 based System-on-Chip devices. |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index 981e080b32ae..d108450df064 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -284,7 +284,7 @@ static int ali1535_transaction(struct i2c_adapter *adap) | |||
284 | && (timeout++ < MAX_TIMEOUT)); | 284 | && (timeout++ < MAX_TIMEOUT)); |
285 | 285 | ||
286 | /* If the SMBus is still busy, we give up */ | 286 | /* If the SMBus is still busy, we give up */ |
287 | if (timeout >= MAX_TIMEOUT) { | 287 | if (timeout > MAX_TIMEOUT) { |
288 | result = -ETIMEDOUT; | 288 | result = -ETIMEDOUT; |
289 | dev_err(&adap->dev, "SMBus Timeout!\n"); | 289 | dev_err(&adap->dev, "SMBus Timeout!\n"); |
290 | } | 290 | } |
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 39066dee46e3..d627fceb790b 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -306,7 +306,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap) | |||
306 | && (timeout++ < MAX_TIMEOUT)); | 306 | && (timeout++ < MAX_TIMEOUT)); |
307 | 307 | ||
308 | /* If the SMBus is still busy, we give up */ | 308 | /* If the SMBus is still busy, we give up */ |
309 | if (timeout >= MAX_TIMEOUT) { | 309 | if (timeout > MAX_TIMEOUT) { |
310 | result = -ETIMEDOUT; | 310 | result = -ETIMEDOUT; |
311 | dev_err(&adap->dev, "SMBus Timeout!\n"); | 311 | dev_err(&adap->dev, "SMBus Timeout!\n"); |
312 | } | 312 | } |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 220f4a1eee1d..f7d6fe9c49ba 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -126,7 +126,7 @@ static int amd756_transaction(struct i2c_adapter *adap) | |||
126 | } while ((temp & (GS_HST_STS | GS_SMB_STS)) && | 126 | } while ((temp & (GS_HST_STS | GS_SMB_STS)) && |
127 | (timeout++ < MAX_TIMEOUT)); | 127 | (timeout++ < MAX_TIMEOUT)); |
128 | /* If the SMBus is still busy, we give up */ | 128 | /* If the SMBus is still busy, we give up */ |
129 | if (timeout >= MAX_TIMEOUT) { | 129 | if (timeout > MAX_TIMEOUT) { |
130 | dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp); | 130 | dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp); |
131 | goto abort; | 131 | goto abort; |
132 | } | 132 | } |
@@ -143,7 +143,7 @@ static int amd756_transaction(struct i2c_adapter *adap) | |||
143 | } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT)); | 143 | } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT)); |
144 | 144 | ||
145 | /* If the SMBus is still busy, we give up */ | 145 | /* If the SMBus is still busy, we give up */ |
146 | if (timeout >= MAX_TIMEOUT) { | 146 | if (timeout > MAX_TIMEOUT) { |
147 | dev_dbg(&adap->dev, "Completion timeout!\n"); | 147 | dev_dbg(&adap->dev, "Completion timeout!\n"); |
148 | goto abort; | 148 | goto abort; |
149 | } | 149 | } |
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 3fcf78e906db..b5db8b883615 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -531,16 +531,16 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
531 | rbdf = cpm->rbase; | 531 | rbdf = cpm->rbase; |
532 | 532 | ||
533 | for (i = 0; i < CPM_MAXBD; i++) { | 533 | for (i = 0; i < CPM_MAXBD; i++) { |
534 | cpm->rxbuf[i] = dma_alloc_coherent( | 534 | cpm->rxbuf[i] = dma_alloc_coherent(&cpm->ofdev->dev, |
535 | NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL); | 535 | CPM_MAX_READ + 1, |
536 | &cpm->rxdma[i], GFP_KERNEL); | ||
536 | if (!cpm->rxbuf[i]) { | 537 | if (!cpm->rxbuf[i]) { |
537 | ret = -ENOMEM; | 538 | ret = -ENOMEM; |
538 | goto out_muram; | 539 | goto out_muram; |
539 | } | 540 | } |
540 | out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1)); | 541 | out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1)); |
541 | 542 | ||
542 | cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent( | 543 | cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL); |
543 | NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL); | ||
544 | if (!cpm->txbuf[i]) { | 544 | if (!cpm->txbuf[i]) { |
545 | ret = -ENOMEM; | 545 | ret = -ENOMEM; |
546 | goto out_muram; | 546 | goto out_muram; |
@@ -585,10 +585,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
585 | out_muram: | 585 | out_muram: |
586 | for (i = 0; i < CPM_MAXBD; i++) { | 586 | for (i = 0; i < CPM_MAXBD; i++) { |
587 | if (cpm->rxbuf[i]) | 587 | if (cpm->rxbuf[i]) |
588 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 588 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
589 | cpm->rxbuf[i], cpm->rxdma[i]); | 589 | cpm->rxbuf[i], cpm->rxdma[i]); |
590 | if (cpm->txbuf[i]) | 590 | if (cpm->txbuf[i]) |
591 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 591 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
592 | cpm->txbuf[i], cpm->txdma[i]); | 592 | cpm->txbuf[i], cpm->txdma[i]); |
593 | } | 593 | } |
594 | cpm_muram_free(cpm->dp_addr); | 594 | cpm_muram_free(cpm->dp_addr); |
@@ -619,9 +619,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm) | |||
619 | 619 | ||
620 | /* Free all memory */ | 620 | /* Free all memory */ |
621 | for (i = 0; i < CPM_MAXBD; i++) { | 621 | for (i = 0; i < CPM_MAXBD; i++) { |
622 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 622 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
623 | cpm->rxbuf[i], cpm->rxdma[i]); | 623 | cpm->rxbuf[i], cpm->rxdma[i]); |
624 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 624 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
625 | cpm->txbuf[i], cpm->txdma[i]); | 625 | cpm->txbuf[i], cpm->txdma[i]); |
626 | } | 626 | } |
627 | 627 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 10411848fd70..9d2c5adf5d4f 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -237,7 +237,7 @@ static int i801_transaction(int xact) | |||
237 | status = inb_p(SMBHSTSTS); | 237 | status = inb_p(SMBHSTSTS); |
238 | } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); | 238 | } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); |
239 | 239 | ||
240 | result = i801_check_post(status, timeout >= MAX_TIMEOUT); | 240 | result = i801_check_post(status, timeout > MAX_TIMEOUT); |
241 | if (result < 0) | 241 | if (result < 0) |
242 | return result; | 242 | return result; |
243 | 243 | ||
@@ -257,9 +257,9 @@ static void i801_wait_hwpec(void) | |||
257 | } while ((!(status & SMBHSTSTS_INTR)) | 257 | } while ((!(status & SMBHSTSTS_INTR)) |
258 | && (timeout++ < MAX_TIMEOUT)); | 258 | && (timeout++ < MAX_TIMEOUT)); |
259 | 259 | ||
260 | if (timeout >= MAX_TIMEOUT) { | 260 | if (timeout > MAX_TIMEOUT) |
261 | dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); | 261 | dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); |
262 | } | 262 | |
263 | outb_p(status, SMBHSTSTS); | 263 | outb_p(status, SMBHSTSTS); |
264 | } | 264 | } |
265 | 265 | ||
@@ -344,7 +344,7 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
344 | while ((!(status & SMBHSTSTS_BYTE_DONE)) | 344 | while ((!(status & SMBHSTSTS_BYTE_DONE)) |
345 | && (timeout++ < MAX_TIMEOUT)); | 345 | && (timeout++ < MAX_TIMEOUT)); |
346 | 346 | ||
347 | result = i801_check_post(status, timeout >= MAX_TIMEOUT); | 347 | result = i801_check_post(status, timeout > MAX_TIMEOUT); |
348 | if (result < 0) | 348 | if (result < 0) |
349 | return result; | 349 | return result; |
350 | 350 | ||
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c index b9c01aa90036..9f6b8e0f8632 100644 --- a/drivers/i2c/busses/i2c-isch.c +++ b/drivers/i2c/busses/i2c-isch.c | |||
@@ -112,7 +112,7 @@ static int sch_transaction(void) | |||
112 | } while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT)); | 112 | } while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT)); |
113 | 113 | ||
114 | /* If the SMBus is still busy, we give up */ | 114 | /* If the SMBus is still busy, we give up */ |
115 | if (timeout >= MAX_TIMEOUT) { | 115 | if (timeout > MAX_TIMEOUT) { |
116 | dev_err(&sch_adapter.dev, "SMBus Timeout!\n"); | 116 | dev_err(&sch_adapter.dev, "SMBus Timeout!\n"); |
117 | result = -ETIMEDOUT; | 117 | result = -ETIMEDOUT; |
118 | } | 118 | } |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 4af5c09f0e8f..dd778d7ae047 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -164,7 +164,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | #ifdef CONFIG_PPC_52xx | 167 | #ifdef CONFIG_PPC_MPC52xx |
168 | static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { | 168 | static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { |
169 | {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, | 169 | {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, |
170 | {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, | 170 | {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, |
@@ -188,7 +188,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { | |||
188 | 188 | ||
189 | int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) | 189 | int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) |
190 | { | 190 | { |
191 | const struct mpc52xx_i2c_divider *div = NULL; | 191 | const struct mpc_i2c_divider *div = NULL; |
192 | unsigned int pvr = mfspr(SPRN_PVR); | 192 | unsigned int pvr = mfspr(SPRN_PVR); |
193 | u32 divider; | 193 | u32 divider; |
194 | int i; | 194 | int i; |
@@ -203,7 +203,7 @@ int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) | |||
203 | * We want to choose an FDR/DFSR that generates an I2C bus speed that | 203 | * We want to choose an FDR/DFSR that generates an I2C bus speed that |
204 | * is equal to or lower than the requested speed. | 204 | * is equal to or lower than the requested speed. |
205 | */ | 205 | */ |
206 | for (i = 0; i < ARRAY_SIZE(mpc52xx_i2c_dividers); i++) { | 206 | for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) { |
207 | div = &mpc_i2c_dividers_52xx[i]; | 207 | div = &mpc_i2c_dividers_52xx[i]; |
208 | /* Old MPC5200 rev A CPUs do not support the high bits */ | 208 | /* Old MPC5200 rev A CPUs do not support the high bits */ |
209 | if (div->fdr & 0xc0 && pvr == 0x80822011) | 209 | if (div->fdr & 0xc0 && pvr == 0x80822011) |
@@ -219,20 +219,23 @@ static void mpc_i2c_setclock_52xx(struct device_node *node, | |||
219 | struct mpc_i2c *i2c, | 219 | struct mpc_i2c *i2c, |
220 | u32 clock, u32 prescaler) | 220 | u32 clock, u32 prescaler) |
221 | { | 221 | { |
222 | int fdr = mpc52xx_i2c_get_fdr(node, clock, prescaler); | 222 | int ret, fdr; |
223 | |||
224 | ret = mpc_i2c_get_fdr_52xx(node, clock, prescaler); | ||
225 | fdr = (ret >= 0) ? ret : 0x3f; /* backward compatibility */ | ||
223 | 226 | ||
224 | if (fdr < 0) | ||
225 | fdr = 0x3f; /* backward compatibility */ | ||
226 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); | 227 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); |
227 | dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr); | 228 | |
229 | if (ret >= 0) | ||
230 | dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr); | ||
228 | } | 231 | } |
229 | #else /* !CONFIG_PPC_52xx */ | 232 | #else /* !CONFIG_PPC_MPC52xx */ |
230 | static void mpc_i2c_setclock_52xx(struct device_node *node, | 233 | static void mpc_i2c_setclock_52xx(struct device_node *node, |
231 | struct mpc_i2c *i2c, | 234 | struct mpc_i2c *i2c, |
232 | u32 clock, u32 prescaler) | 235 | u32 clock, u32 prescaler) |
233 | { | 236 | { |
234 | } | 237 | } |
235 | #endif /* CONFIG_PPC_52xx*/ | 238 | #endif /* CONFIG_PPC_MPC52xx*/ |
236 | 239 | ||
237 | #ifdef CONFIG_FSL_SOC | 240 | #ifdef CONFIG_FSL_SOC |
238 | static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = { | 241 | static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = { |
@@ -321,14 +324,17 @@ static void mpc_i2c_setclock_8xxx(struct device_node *node, | |||
321 | struct mpc_i2c *i2c, | 324 | struct mpc_i2c *i2c, |
322 | u32 clock, u32 prescaler) | 325 | u32 clock, u32 prescaler) |
323 | { | 326 | { |
324 | int fdr = mpc_i2c_get_fdr_8xxx(node, clock, prescaler); | 327 | int ret, fdr; |
328 | |||
329 | ret = mpc_i2c_get_fdr_8xxx(node, clock, prescaler); | ||
330 | fdr = (ret >= 0) ? ret : 0x1031; /* backward compatibility */ | ||
325 | 331 | ||
326 | if (fdr < 0) | ||
327 | fdr = 0x1031; /* backward compatibility */ | ||
328 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); | 332 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); |
329 | writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR); | 333 | writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR); |
330 | dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n", | 334 | |
331 | clock, fdr >> 8, fdr & 0xff); | 335 | if (ret >= 0) |
336 | dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n", | ||
337 | clock, fdr >> 8, fdr & 0xff); | ||
332 | } | 338 | } |
333 | 339 | ||
334 | #else /* !CONFIG_FSL_SOC */ | 340 | #else /* !CONFIG_FSL_SOC */ |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 2ff4683703a8..ec11d1c4e77b 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -173,7 +173,7 @@ static int nforce2_check_status(struct i2c_adapter *adap) | |||
173 | temp = inb_p(NVIDIA_SMB_STS); | 173 | temp = inb_p(NVIDIA_SMB_STS); |
174 | } while ((!temp) && (timeout++ < MAX_TIMEOUT)); | 174 | } while ((!temp) && (timeout++ < MAX_TIMEOUT)); |
175 | 175 | ||
176 | if (timeout >= MAX_TIMEOUT) { | 176 | if (timeout > MAX_TIMEOUT) { |
177 | dev_dbg(&adap->dev, "SMBus Timeout!\n"); | 177 | dev_dbg(&adap->dev, "SMBus Timeout!\n"); |
178 | if (smbus->can_abort) | 178 | if (smbus->can_abort) |
179 | nforce2_abort(adap); | 179 | nforce2_abort(adap); |
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index c1405c8f6ba5..acc7143d9655 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -265,10 +265,10 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c) | |||
265 | show_state(i2c); | 265 | show_state(i2c); |
266 | } | 266 | } |
267 | 267 | ||
268 | if (timeout <= 0) | 268 | if (timeout < 0) |
269 | show_state(i2c); | 269 | show_state(i2c); |
270 | 270 | ||
271 | return timeout <= 0 ? I2C_RETRY : 0; | 271 | return timeout < 0 ? I2C_RETRY : 0; |
272 | } | 272 | } |
273 | 273 | ||
274 | static int i2c_pxa_wait_master(struct pxa_i2c *i2c) | 274 | static int i2c_pxa_wait_master(struct pxa_i2c *i2c) |
@@ -612,7 +612,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) | |||
612 | show_state(i2c); | 612 | show_state(i2c); |
613 | } | 613 | } |
614 | 614 | ||
615 | if (timeout <= 0) { | 615 | if (timeout < 0) { |
616 | show_state(i2c); | 616 | show_state(i2c); |
617 | dev_err(&i2c->adap.dev, | 617 | dev_err(&i2c->adap.dev, |
618 | "i2c_pxa: timeout waiting for bus free\n"); | 618 | "i2c_pxa: timeout waiting for bus free\n"); |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index f320ab27da46..139f0c7f12a4 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -256,7 +256,7 @@ static int sis5595_transaction(struct i2c_adapter *adap) | |||
256 | } while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT)); | 256 | } while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT)); |
257 | 257 | ||
258 | /* If the SMBus is still busy, we give up */ | 258 | /* If the SMBus is still busy, we give up */ |
259 | if (timeout >= MAX_TIMEOUT) { | 259 | if (timeout > MAX_TIMEOUT) { |
260 | dev_dbg(&adap->dev, "SMBus Timeout!\n"); | 260 | dev_dbg(&adap->dev, "SMBus Timeout!\n"); |
261 | result = -ETIMEDOUT; | 261 | result = -ETIMEDOUT; |
262 | } | 262 | } |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 50c3610e6028..70ca41e90e58 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -173,7 +173,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size) | |||
173 | } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); | 173 | } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); |
174 | 174 | ||
175 | /* If the SMBus is still busy, we give up */ | 175 | /* If the SMBus is still busy, we give up */ |
176 | if (timeout >= MAX_TIMEOUT) { | 176 | if (timeout > MAX_TIMEOUT) { |
177 | dev_dbg(&adap->dev, "SMBus Timeout!\n"); | 177 | dev_dbg(&adap->dev, "SMBus Timeout!\n"); |
178 | result = -ETIMEDOUT; | 178 | result = -ETIMEDOUT; |
179 | } | 179 | } |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 7e1594b40579..8295885b2fdb 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -132,7 +132,7 @@ static int sis96x_transaction(int size) | |||
132 | } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); | 132 | } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); |
133 | 133 | ||
134 | /* If the SMBus is still busy, we give up */ | 134 | /* If the SMBus is still busy, we give up */ |
135 | if (timeout >= MAX_TIMEOUT) { | 135 | if (timeout > MAX_TIMEOUT) { |
136 | dev_dbg(&sis96x_adapter.dev, "SMBus Timeout! (0x%02x)\n", temp); | 136 | dev_dbg(&sis96x_adapter.dev, "SMBus Timeout! (0x%02x)\n", temp); |
137 | result = -ETIMEDOUT; | 137 | result = -ETIMEDOUT; |
138 | } | 138 | } |