Loading drivers/i2c/busses/i2c-ali1563.c +45 −37 Original line number Diff line number Diff line Loading @@ -184,7 +184,8 @@ static int ali1563_block_start(struct i2c_adapter * a) return status; } static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8 rw) static int ali1563_block(struct i2c_adapter *a, union i2c_smbus_data *data, u8 rw) { int i, len; int error = 0; Loading @@ -208,10 +209,12 @@ static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8 for (i = 0; i < len; i++) { if (rw == I2C_SMBUS_WRITE) { outb_p(data->block[i + 1], SMB_BLK_DAT); if ((error = ali1563_block_start(a))) error = ali1563_block_start(a); if (error) break; } else { if ((error = ali1563_block_start(a))) error = ali1563_block_start(a); if (error) break; if (i == 0) { len = inb_p(SMB_HST_DAT0); Loading @@ -237,7 +240,8 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr, u32 reg; for (timeout = ALI1563_MAX_TIMEOUT; timeout; timeout--) { if (!(reg = inb_p(SMB_HST_STS) & HST_STS_BUSY)) reg = inb_p(SMB_HST_STS); if (!(reg & HST_STS_BUSY)) break; } if (!timeout) Loading Loading @@ -268,7 +272,8 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr, } outb_p(((addr & 0x7f) << 1) | (rw & 0x01), SMB_HST_ADD); outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2); outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2); /* Write the command register */ Loading Loading @@ -296,7 +301,8 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr, goto Done; } if ((error = ali1563_transaction(a, size))) error = ali1563_transaction(a, size); if (error) goto Done; if ((rw == I2C_SMBUS_WRITE) || (size == HST_CNTL2_QUICK)) Loading Loading @@ -350,8 +356,8 @@ static int ali1563_setup(struct pci_dev *dev) ctrl | ALI1563_SMB_IOEN); pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); if (!(ctrl & ALI1563_SMB_IOEN)) { dev_err(&dev->dev, "I/O space still not enabled, " "giving up\n"); dev_err(&dev->dev, "I/O space still not enabled, giving up\n"); goto Err; } } Loading Loading @@ -394,12 +400,14 @@ static int ali1563_probe(struct pci_dev *dev, { int error; if ((error = ali1563_setup(dev))) error = ali1563_setup(dev); if (error) goto exit; ali1563_adapter.dev.parent = &dev->dev; snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name), "SMBus ALi 1563 Adapter @ %04x", ali1563_smba); if ((error = i2c_add_adapter(&ali1563_adapter))) error = i2c_add_adapter(&ali1563_adapter); if (error) goto exit_shutdown; return 0; Loading Loading
drivers/i2c/busses/i2c-ali1563.c +45 −37 Original line number Diff line number Diff line Loading @@ -184,7 +184,8 @@ static int ali1563_block_start(struct i2c_adapter * a) return status; } static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8 rw) static int ali1563_block(struct i2c_adapter *a, union i2c_smbus_data *data, u8 rw) { int i, len; int error = 0; Loading @@ -208,10 +209,12 @@ static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8 for (i = 0; i < len; i++) { if (rw == I2C_SMBUS_WRITE) { outb_p(data->block[i + 1], SMB_BLK_DAT); if ((error = ali1563_block_start(a))) error = ali1563_block_start(a); if (error) break; } else { if ((error = ali1563_block_start(a))) error = ali1563_block_start(a); if (error) break; if (i == 0) { len = inb_p(SMB_HST_DAT0); Loading @@ -237,7 +240,8 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr, u32 reg; for (timeout = ALI1563_MAX_TIMEOUT; timeout; timeout--) { if (!(reg = inb_p(SMB_HST_STS) & HST_STS_BUSY)) reg = inb_p(SMB_HST_STS); if (!(reg & HST_STS_BUSY)) break; } if (!timeout) Loading Loading @@ -268,7 +272,8 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr, } outb_p(((addr & 0x7f) << 1) | (rw & 0x01), SMB_HST_ADD); outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2); outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2); /* Write the command register */ Loading Loading @@ -296,7 +301,8 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr, goto Done; } if ((error = ali1563_transaction(a, size))) error = ali1563_transaction(a, size); if (error) goto Done; if ((rw == I2C_SMBUS_WRITE) || (size == HST_CNTL2_QUICK)) Loading Loading @@ -350,8 +356,8 @@ static int ali1563_setup(struct pci_dev *dev) ctrl | ALI1563_SMB_IOEN); pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); if (!(ctrl & ALI1563_SMB_IOEN)) { dev_err(&dev->dev, "I/O space still not enabled, " "giving up\n"); dev_err(&dev->dev, "I/O space still not enabled, giving up\n"); goto Err; } } Loading Loading @@ -394,12 +400,14 @@ static int ali1563_probe(struct pci_dev *dev, { int error; if ((error = ali1563_setup(dev))) error = ali1563_setup(dev); if (error) goto exit; ali1563_adapter.dev.parent = &dev->dev; snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name), "SMBus ALi 1563 Adapter @ %04x", ali1563_smba); if ((error = i2c_add_adapter(&ali1563_adapter))) error = i2c_add_adapter(&ali1563_adapter); if (error) goto exit_shutdown; return 0; Loading