struct mxt_object *object;
struct device *dev = &data->client->dev;
int index = 0;
- int i, j, config_offset;
+ int i, j, config_offset, config_size;
if (!pdata->config) {
dev_dbg(dev, "No cfg data defined, skipping reg init\n");
if (!mxt_object_writable(object->type))
continue;
- for (j = 0;
- j < (object->size + 1) * (object->instances + 1);
- j++) {
+ config_size = object->size * object->instances;
+ for (j = 0; j < config_size; j++) {
config_offset = index + j;
if (config_offset > pdata->config_length) {
dev_err(dev, "Not enough config data!\n");
mxt_write_object(data, object->type, j,
pdata->config[config_offset]);
}
- index += (object->size + 1) * (object->instances + 1);
+ index += config_size;
}
return 0;
object->type = buf[0];
object->start_address = (buf[2] << 8) | buf[1];
- object->size = buf[3];
- object->instances = buf[4];
+ object->size = buf[3] + 1;
+ object->instances = buf[4] + 1;
object->num_report_ids = buf[5];
if (object->num_report_ids) {
- reportid += object->num_report_ids *
- (object->instances + 1);
+ reportid += object->num_report_ids * object->instances;
object->max_reportid = reportid;
}
}
continue;
}
- for (j = 0; j < object->size + 1; j++) {
+ for (j = 0; j < object->size; j++) {
error = mxt_read_object(data,
object->type, j, &val);
if (error)