Input: qt2160 - fix qt2160_write() implementation
authorJavier Martin <javier.martin@vista-silicon.com>
Thu, 25 Oct 2012 06:55:01 +0000 (23:55 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 25 Oct 2012 07:13:47 +0000 (00:13 -0700)
The previous implementation of qt2160_write() didn't work properly because
the value was actually not written to the device. Probably nobody detected
this because the only write that was issued was the one related to auto
calibration.

In order to fix the problem use a similar aproach as qt1070 instead.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/qt2160.c

index e7a5e36e1203c26545ccb44dc7c4af82c9509011..73ea4b04d4fb633eccb43bcaa6cde2534ef8ddd4 100644 (file)
@@ -207,23 +207,14 @@ static int __devinit qt2160_read(struct i2c_client *client, u8 reg)
 
 static int __devinit qt2160_write(struct i2c_client *client, u8 reg, u8 data)
 {
-       int error;
-
-       error = i2c_smbus_write_byte(client, reg);
-       if (error) {
-               dev_err(&client->dev,
-                       "couldn't send request. Returned %d\n", error);
-               return error;
-       }
+       int ret;
 
-       error = i2c_smbus_write_byte(client, data);
-       if (error) {
+       ret = i2c_smbus_write_byte_data(client, reg, data);
+       if (ret < 0)
                dev_err(&client->dev,
-                       "couldn't write data. Returned %d\n", error);
-               return error;
-       }
+                       "couldn't write data. Returned %d\n", ret);
 
-       return error;
+       return ret;
 }
 
 
This page took 0.025716 seconds and 5 git commands to generate.