[PATCH] hwmon: hwmon vs i2c, second round (04/11)
[linux-2.6-block.git] / drivers / i2c / chips / pcf8574.c
index 4956e9effd75ca93551da5cc388e7548f93b53f3..01ec9ce1976886a523b151da00a75acf09986c5d 100644 (file)
@@ -45,7 +45,6 @@
 static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
                                        0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
                                        I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_2(pcf8574, pcf8574a);
@@ -57,7 +56,7 @@ SENSORS_INSMOD_2(pcf8574, pcf8574a);
 struct pcf8574_data {
        struct i2c_client client;
 
-       u8 read, write;                 /* Register values */
+       u8 write;                       /* Remember last written value */
 };
 
 static int pcf8574_attach_adapter(struct i2c_adapter *adapter);
@@ -79,9 +78,7 @@ static struct i2c_driver pcf8574_driver = {
 static ssize_t show_read(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct i2c_client *client = to_i2c_client(dev);
-       struct pcf8574_data *data = i2c_get_clientdata(client);
-       data->read = i2c_smbus_read_byte(client); 
-       return sprintf(buf, "%u\n", data->read);
+       return sprintf(buf, "%u\n", i2c_smbus_read_byte(client));
 }
 
 static DEVICE_ATTR(read, S_IRUGO, show_read, NULL);
@@ -115,10 +112,10 @@ static DEVICE_ATTR(write, S_IWUSR | S_IRUGO, show_write, set_write);
 
 static int pcf8574_attach_adapter(struct i2c_adapter *adapter)
 {
-       return i2c_detect(adapter, &addr_data, pcf8574_detect);
+       return i2c_probe(adapter, &addr_data, pcf8574_detect);
 }
 
-/* This function is called by i2c_detect */
+/* This function is called by i2c_probe */
 int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind)
 {
        struct i2c_client *new_client;
@@ -188,11 +185,8 @@ static int pcf8574_detach_client(struct i2c_client *client)
 {
        int err;
 
-       if ((err = i2c_detach_client(client))) {
-               dev_err(&client->dev,
-                       "Client deregistration failed, client not detached.\n");
+       if ((err = i2c_detach_client(client)))
                return err;
-       }
 
        kfree(i2c_get_clientdata(client));
        return 0;