static int elan_smbus_get_max(struct i2c_client *client,
unsigned int *max_x, unsigned int *max_y)
{
+ int ret;
int error;
u8 val[3];
- error = i2c_smbus_read_block_data(client, ETP_SMBUS_RANGE_CMD, val);
- if (error) {
+ ret = i2c_smbus_read_block_data(client, ETP_SMBUS_RANGE_CMD, val);
+ if (ret != 3) {
+ error = ret < 0 ? ret : -EIO;
dev_err(&client->dev, "failed to get dimensions: %d\n", error);
return error;
}
static int elan_smbus_get_resolution(struct i2c_client *client,
u8 *hw_res_x, u8 *hw_res_y)
{
+ int ret;
int error;
u8 val[3];
- error = i2c_smbus_read_block_data(client,
- ETP_SMBUS_RESOLUTION_CMD, val);
- if (error) {
+ ret = i2c_smbus_read_block_data(client, ETP_SMBUS_RESOLUTION_CMD, val);
+ if (ret != 3) {
+ error = ret < 0 ? ret : -EIO;
dev_err(&client->dev, "failed to get resolution: %d\n", error);
return error;
}
unsigned int *x_traces,
unsigned int *y_traces)
{
+ int ret;
int error;
u8 val[3];
- error = i2c_smbus_read_block_data(client,
- ETP_SMBUS_XY_TRACENUM_CMD, val);
- if (error) {
+ ret = i2c_smbus_read_block_data(client, ETP_SMBUS_XY_TRACENUM_CMD, val);
+ if (ret != 3) {
+ error = ret < 0 ? ret : -EIO;
dev_err(&client->dev, "failed to get trace info: %d\n", error);
return error;
}