diff options
Diffstat (limited to 'drivers/i2c')
| -rw-r--r-- | drivers/i2c/busses/i2c-ali1563.c | 8 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 26 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-pca-isa.c | 4 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-pca-platform.c | 4 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 4 | ||||
| -rw-r--r-- | drivers/i2c/busses/i2c-viapro.c | 4 | ||||
| -rw-r--r-- | drivers/i2c/i2c-core.c | 7 |
7 files changed, 30 insertions, 27 deletions
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index f70f46582c6c..4687af40dd50 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
| @@ -87,9 +87,9 @@ static int ali1563_transaction(struct i2c_adapter * a, int size) | |||
| 87 | outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); | 87 | outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); |
| 88 | 88 | ||
| 89 | timeout = ALI1563_MAX_TIMEOUT; | 89 | timeout = ALI1563_MAX_TIMEOUT; |
| 90 | do | 90 | do { |
| 91 | msleep(1); | 91 | msleep(1); |
| 92 | while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout); | 92 | } while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout); |
| 93 | 93 | ||
| 94 | dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, " | 94 | dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, " |
| 95 | "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", | 95 | "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", |
| @@ -157,9 +157,9 @@ static int ali1563_block_start(struct i2c_adapter * a) | |||
| 157 | outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); | 157 | outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); |
| 158 | 158 | ||
| 159 | timeout = ALI1563_MAX_TIMEOUT; | 159 | timeout = ALI1563_MAX_TIMEOUT; |
| 160 | do | 160 | do { |
| 161 | msleep(1); | 161 | msleep(1); |
| 162 | while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout); | 162 | } while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout); |
| 163 | 163 | ||
| 164 | dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, " | 164 | dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, " |
| 165 | "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", | 165 | "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index e3654d683e15..75bf820e7ccb 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
| @@ -226,7 +226,6 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) | |||
| 226 | temp = readb(i2c_imx->base + IMX_I2C_I2CR); | 226 | temp = readb(i2c_imx->base + IMX_I2C_I2CR); |
| 227 | temp &= ~(I2CR_MSTA | I2CR_MTX); | 227 | temp &= ~(I2CR_MSTA | I2CR_MTX); |
| 228 | writeb(temp, i2c_imx->base + IMX_I2C_I2CR); | 228 | writeb(temp, i2c_imx->base + IMX_I2C_I2CR); |
| 229 | i2c_imx->stopped = 1; | ||
| 230 | } | 229 | } |
| 231 | if (cpu_is_mx1()) { | 230 | if (cpu_is_mx1()) { |
| 232 | /* | 231 | /* |
| @@ -236,8 +235,10 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) | |||
| 236 | udelay(i2c_imx->disable_delay); | 235 | udelay(i2c_imx->disable_delay); |
| 237 | } | 236 | } |
| 238 | 237 | ||
| 239 | if (!i2c_imx->stopped) | 238 | if (!i2c_imx->stopped) { |
| 240 | i2c_imx_bus_busy(i2c_imx, 0); | 239 | i2c_imx_bus_busy(i2c_imx, 0); |
| 240 | i2c_imx->stopped = 1; | ||
| 241 | } | ||
| 241 | 242 | ||
| 242 | /* Disable I2C controller */ | 243 | /* Disable I2C controller */ |
| 243 | writeb(0, i2c_imx->base + IMX_I2C_I2CR); | 244 | writeb(0, i2c_imx->base + IMX_I2C_I2CR); |
| @@ -496,22 +497,23 @@ static int __init i2c_imx_probe(struct platform_device *pdev) | |||
| 496 | } | 497 | } |
| 497 | 498 | ||
| 498 | res_size = resource_size(res); | 499 | res_size = resource_size(res); |
| 500 | |||
| 501 | if (!request_mem_region(res->start, res_size, DRIVER_NAME)) { | ||
| 502 | ret = -EBUSY; | ||
| 503 | goto fail0; | ||
| 504 | } | ||
| 505 | |||
| 499 | base = ioremap(res->start, res_size); | 506 | base = ioremap(res->start, res_size); |
| 500 | if (!base) { | 507 | if (!base) { |
| 501 | dev_err(&pdev->dev, "ioremap failed\n"); | 508 | dev_err(&pdev->dev, "ioremap failed\n"); |
| 502 | ret = -EIO; | 509 | ret = -EIO; |
| 503 | goto fail0; | 510 | goto fail1; |
| 504 | } | 511 | } |
| 505 | 512 | ||
| 506 | i2c_imx = kzalloc(sizeof(struct imx_i2c_struct), GFP_KERNEL); | 513 | i2c_imx = kzalloc(sizeof(struct imx_i2c_struct), GFP_KERNEL); |
| 507 | if (!i2c_imx) { | 514 | if (!i2c_imx) { |
| 508 | dev_err(&pdev->dev, "can't allocate interface\n"); | 515 | dev_err(&pdev->dev, "can't allocate interface\n"); |
| 509 | ret = -ENOMEM; | 516 | ret = -ENOMEM; |
| 510 | goto fail1; | ||
| 511 | } | ||
| 512 | |||
| 513 | if (!request_mem_region(res->start, res_size, DRIVER_NAME)) { | ||
| 514 | ret = -EBUSY; | ||
| 515 | goto fail2; | 517 | goto fail2; |
| 516 | } | 518 | } |
| 517 | 519 | ||
| @@ -582,11 +584,11 @@ fail5: | |||
| 582 | fail4: | 584 | fail4: |
| 583 | clk_put(i2c_imx->clk); | 585 | clk_put(i2c_imx->clk); |
| 584 | fail3: | 586 | fail3: |
| 585 | release_mem_region(i2c_imx->res->start, resource_size(res)); | ||
| 586 | fail2: | ||
| 587 | kfree(i2c_imx); | 587 | kfree(i2c_imx); |
| 588 | fail1: | 588 | fail2: |
| 589 | iounmap(base); | 589 | iounmap(base); |
| 590 | fail1: | ||
| 591 | release_mem_region(res->start, resource_size(res)); | ||
| 590 | fail0: | 592 | fail0: |
| 591 | if (pdata && pdata->exit) | 593 | if (pdata && pdata->exit) |
| 592 | pdata->exit(&pdev->dev); | 594 | pdata->exit(&pdev->dev); |
| @@ -618,8 +620,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev) | |||
| 618 | 620 | ||
| 619 | clk_put(i2c_imx->clk); | 621 | clk_put(i2c_imx->clk); |
| 620 | 622 | ||
| 621 | release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res)); | ||
| 622 | iounmap(i2c_imx->base); | 623 | iounmap(i2c_imx->base); |
| 624 | release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res)); | ||
| 623 | kfree(i2c_imx); | 625 | kfree(i2c_imx); |
| 624 | return 0; | 626 | return 0; |
| 625 | } | 627 | } |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index 0ed68e2ccd22..f7346a9bd95f 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
| @@ -75,7 +75,7 @@ static int pca_isa_waitforcompletion(void *pd) | |||
| 75 | unsigned long timeout; | 75 | unsigned long timeout; |
| 76 | 76 | ||
| 77 | if (irq > -1) { | 77 | if (irq > -1) { |
| 78 | ret = wait_event_interruptible_timeout(pca_wait, | 78 | ret = wait_event_timeout(pca_wait, |
| 79 | pca_isa_readbyte(pd, I2C_PCA_CON) | 79 | pca_isa_readbyte(pd, I2C_PCA_CON) |
| 80 | & I2C_PCA_CON_SI, pca_isa_ops.timeout); | 80 | & I2C_PCA_CON_SI, pca_isa_ops.timeout); |
| 81 | } else { | 81 | } else { |
| @@ -96,7 +96,7 @@ static void pca_isa_resetchip(void *pd) | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | static irqreturn_t pca_handler(int this_irq, void *dev_id) { | 98 | static irqreturn_t pca_handler(int this_irq, void *dev_id) { |
| 99 | wake_up_interruptible(&pca_wait); | 99 | wake_up(&pca_wait); |
| 100 | return IRQ_HANDLED; | 100 | return IRQ_HANDLED; |
| 101 | } | 101 | } |
| 102 | 102 | ||
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index c4df9d411cd5..5b2213df5ed0 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
| @@ -84,7 +84,7 @@ static int i2c_pca_pf_waitforcompletion(void *pd) | |||
| 84 | unsigned long timeout; | 84 | unsigned long timeout; |
| 85 | 85 | ||
| 86 | if (i2c->irq) { | 86 | if (i2c->irq) { |
| 87 | ret = wait_event_interruptible_timeout(i2c->wait, | 87 | ret = wait_event_timeout(i2c->wait, |
| 88 | i2c->algo_data.read_byte(i2c, I2C_PCA_CON) | 88 | i2c->algo_data.read_byte(i2c, I2C_PCA_CON) |
| 89 | & I2C_PCA_CON_SI, i2c->adap.timeout); | 89 | & I2C_PCA_CON_SI, i2c->adap.timeout); |
| 90 | } else { | 90 | } else { |
| @@ -122,7 +122,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id) | |||
| 122 | if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0) | 122 | if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0) |
| 123 | return IRQ_NONE; | 123 | return IRQ_NONE; |
| 124 | 124 | ||
| 125 | wake_up_interruptible(&i2c->wait); | 125 | wake_up(&i2c->wait); |
| 126 | 126 | ||
| 127 | return IRQ_HANDLED; | 127 | return IRQ_HANDLED; |
| 128 | } | 128 | } |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 1e245e9cad31..e56e4b6823ca 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
| @@ -324,12 +324,12 @@ static int piix4_transaction(void) | |||
| 324 | else | 324 | else |
| 325 | msleep(1); | 325 | msleep(1); |
| 326 | 326 | ||
| 327 | while ((timeout++ < MAX_TIMEOUT) && | 327 | while ((++timeout < MAX_TIMEOUT) && |
| 328 | ((temp = inb_p(SMBHSTSTS)) & 0x01)) | 328 | ((temp = inb_p(SMBHSTSTS)) & 0x01)) |
| 329 | msleep(1); | 329 | msleep(1); |
| 330 | 330 | ||
| 331 | /* If the SMBus is still busy, we give up */ | 331 | /* If the SMBus is still busy, we give up */ |
| 332 | if (timeout >= MAX_TIMEOUT) { | 332 | if (timeout == MAX_TIMEOUT) { |
| 333 | dev_err(&piix4_adapter.dev, "SMBus Timeout!\n"); | 333 | dev_err(&piix4_adapter.dev, "SMBus Timeout!\n"); |
| 334 | result = -ETIMEDOUT; | 334 | result = -ETIMEDOUT; |
| 335 | } | 335 | } |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index e4b1543015af..a84a909e1234 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
| @@ -165,10 +165,10 @@ static int vt596_transaction(u8 size) | |||
| 165 | do { | 165 | do { |
| 166 | msleep(1); | 166 | msleep(1); |
| 167 | temp = inb_p(SMBHSTSTS); | 167 | temp = inb_p(SMBHSTSTS); |
| 168 | } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); | 168 | } while ((temp & 0x01) && (++timeout < MAX_TIMEOUT)); |
| 169 | 169 | ||
| 170 | /* If the SMBus is still busy, we give up */ | 170 | /* If the SMBus is still busy, we give up */ |
| 171 | if (timeout >= MAX_TIMEOUT) { | 171 | if (timeout == MAX_TIMEOUT) { |
| 172 | result = -ETIMEDOUT; | 172 | result = -ETIMEDOUT; |
| 173 | dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); | 173 | dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); |
| 174 | } | 174 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 0ac2f90ab840..10be7b5fbe97 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -248,7 +248,7 @@ static const struct attribute_group *i2c_dev_attr_groups[] = { | |||
| 248 | NULL | 248 | NULL |
| 249 | }; | 249 | }; |
| 250 | 250 | ||
| 251 | const static struct dev_pm_ops i2c_device_pm_ops = { | 251 | static const struct dev_pm_ops i2c_device_pm_ops = { |
| 252 | .suspend = i2c_device_pm_suspend, | 252 | .suspend = i2c_device_pm_suspend, |
| 253 | .resume = i2c_device_pm_resume, | 253 | .resume = i2c_device_pm_resume, |
| 254 | }; | 254 | }; |
| @@ -843,6 +843,9 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 843 | adap->dev.parent); | 843 | adap->dev.parent); |
| 844 | #endif | 844 | #endif |
| 845 | 845 | ||
| 846 | /* device name is gone after device_unregister */ | ||
| 847 | dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); | ||
| 848 | |||
| 846 | /* clean up the sysfs representation */ | 849 | /* clean up the sysfs representation */ |
| 847 | init_completion(&adap->dev_released); | 850 | init_completion(&adap->dev_released); |
| 848 | device_unregister(&adap->dev); | 851 | device_unregister(&adap->dev); |
| @@ -855,8 +858,6 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 855 | idr_remove(&i2c_adapter_idr, adap->nr); | 858 | idr_remove(&i2c_adapter_idr, adap->nr); |
| 856 | mutex_unlock(&core_lock); | 859 | mutex_unlock(&core_lock); |
| 857 | 860 | ||
| 858 | dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); | ||
| 859 | |||
| 860 | /* Clear the device structure in case this adapter is ever going to be | 861 | /* Clear the device structure in case this adapter is ever going to be |
| 861 | added again */ | 862 | added again */ |
| 862 | memset(&adap->dev, 0, sizeof(adap->dev)); | 863 | memset(&adap->dev, 0, sizeof(adap->dev)); |
