i2c-algo-pcf: Drop unused struct members
[pandora-kernel.git] / drivers / i2c / busses / i2c-ali15x3.c
index e4e0df1..e922c39 100644 (file)
@@ -282,7 +282,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
                        dev_err(&adap->dev, "SMBus reset failed! (0x%02x) - "
                                "controller or device on bus is probably hung\n",
                                temp);
-                       return -1;
+                       return -EBUSY;
                }
        } else {
                /* check and clear done bit */
@@ -304,12 +304,12 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
 
        /* If the SMBus is still busy, we give up */
        if (timeout >= MAX_TIMEOUT) {
-               result = -1;
+               result = -ETIMEDOUT;
                dev_err(&adap->dev, "SMBus Timeout!\n");
        }
 
        if (temp & ALI15X3_STS_TERM) {
-               result = -1;
+               result = -EIO;
                dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
        }
 
@@ -320,7 +320,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
          This means that bus collisions go unreported.
        */
        if (temp & ALI15X3_STS_COLL) {
-               result = -1;
+               result = -ENXIO;
                dev_dbg(&adap->dev,
                        "Error: no response or bus collision ADD=%02x\n",
                        inb_p(SMBHSTADD));
@@ -328,7 +328,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
 
        /* haven't ever seen this */
        if (temp & ALI15X3_STS_DEV) {
-               result = -1;
+               result = -EIO;
                dev_err(&adap->dev, "Error: device error\n");
        }
        dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
@@ -338,7 +338,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
        return result;
 }
 
-/* Return -1 on error. */
+/* Return negative errno on error. */
 static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
                   unsigned short flags, char read_write, u8 command,
                   int size, union i2c_smbus_data * data)
@@ -362,9 +362,6 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
        }
 
        switch (size) {
-       case I2C_SMBUS_PROC_CALL:
-               dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
-               return -1;
        case I2C_SMBUS_QUICK:
                outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
                       SMBHSTADD);
@@ -417,12 +414,16 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
                }
                size = ALI15X3_BLOCK_DATA;
                break;
+       default:
+               dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
+               return -EOPNOTSUPP;
        }
 
        outb_p(size, SMBHSTCNT);        /* output command */
 
-       if (ali15x3_transaction(adap))  /* Error in transaction */
-               return -1;
+       temp = ali15x3_transaction(adap);
+       if (temp)
+               return temp;
 
        if ((read_write == I2C_SMBUS_WRITE) || (size == ALI15X3_QUICK))
                return 0;
@@ -470,7 +471,7 @@ static const struct i2c_algorithm smbus_algorithm = {
 static struct i2c_adapter ali15x3_adapter = {
        .owner          = THIS_MODULE,
        .id             = I2C_HW_SMBUS_ALI15X3,
-       .class          = I2C_CLASS_HWMON,
+       .class          = I2C_CLASS_HWMON | I2C_CLASS_SPD,
        .algo           = &smbus_algorithm,
 };
 
@@ -489,10 +490,10 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
                return -ENODEV;
        }
 
-       /* set up the driverfs linkage to our parent device */
+       /* set up the sysfs linkage to our parent device */
        ali15x3_adapter.dev.parent = &dev->dev;
 
-       snprintf(ali15x3_adapter.name, I2C_NAME_SIZE,
+       snprintf(ali15x3_adapter.name, sizeof(ali15x3_adapter.name),
                "SMBus ALI15X3 adapter at %04x", ali15x3_smba);
        return i2c_add_adapter(&ali15x3_adapter);
 }