From patchwork Mon Jul 4 09:06:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iiro Valkonen X-Patchwork-Id: 941912 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6496dv6015329 for ; Mon, 4 Jul 2011 09:06:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755826Ab1GDJGs (ORCPT ); Mon, 4 Jul 2011 05:06:48 -0400 Received: from newsmtp5.atmel.com ([204.2.163.5]:7565 "EHLO sjogate2.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753583Ab1GDJGr (ORCPT ); Mon, 4 Jul 2011 05:06:47 -0400 Received: from csomb01.corp.atmel.com ([10.95.30.150]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id p6493c6d011253; Mon, 4 Jul 2011 02:03:38 -0700 (PDT) Received: from hammb01.corp.atmel.com ([10.142.130.20]) by csomb01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 4 Jul 2011 03:06:43 -0600 Received: from [10.191.100.69] ([10.191.100.69]) by hammb01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 4 Jul 2011 10:06:42 +0100 Message-ID: <4E118297.1040607@atmel.com> Date: Mon, 04 Jul 2011 12:06:31 +0300 From: Iiro Valkonen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Dmitry Torokhov CC: Joonyoung Shim , linux-input@vger.kernel.org Subject: [PATCH 3/3] Input: atmel_mxt_ts - Handle objects with multiple instances correctly X-OriginalArrivalTime: 04 Jul 2011 09:06:42.0271 (UTC) FILETIME=[B0E416F0:01CC3A29] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 04 Jul 2011 09:06:48 +0000 (UTC) Handle the objects with multiple instances correctly when the configuration data is loaded. Signed-off-by: Iiro Valkonen --- drivers/input/touchscreen/atmel_mxt_ts.c | 6 ++++-- 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 da8c9ca..90f221f 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) 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;