X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fi2c%2Fbusses%2Fi2c-sis96x.c;h=7fd07fbac33681c3f81f49e66acad11660aa3533;hb=refs%2Fheads%2Fvserver;hp=c1d456b049a0254328581cb02bdb723656a98dcc;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index c1d456b04..7fd07fbac 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c @@ -32,10 +32,10 @@ We assume there can only be one SiS96x with one SMBus interface. */ -#include #include #include #include +#include #include #include #include @@ -43,16 +43,6 @@ #include #include -/* - HISTORY: - 2003-05-11 1.0.0 Updated from lm_sensors project for kernel 2.5 - (was i2c-sis645.c from lm_sensors 2.7.0) -*/ -#define SIS96x_VERSION "1.0.0" - -/* SiS96x SMBus PCI device ID */ -#define PCI_DEVICE_ID_SI_SMBUS 0x16 - /* base address register in PCI config space */ #define SIS96x_BAR 0x04 @@ -85,8 +75,9 @@ #define SIS96x_PROC_CALL 0x04 #define SIS96x_BLOCK_DATA 0x05 +static struct pci_driver sis96x_driver; static struct i2c_adapter sis96x_adapter; -static u16 sis96x_smbus_base = 0; +static u16 sis96x_smbus_base; static inline u8 sis96x_read(u8 reg) { @@ -139,7 +130,7 @@ static int sis96x_transaction(int size) /* We will always wait for a fraction of a second! */ do { - i2c_delay(1); + msleep(1); temp = sis96x_read(SMB_STS); } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); @@ -251,32 +242,24 @@ static u32 sis96x_func(struct i2c_adapter *adapter) I2C_FUNC_SMBUS_PROC_CALL; } -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, +static const struct i2c_algorithm smbus_algorithm = { .smbus_xfer = sis96x_access, .functionality = sis96x_func, }; static struct i2c_adapter sis96x_adapter = { .owner = THIS_MODULE, - .class = I2C_ADAP_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, - .name = "unset", }; static struct pci_device_id sis96x_ids[] = { - - { - .vendor = PCI_VENDOR_ID_SI, - .device = PCI_DEVICE_ID_SI_SMBUS, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - + { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_SMBUS) }, { 0, } }; +MODULE_DEVICE_TABLE (pci, sis96x_ids); + static int __devinit sis96x_probe(struct pci_dev *dev, const struct pci_device_id *id) { @@ -304,7 +287,8 @@ static int __devinit sis96x_probe(struct pci_dev *dev, sis96x_smbus_base); /* Everything is happy, let's grab the memory and set things up. */ - if (!request_region(sis96x_smbus_base, SMB_IOSIZE, "sis96x-smbus")) { + if (!request_region(sis96x_smbus_base, SMB_IOSIZE, + sis96x_driver.name)) { dev_err(&dev->dev, "SMBus registers 0x%04x-0x%04x " "already in use!\n", sis96x_smbus_base, sis96x_smbus_base + SMB_IOSIZE - 1); @@ -338,7 +322,7 @@ static void __devexit sis96x_remove(struct pci_dev *dev) } static struct pci_driver sis96x_driver = { - .name = "sis96x smbus", + .name = "sis96x_smbus", .id_table = sis96x_ids, .probe = sis96x_probe, .remove = __devexit_p(sis96x_remove), @@ -346,8 +330,7 @@ static struct pci_driver sis96x_driver = { static int __init i2c_sis96x_init(void) { - printk(KERN_INFO "i2c-sis96x version %s\n", SIS96x_VERSION); - return pci_module_init(&sis96x_driver); + return pci_register_driver(&sis96x_driver); } static void __exit i2c_sis96x_exit(void)