Skip to contentSkip to conversation

Input: atmel_mxt_ts - Handle objects with multiple instances correctly

PATCH Applied Iiro Valkonen 2 participants 2 messages Jul 4, 2011

Subsystems (3)

v1 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 Input: atmel_mxt_ts - Handle objects with multiple instances correctly

Handle the objects with multiple instances correctly when the configuration data is loaded.

---
 drivers/input/touchscreen/atmel_mxt_ts.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +4 -2
index da8c9ca..90f221f 100644
@@ -655,7 +655,9 @@ static int mxt_check_reg_init(struct mxt_data *data)
 		if (!mxt_object_writable(object->type))
 			continue;
 
-		for (j = 0; j < object->size + 1; j++) {
+		for (j = 0;
+		     j < ((object->size + 1) * (object->instances + 1));
+		     j++) {
 			config_offset = index + j;
 			if (config_offset > pdata->config_length) {
 				dev_err(dev, "Not enough config data!\n");
@@ -664,7 +666,7 @@ static int mxt_check_reg_init(struct mxt_data *data)
 			mxt_write_object(data, object->type, j,
 					 pdata->config[config_offset]);
 		}
-		index += object->size + 1;
+		index += (object->size + 1) * (object->instances + 1);
 	}
 
 	return 0;
Signature · 1 line
1.7.0.4