diff options
Diffstat (limited to 'drivers/i2c/chips/pcf8574.c')
| -rw-r--r-- | drivers/i2c/chips/pcf8574.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index 48b4e22eaffe..cfcf64654080 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c | |||
| @@ -57,7 +57,7 @@ SENSORS_INSMOD_2(pcf8574, pcf8574a); | |||
| 57 | struct pcf8574_data { | 57 | struct pcf8574_data { |
| 58 | struct i2c_client client; | 58 | struct i2c_client client; |
| 59 | 59 | ||
| 60 | u8 read, write; /* Register values */ | 60 | u8 write; /* Remember last written value */ |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | static int pcf8574_attach_adapter(struct i2c_adapter *adapter); | 63 | static int pcf8574_attach_adapter(struct i2c_adapter *adapter); |
| @@ -76,23 +76,21 @@ static struct i2c_driver pcf8574_driver = { | |||
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | /* following are the sysfs callback functions */ | 78 | /* following are the sysfs callback functions */ |
| 79 | static ssize_t show_read(struct device *dev, char *buf) | 79 | static ssize_t show_read(struct device *dev, struct device_attribute *attr, char *buf) |
| 80 | { | 80 | { |
| 81 | struct i2c_client *client = to_i2c_client(dev); | 81 | struct i2c_client *client = to_i2c_client(dev); |
| 82 | struct pcf8574_data *data = i2c_get_clientdata(client); | 82 | return sprintf(buf, "%u\n", i2c_smbus_read_byte(client)); |
| 83 | data->read = i2c_smbus_read_byte(client); | ||
| 84 | return sprintf(buf, "%u\n", data->read); | ||
| 85 | } | 83 | } |
| 86 | 84 | ||
| 87 | static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); | 85 | static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); |
| 88 | 86 | ||
| 89 | static ssize_t show_write(struct device *dev, char *buf) | 87 | static ssize_t show_write(struct device *dev, struct device_attribute *attr, char *buf) |
| 90 | { | 88 | { |
| 91 | struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); | 89 | struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); |
| 92 | return sprintf(buf, "%u\n", data->write); | 90 | return sprintf(buf, "%u\n", data->write); |
| 93 | } | 91 | } |
| 94 | 92 | ||
| 95 | static ssize_t set_write(struct device *dev, const char *buf, | 93 | static ssize_t set_write(struct device *dev, struct device_attribute *attr, const char *buf, |
| 96 | size_t count) | 94 | size_t count) |
| 97 | { | 95 | { |
| 98 | struct i2c_client *client = to_i2c_client(dev); | 96 | struct i2c_client *client = to_i2c_client(dev); |
