Skip to content

Commit

Permalink
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/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
  • Loading branch information
Linus Torvalds committed Jan 16, 2010
2 parents 330a518 + c556752 commit 1f0b8b9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions drivers/i2c/busses/i2c-ali1563.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ static int ali1563_transaction(struct i2c_adapter * a, int size)
outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2);

timeout = ALI1563_MAX_TIMEOUT;
do
do {
msleep(1);
while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);
} while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);

dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
Expand Down Expand Up @@ -157,9 +157,9 @@ static int ali1563_block_start(struct i2c_adapter * a)
outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2);

timeout = ALI1563_MAX_TIMEOUT;
do
do {
msleep(1);
while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);
} while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);

dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, "
"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-pca-isa.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static int pca_isa_waitforcompletion(void *pd)
unsigned long timeout;

if (irq > -1) {
ret = wait_event_interruptible_timeout(pca_wait,
ret = wait_event_timeout(pca_wait,
pca_isa_readbyte(pd, I2C_PCA_CON)
& I2C_PCA_CON_SI, pca_isa_ops.timeout);
} else {
Expand All @@ -96,7 +96,7 @@ static void pca_isa_resetchip(void *pd)
}

static irqreturn_t pca_handler(int this_irq, void *dev_id) {
wake_up_interruptible(&pca_wait);
wake_up(&pca_wait);
return IRQ_HANDLED;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-pca-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int i2c_pca_pf_waitforcompletion(void *pd)
unsigned long timeout;

if (i2c->irq) {
ret = wait_event_interruptible_timeout(i2c->wait,
ret = wait_event_timeout(i2c->wait,
i2c->algo_data.read_byte(i2c, I2C_PCA_CON)
& I2C_PCA_CON_SI, i2c->adap.timeout);
} else {
Expand Down Expand Up @@ -122,7 +122,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)
if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0)
return IRQ_NONE;

wake_up_interruptible(&i2c->wait);
wake_up(&i2c->wait);

return IRQ_HANDLED;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-piix4.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ static int piix4_transaction(void)
else
msleep(1);

while ((timeout++ < MAX_TIMEOUT) &&
while ((++timeout < MAX_TIMEOUT) &&
((temp = inb_p(SMBHSTSTS)) & 0x01))
msleep(1);

/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
if (timeout == MAX_TIMEOUT) {
dev_err(&piix4_adapter.dev, "SMBus Timeout!\n");
result = -ETIMEDOUT;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-viapro.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ static int vt596_transaction(u8 size)
do {
msleep(1);
temp = inb_p(SMBHSTSTS);
} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
} while ((temp & 0x01) && (++timeout < MAX_TIMEOUT));

/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
if (timeout == MAX_TIMEOUT) {
result = -ETIMEDOUT;
dev_err(&vt596_adapter.dev, "SMBus timeout!\n");
}
Expand Down
7 changes: 4 additions & 3 deletions drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static const struct attribute_group *i2c_dev_attr_groups[] = {
NULL
};

const static struct dev_pm_ops i2c_device_pm_ops = {
static const struct dev_pm_ops i2c_device_pm_ops = {
.suspend = i2c_device_pm_suspend,
.resume = i2c_device_pm_resume,
};
Expand Down Expand Up @@ -843,6 +843,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
adap->dev.parent);
#endif

/* device name is gone after device_unregister */
dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);

/* clean up the sysfs representation */
init_completion(&adap->dev_released);
device_unregister(&adap->dev);
Expand All @@ -855,8 +858,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
idr_remove(&i2c_adapter_idr, adap->nr);
mutex_unlock(&core_lock);

dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);

/* Clear the device structure in case this adapter is ever going to be
added again */
memset(&adap->dev, 0, sizeof(adap->dev));
Expand Down

0 comments on commit 1f0b8b9

Please sign in to comment.