Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
i2c: Do not use device name after device_unregister
i2c/pca: Don't use *_interruptible
i2c-ali1563: Remove sparse warnings
i2c: Test off by one in {piix4,vt596}_transaction()
i2c-core: Storage class should be before const qualifier

+16 -15
+4 -4
drivers/i2c/busses/i2c-ali1563.c
··· 87 outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); 88 89 timeout = ALI1563_MAX_TIMEOUT; 90 - do 91 msleep(1); 92 - while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout); 93 94 dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, " 95 "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", ··· 157 outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); 158 159 timeout = ALI1563_MAX_TIMEOUT; 160 - do 161 msleep(1); 162 - while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout); 163 164 dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, " 165 "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
··· 87 outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); 88 89 timeout = ALI1563_MAX_TIMEOUT; 90 + do { 91 msleep(1); 92 + } while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout); 93 94 dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, " 95 "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", ··· 157 outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); 158 159 timeout = ALI1563_MAX_TIMEOUT; 160 + do { 161 msleep(1); 162 + } while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout); 163 164 dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, " 165 "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
+2 -2
drivers/i2c/busses/i2c-pca-isa.c
··· 75 unsigned long timeout; 76 77 if (irq > -1) { 78 - ret = wait_event_interruptible_timeout(pca_wait, 79 pca_isa_readbyte(pd, I2C_PCA_CON) 80 & I2C_PCA_CON_SI, pca_isa_ops.timeout); 81 } else { ··· 96 } 97 98 static irqreturn_t pca_handler(int this_irq, void *dev_id) { 99 - wake_up_interruptible(&pca_wait); 100 return IRQ_HANDLED; 101 } 102
··· 75 unsigned long timeout; 76 77 if (irq > -1) { 78 + ret = wait_event_timeout(pca_wait, 79 pca_isa_readbyte(pd, I2C_PCA_CON) 80 & I2C_PCA_CON_SI, pca_isa_ops.timeout); 81 } else { ··· 96 } 97 98 static irqreturn_t pca_handler(int this_irq, void *dev_id) { 99 + wake_up(&pca_wait); 100 return IRQ_HANDLED; 101 } 102
+2 -2
drivers/i2c/busses/i2c-pca-platform.c
··· 84 unsigned long timeout; 85 86 if (i2c->irq) { 87 - ret = wait_event_interruptible_timeout(i2c->wait, 88 i2c->algo_data.read_byte(i2c, I2C_PCA_CON) 89 & I2C_PCA_CON_SI, i2c->adap.timeout); 90 } else { ··· 122 if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0) 123 return IRQ_NONE; 124 125 - wake_up_interruptible(&i2c->wait); 126 127 return IRQ_HANDLED; 128 }
··· 84 unsigned long timeout; 85 86 if (i2c->irq) { 87 + ret = wait_event_timeout(i2c->wait, 88 i2c->algo_data.read_byte(i2c, I2C_PCA_CON) 89 & I2C_PCA_CON_SI, i2c->adap.timeout); 90 } else { ··· 122 if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0) 123 return IRQ_NONE; 124 125 + wake_up(&i2c->wait); 126 127 return IRQ_HANDLED; 128 }
+2 -2
drivers/i2c/busses/i2c-piix4.c
··· 324 else 325 msleep(1); 326 327 - while ((timeout++ < MAX_TIMEOUT) && 328 ((temp = inb_p(SMBHSTSTS)) & 0x01)) 329 msleep(1); 330 331 /* If the SMBus is still busy, we give up */ 332 - if (timeout >= MAX_TIMEOUT) { 333 dev_err(&piix4_adapter.dev, "SMBus Timeout!\n"); 334 result = -ETIMEDOUT; 335 }
··· 324 else 325 msleep(1); 326 327 + while ((++timeout < MAX_TIMEOUT) && 328 ((temp = inb_p(SMBHSTSTS)) & 0x01)) 329 msleep(1); 330 331 /* If the SMBus is still busy, we give up */ 332 + if (timeout == MAX_TIMEOUT) { 333 dev_err(&piix4_adapter.dev, "SMBus Timeout!\n"); 334 result = -ETIMEDOUT; 335 }
+2 -2
drivers/i2c/busses/i2c-viapro.c
··· 165 do { 166 msleep(1); 167 temp = inb_p(SMBHSTSTS); 168 - } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); 169 170 /* If the SMBus is still busy, we give up */ 171 - if (timeout >= MAX_TIMEOUT) { 172 result = -ETIMEDOUT; 173 dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); 174 }
··· 165 do { 166 msleep(1); 167 temp = inb_p(SMBHSTSTS); 168 + } while ((temp & 0x01) && (++timeout < MAX_TIMEOUT)); 169 170 /* If the SMBus is still busy, we give up */ 171 + if (timeout == MAX_TIMEOUT) { 172 result = -ETIMEDOUT; 173 dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); 174 }
+4 -3
drivers/i2c/i2c-core.c
··· 248 NULL 249 }; 250 251 - const static struct dev_pm_ops i2c_device_pm_ops = { 252 .suspend = i2c_device_pm_suspend, 253 .resume = i2c_device_pm_resume, 254 }; ··· 843 adap->dev.parent); 844 #endif 845 846 /* clean up the sysfs representation */ 847 init_completion(&adap->dev_released); 848 device_unregister(&adap->dev); ··· 857 mutex_lock(&core_lock); 858 idr_remove(&i2c_adapter_idr, adap->nr); 859 mutex_unlock(&core_lock); 860 - 861 - dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); 862 863 /* Clear the device structure in case this adapter is ever going to be 864 added again */
··· 248 NULL 249 }; 250 251 + static const struct dev_pm_ops i2c_device_pm_ops = { 252 .suspend = i2c_device_pm_suspend, 253 .resume = i2c_device_pm_resume, 254 }; ··· 843 adap->dev.parent); 844 #endif 845 846 + /* device name is gone after device_unregister */ 847 + dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); 848 + 849 /* clean up the sysfs representation */ 850 init_completion(&adap->dev_released); 851 device_unregister(&adap->dev); ··· 854 mutex_lock(&core_lock); 855 idr_remove(&i2c_adapter_idr, adap->nr); 856 mutex_unlock(&core_lock); 857 858 /* Clear the device structure in case this adapter is ever going to be 859 added again */