i2c: Use <linux/io.h> instead of <asm/io.h>
[safe/jmp/linux-2.6] / drivers / i2c / busses / i2c-amd756.c
index 26acc65..03bcd07 100644 (file)
@@ -1,7 +1,4 @@
 /*
-    amd756.c - Part of lm_sensors, Linux kernel modules for hardware
-              monitoring
-
     Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
 
     Shamelessly ripped from i2c-piix4.c:
@@ -46,7 +43,7 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 /* AMD756 SMBus address offsets */
 #define SMB_ADDR_OFFSET                0xE0
@@ -129,7 +126,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
                } while ((temp & (GS_HST_STS | GS_SMB_STS)) &&
                         (timeout++ < MAX_TIMEOUT));
                /* If the SMBus is still busy, we give up */
-               if (timeout >= MAX_TIMEOUT) {
+               if (timeout > MAX_TIMEOUT) {
                        dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp);
                        goto abort;
                }
@@ -146,7 +143,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
        } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT));
 
        /* If the SMBus is still busy, we give up */
-       if (timeout >= MAX_TIMEOUT) {
+       if (timeout > MAX_TIMEOUT) {
                dev_dbg(&adap->dev, "Completion timeout!\n");
                goto abort;
        }
@@ -301,7 +298,6 @@ static const struct i2c_algorithm smbus_algorithm = {
 
 struct i2c_adapter amd756_smbus = {
        .owner          = THIS_MODULE,
-       .id             = I2C_HW_SMBUS_AMD756,
        .class          = I2C_CLASS_HWMON | I2C_CLASS_SPD,
        .algo           = &smbus_algorithm,
 };
@@ -312,7 +308,7 @@ static const char* chipname[] = {
        "nVidia nForce", "AMD8111",
 };
 
-static struct pci_device_id amd756_ids[] = {
+static const struct pci_device_id amd756_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_740B),
          .driver_data = AMD756 },
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7413),
@@ -335,10 +331,6 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
        int error;
        u8 temp;
        
-       /* driver_data might come from user-space, so check it */
-       if (id->driver_data >= ARRAY_SIZE(chipname))
-               return -EINVAL;
-
        if (amd756_ioport) {
                dev_err(&pdev->dev, "Only one device supported "
                       "(you have a strange motherboard, btw)\n");
@@ -372,7 +364,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
        error = acpi_check_region(amd756_ioport, SMB_IOSIZE,
                                  amd756_driver.name);
        if (error)
-               return error;
+               return -ENODEV;
 
        if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
                dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
@@ -387,8 +379,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
        /* set up the sysfs linkage to our parent device */
        amd756_smbus.dev.parent = &pdev->dev;
 
-       sprintf(amd756_smbus.name, "SMBus %s adapter at %04x",
-               chipname[id->driver_data], amd756_ioport);
+       snprintf(amd756_smbus.name, sizeof(amd756_smbus.name),
+                "SMBus %s adapter at %04x", chipname[id->driver_data],
+                amd756_ioport);
 
        error = i2c_add_adapter(&amd756_smbus);
        if (error) {
@@ -415,7 +408,6 @@ static struct pci_driver amd756_driver = {
        .id_table       = amd756_ids,
        .probe          = amd756_probe,
        .remove         = __devexit_p(amd756_remove),
-       .dynids.use_driver_data = 1,
 };
 
 static int __init amd756_init(void)