Commit a93d4f2d authored by Iiro Valkonen's avatar Iiro Valkonen Committed by Dmitry Torokhov

Input: atmel_mxt_ts - handle objects with multiple instances correctly

Handle the objects with multiple instances correctly when the configuration
data is loaded.
Signed-off-by: default avatarIiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 81c88a71
...@@ -655,7 +655,9 @@ static int mxt_check_reg_init(struct mxt_data *data) ...@@ -655,7 +655,9 @@ static int mxt_check_reg_init(struct mxt_data *data)
if (!mxt_object_writable(object->type)) if (!mxt_object_writable(object->type))
continue; continue;
for (j = 0; j < object->size + 1; j++) { for (j = 0;
j < (object->size + 1) * (object->instances + 1);
j++) {
config_offset = index + j; config_offset = index + j;
if (config_offset > pdata->config_length) { if (config_offset > pdata->config_length) {
dev_err(dev, "Not enough config data!\n"); dev_err(dev, "Not enough config data!\n");
...@@ -664,7 +666,7 @@ static int mxt_check_reg_init(struct mxt_data *data) ...@@ -664,7 +666,7 @@ static int mxt_check_reg_init(struct mxt_data *data)
mxt_write_object(data, object->type, j, mxt_write_object(data, object->type, j,
pdata->config[config_offset]); pdata->config[config_offset]);
} }
index += object->size + 1; index += (object->size + 1) * (object->instances + 1);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment