diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-10-13 17:56:31 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-10-13 17:56:31 -0400 |
commit | 553515e5c54dbf3340cd6773aaf0acb53291d6ad (patch) | |
tree | 604b27ffd6452b925c4f2433e55fec60f755e44b /drivers/i2c/chips/pcf8574.c | |
parent | 95a7f10eadcd88cfd6640e44c7b8cf9ac1afafe7 (diff) |
i2c/pcf8574: No arbitrary initialization
Do not initialize the PCF8574 with an arbitrary value. Users will have
to write the initial value to sysfs themselves.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'drivers/i2c/chips/pcf8574.c')
-rw-r--r-- | drivers/i2c/chips/pcf8574.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index 32b25427eaba..21c6dd69193c 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c | |||
@@ -48,14 +48,11 @@ static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, | |||
48 | /* Insmod parameters */ | 48 | /* Insmod parameters */ |
49 | I2C_CLIENT_INSMOD_2(pcf8574, pcf8574a); | 49 | I2C_CLIENT_INSMOD_2(pcf8574, pcf8574a); |
50 | 50 | ||
51 | /* Initial values */ | ||
52 | #define PCF8574_INIT 255 /* All outputs on (input mode) */ | ||
53 | |||
54 | /* Each client has this additional data */ | 51 | /* Each client has this additional data */ |
55 | struct pcf8574_data { | 52 | struct pcf8574_data { |
56 | struct i2c_client client; | 53 | struct i2c_client client; |
57 | 54 | ||
58 | u8 write; /* Remember last written value */ | 55 | int write; /* Remember last written value */ |
59 | }; | 56 | }; |
60 | 57 | ||
61 | static int pcf8574_attach_adapter(struct i2c_adapter *adapter); | 58 | static int pcf8574_attach_adapter(struct i2c_adapter *adapter); |
@@ -85,7 +82,11 @@ static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); | |||
85 | static ssize_t show_write(struct device *dev, struct device_attribute *attr, char *buf) | 82 | static ssize_t show_write(struct device *dev, struct device_attribute *attr, char *buf) |
86 | { | 83 | { |
87 | struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); | 84 | struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); |
88 | return sprintf(buf, "%u\n", data->write); | 85 | |
86 | if (data->write < 0) | ||
87 | return data->write; | ||
88 | |||
89 | return sprintf(buf, "%d\n", data->write); | ||
89 | } | 90 | } |
90 | 91 | ||
91 | static ssize_t set_write(struct device *dev, struct device_attribute *attr, const char *buf, | 92 | static ssize_t set_write(struct device *dev, struct device_attribute *attr, const char *buf, |
@@ -206,8 +207,7 @@ static int pcf8574_detach_client(struct i2c_client *client) | |||
206 | static void pcf8574_init_client(struct i2c_client *client) | 207 | static void pcf8574_init_client(struct i2c_client *client) |
207 | { | 208 | { |
208 | struct pcf8574_data *data = i2c_get_clientdata(client); | 209 | struct pcf8574_data *data = i2c_get_clientdata(client); |
209 | data->write = PCF8574_INIT; | 210 | data->write = -EAGAIN; |
210 | i2c_smbus_write_byte(client, data->write); | ||
211 | } | 211 | } |
212 | 212 | ||
213 | static int __init pcf8574_init(void) | 213 | static int __init pcf8574_init(void) |