diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-10-13 23:56:31 +0200 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-10-13 23:56:31 +0200 |
commit | 553515e5c54dbf3340cd6773aaf0acb53291d6ad (patch) | |
tree | 604b27ffd6452b925c4f2433e55fec60f755e44b /drivers/i2c | |
parent | 95a7f10eadcd88cfd6640e44c7b8cf9ac1afafe7 (diff) | |
download | kernel_samsung_smdk4412-553515e5c54dbf3340cd6773aaf0acb53291d6ad.zip kernel_samsung_smdk4412-553515e5c54dbf3340cd6773aaf0acb53291d6ad.tar.gz kernel_samsung_smdk4412-553515e5c54dbf3340cd6773aaf0acb53291d6ad.tar.bz2 |
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')
-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 32b2542..21c6dd6 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, /* Insmod parameters */ I2C_CLIENT_INSMOD_2(pcf8574, pcf8574a); -/* Initial values */ -#define PCF8574_INIT 255 /* All outputs on (input mode) */ - /* Each client has this additional data */ struct pcf8574_data { struct i2c_client client; - u8 write; /* Remember last written value */ + int write; /* Remember last written value */ }; static int pcf8574_attach_adapter(struct i2c_adapter *adapter); @@ -85,7 +82,11 @@ static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); static ssize_t show_write(struct device *dev, struct device_attribute *attr, char *buf) { struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); - return sprintf(buf, "%u\n", data->write); + + if (data->write < 0) + return data->write; + + return sprintf(buf, "%d\n", data->write); } 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) static void pcf8574_init_client(struct i2c_client *client) { struct pcf8574_data *data = i2c_get_clientdata(client); - data->write = PCF8574_INIT; - i2c_smbus_write_byte(client, data->write); + data->write = -EAGAIN; } static int __init pcf8574_init(void) |