X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fi2c%2Fbusses%2Fi2c-ali15x3.c;h=3f11b6e1a3418c5bc5dad86681b7eae67c429af7;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=446606c91776446031d864456c767b57b4e55383;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 446606c91..3f11b6e1a 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c @@ -60,13 +60,13 @@ /* Note: we assume there can only be one ALI15X3, with one SMBus interface */ -#include #include #include #include #include #include #include +#include #include #include #include @@ -125,12 +125,13 @@ /* If force_addr is set to anything different from 0, we forcibly enable the device at the given address. */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); +static u16 force_addr; +module_param(force_addr, ushort, 0); MODULE_PARM_DESC(force_addr, "Initialize the base address of the i2c controller"); -static unsigned short ali15x3_smba = 0; +static struct pci_driver ali15x3_driver; +static unsigned short ali15x3_smba; static int ali15x3_setup(struct pci_dev *ALI15X3_dev) { @@ -166,7 +167,8 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev) if(force_addr) ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); - if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, "ali15x3-smb")) { + if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, + ali15x3_driver.name)) { dev_err(&ALI15X3_dev->dev, "ALI15X3_smb region 0x%x already in use!\n", ali15x3_smba); @@ -296,7 +298,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap) /* We will always wait for a fraction of a second! */ timeout = 0; do { - i2c_delay(1); + msleep(1); temp = inb_p(SMBHSTSTS); } while ((!(temp & (ALI15X3_STS_ERR | ALI15X3_STS_DONE))) && (timeout++ < MAX_TIMEOUT)); @@ -353,7 +355,7 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr, for (timeout = 0; (timeout < MAX_TIMEOUT) && !(temp & ALI15X3_STS_IDLE); timeout++) { - i2c_delay(1); + msleep(1); temp = inb_p(SMBHSTSTS); } if (timeout >= MAX_TIMEOUT) { @@ -461,30 +463,24 @@ static u32 ali15x3_func(struct i2c_adapter *adapter) I2C_FUNC_SMBUS_BLOCK_DATA; } -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, +static const struct i2c_algorithm smbus_algorithm = { .smbus_xfer = ali15x3_access, .functionality = ali15x3_func, }; static struct i2c_adapter ali15x3_adapter = { .owner = THIS_MODULE, - .class = I2C_ADAP_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, - .name = "unset", }; static struct pci_device_id ali15x3_ids[] = { - { - .vendor = PCI_VENDOR_ID_AL, - .device = PCI_DEVICE_ID_AL_M7101, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, + { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) }, { 0, } }; +MODULE_DEVICE_TABLE (pci, ali15x3_ids); + static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) { if (ali15x3_setup(dev)) { @@ -508,7 +504,7 @@ static void __devexit ali15x3_remove(struct pci_dev *dev) } static struct pci_driver ali15x3_driver = { - .name = "ali15x3 smbus", + .name = "ali15x3_smbus", .id_table = ali15x3_ids, .probe = ali15x3_probe, .remove = __devexit_p(ali15x3_remove), @@ -516,7 +512,7 @@ static struct pci_driver ali15x3_driver = { static int __init i2c_ali15x3_init(void) { - return pci_module_init(&ali15x3_driver); + return pci_register_driver(&ali15x3_driver); } static void __exit i2c_ali15x3_exit(void)