MLK-14473: touchscreen: Fix return type
authorRobert Chiras <robert.chiras@nxp.com>
Thu, 16 Mar 2017 10:20:45 +0000 (12:20 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:21:44 +0000 (15:21 -0500)
commitea9964c13b5d84beeed4f1fb2eea6adbc817e1b9
treeef771dfbc5bea77c36a3045dab367b8cd50fe77b
parentc4408139cea77428db725e6f8de45886ff3c13e2
MLK-14473: touchscreen: Fix return type

The touchscreen driver, max11801, which is on 12c2 bus, won't be probed
when using the hdcp specific DTS (this is disabling 12c2, since it
will acquire it for DDC communications). Since this driver won't be
probed, it will spam the dmesg with the pr_err from max11801_read_adc()
function. This function is periodically called by the battery driver. For
this reason, I removed the pr_err() call.
Also, to be noticed that the function signature is u32, but in case of an
error it will return a negative integer. In order to correctly propagate
errors, I changed the function signature to int. This is safe, since the
read value from i2c is on 16 bits (MSB and LSB on 8 bits).

Also, the function calibration_voltage is calling max11801_read_adc from
touchscreen driverm which can return negative values in case of an
error. I case of an error, just stop reading ADC data and return 0 as
voltage_data.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
drivers/input/touchscreen/max11801_ts.c
drivers/power/supply/sabresd_battery.c