#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/init.h>
/* 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 = 0;
+module_param(force_addr, ushort, 0);
MODULE_PARM_DESC(force_addr, "Initialize the base address of the i2c controller");
static unsigned short sis5595_base = 0;
if (force_addr) {
dev_info(&SIS5595_dev->dev, "forcing ISA address 0x%04X\n", sis5595_base);
- if (!pci_write_config_word(SIS5595_dev, ACPI_BASE, sis5595_base))
+ if (pci_write_config_word(SIS5595_dev, ACPI_BASE, sis5595_base)
+ != PCIBIOS_SUCCESSFUL)
goto error;
- if (!pci_read_config_word(SIS5595_dev, ACPI_BASE, &a))
+ if (pci_read_config_word(SIS5595_dev, ACPI_BASE, &a)
+ != PCIBIOS_SUCCESSFUL)
goto error;
if ((a & ~(SIS5595_EXTENT - 1)) != sis5595_base) {
/* doesn't work for some chips! */
}
}
- if (!pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val))
+ if (pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)
+ != PCIBIOS_SUCCESSFUL)
goto error;
if ((val & 0x80) == 0) {
dev_info(&SIS5595_dev->dev, "enabling ACPI\n");
- if (!pci_write_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, val | 0x80))
+ if (pci_write_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, val | 0x80)
+ != PCIBIOS_SUCCESSFUL)
goto error;
- if (!pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val))
+ if (pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)
+ != PCIBIOS_SUCCESSFUL)
goto error;
if ((val & 0x80) == 0) {
/* doesn't work for some chips? */
/* We will always wait for a fraction of a second! */
do {
- i2c_delay(1);
+ msleep(1);
temp = sis5595_read(SMB_STS_LO);
} while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT));
static struct i2c_adapter sis5595_adapter = {
.owner = THIS_MODULE,
- .class = I2C_ADAP_CLASS_SMBUS,
+ .class = I2C_CLASS_HWMON,
.name = "unset",
.algo = &smbus_algorithm,
};
{ 0, }
};
+MODULE_DEVICE_TABLE (pci, sis5595_ids);
+
static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
if (sis5595_setup(dev)) {
}
static struct pci_driver sis5595_driver = {
- .name = "sis5595 smbus",
+ .name = "sis5595_smbus",
.id_table = sis5595_ids,
.probe = sis5595_probe,
.remove = __devexit_p(sis5595_remove),
static int __init i2c_sis5595_init(void)
{
- return pci_module_init(&sis5595_driver);
+ return pci_register_driver(&sis5595_driver);
}
static void __exit i2c_sis5595_exit(void)