Commit eb071cbb authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] I2C: pcf8574 driver cleanup

I found a possible cleanup in the pcf8574 driver. We don't need to store
the read value in our private data structure, as we then never use it
again. I asked Aurelien and he is fine with the change. Please apply,
thanks.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5d740fe9
...@@ -57,7 +57,7 @@ SENSORS_INSMOD_2(pcf8574, pcf8574a); ...@@ -57,7 +57,7 @@ SENSORS_INSMOD_2(pcf8574, pcf8574a);
struct pcf8574_data { struct pcf8574_data {
struct i2c_client client; struct i2c_client client;
u8 read, write; /* Register values */ u8 write; /* Remember last written value */
}; };
static int pcf8574_attach_adapter(struct i2c_adapter *adapter); static int pcf8574_attach_adapter(struct i2c_adapter *adapter);
...@@ -79,9 +79,7 @@ static struct i2c_driver pcf8574_driver = { ...@@ -79,9 +79,7 @@ static struct i2c_driver pcf8574_driver = {
static ssize_t show_read(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t show_read(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct pcf8574_data *data = i2c_get_clientdata(client); return sprintf(buf, "%u\n", i2c_smbus_read_byte(client));
data->read = i2c_smbus_read_byte(client);
return sprintf(buf, "%u\n", data->read);
} }
static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); static DEVICE_ATTR(read, S_IRUGO, show_read, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment