diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-03-24 16:50:28 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-03-29 00:25:01 -0700 |
commit | 4896fb1348713344abbd9f692b393b5fdc539bf8 (patch) | |
tree | 2901297241bde9ee5b5be59fe012c4b514cebb5b /drivers/input/touchscreen/melfas_mip4.c | |
parent | f5a28a7d4858f94a2d8b5271ffee607de30050e4 (diff) | |
download | linux-4896fb1348713344abbd9f692b393b5fdc539bf8.tar.bz2 |
Input: melfas_mip4 - ensure that device is present
Try a quick read from the device in mip4_query_device() to make sure
that the device is there, as we do not consider failures to retrieve
product name or resolution fatal.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/melfas_mip4.c')
-rw-r--r-- | drivers/input/touchscreen/melfas_mip4.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index 703d7f983d0a..05108c2fea93 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -253,10 +253,21 @@ static int mip4_get_fw_version(struct mip4_ts *ts) */ static int mip4_query_device(struct mip4_ts *ts) { + union i2c_smbus_data dummy; int error; u8 cmd[2]; u8 buf[14]; + /* + * Make sure there is something at this address as we do not + * consider subsequent failures as fatal. + */ + if (i2c_smbus_xfer(ts->client->adapter, ts->client->addr, + 0, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &dummy) < 0) { + dev_err(&ts->client->dev, "nothing at this address\n"); + return -ENXIO; + } + /* Product name */ cmd[0] = MIP4_R0_INFO; cmd[1] = MIP4_R1_INFO_PRODUCT_NAME; |