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>
diff --git a/Documentation/i2c/chips/pcf8574 b/Documentation/i2c/chips/pcf8574
index 2752c8c..5c1ad13 100644
--- a/Documentation/i2c/chips/pcf8574
+++ b/Documentation/i2c/chips/pcf8574
@@ -62,8 +62,6 @@
 value, that is to say 0.
 
 The write file is read/write. Writing a value outputs it on the I/O
-port. Reading returns the last written value.
-
-On module initialization the chip is configured as eight inputs (all
-outputs to 1), so you can connect any circuit to the PCF8574(A) without
-being afraid of short-circuit.
+port. Reading returns the last written value. As it is not possible
+to read this value from the chip, you need to write at least once to
+this file before you can read back from it.
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 @@
 /* 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 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 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)