i2c: Use <linux/io.h> instead of <asm/io.h>
[safe/jmp/linux-2.6] / drivers / i2c / busses / i2c-amd756.c
index 424dad6..03bcd07 100644 (file)
@@ -43,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
@@ -126,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;
                }
@@ -143,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;
        }
@@ -298,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,
 };
@@ -309,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),
@@ -365,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",
@@ -380,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) {