aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/atmel_mxt_ts.c
diff options
context:
space:
mode:
authorIiro Valkonen <iiro.valkonen@atmel.com>2011-07-04 06:16:25 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-07-04 06:19:20 -0400
commita93d4f2d023ea5e84c0104d4e479243c6ac77d17 (patch)
tree134f15e404ce9549823d01b7010b4bf220da720f /drivers/input/touchscreen/atmel_mxt_ts.c
parent81c88a711aef5552375c4296bb473fdf9b12273c (diff)
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: Iiro Valkonen <iiro.valkonen@atmel.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/atmel_mxt_ts.c')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 5d71e4475934..ae00604a6a81 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -655,7 +655,9 @@ static int mxt_check_reg_init(struct mxt_data *data)
655 if (!mxt_object_writable(object->type)) 655 if (!mxt_object_writable(object->type))
656 continue; 656 continue;
657 657
658 for (j = 0; j < object->size + 1; j++) { 658 for (j = 0;
659 j < (object->size + 1) * (object->instances + 1);
660 j++) {
659 config_offset = index + j; 661 config_offset = index + j;
660 if (config_offset > pdata->config_length) { 662 if (config_offset > pdata->config_length) {
661 dev_err(dev, "Not enough config data!\n"); 663 dev_err(dev, "Not enough config data!\n");
@@ -664,7 +666,7 @@ static int mxt_check_reg_init(struct mxt_data *data)
664 mxt_write_object(data, object->type, j, 666 mxt_write_object(data, object->type, j,
665 pdata->config[config_offset]); 667 pdata->config[config_offset]);
666 } 668 }
667 index += object->size + 1; 669 index += (object->size + 1) * (object->instances + 1);
668 } 670 }
669 671
670 return 0; 672 return 0;