linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] input: qt2160: Fix I2C write function.
@ 2012-10-16 15:19 Javier Martin
  2012-10-16 15:19 ` [PATCH 2/2] input: qt2160: Add support for LEDs Javier Martin
  2012-10-16 17:31 ` [PATCH 1/2] input: qt2160: Fix I2C write function Dmitry Torokhov
  0 siblings, 2 replies; 9+ messages in thread
From: Javier Martin @ 2012-10-16 15:19 UTC (permalink / raw)
  To: linux-input; +Cc: axel.lin, dmitry.torokhov, Javier Martin

The previous implementation of qt2160_write() didn't work
properly. Use a similar aproach as qt1070 instead.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
---
 drivers/input/keyboard/qt2160.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c
index e7a5e36..73ea4b0 100644
--- a/drivers/input/keyboard/qt2160.c
+++ b/drivers/input/keyboard/qt2160.c
@@ -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;
 }
 
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-10-18  6:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-16 15:19 [PATCH 1/2] input: qt2160: Fix I2C write function Javier Martin
2012-10-16 15:19 ` [PATCH 2/2] input: qt2160: Add support for LEDs Javier Martin
2012-10-16 15:53   ` Dmitry Torokhov
2012-10-17  7:23     ` javier Martin
2012-10-17  8:32       ` javier Martin
2012-10-17 13:09         ` javier Martin
2012-10-18  6:32           ` Dmitry Torokhov
2012-10-16 17:31 ` [PATCH 1/2] input: qt2160: Fix I2C write function Dmitry Torokhov
2012-10-17  6:59   ` javier Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).