From patchwork Wed Aug 25 14:22:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 131921 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7PF1po9009383 for ; Wed, 25 Aug 2010 15:01:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751776Ab0HYPBu (ORCPT ); Wed, 25 Aug 2010 11:01:50 -0400 Received: from mga09.intel.com ([134.134.136.24]:40987 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751696Ab0HYPBu (ORCPT ); Wed, 25 Aug 2010 11:01:50 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 25 Aug 2010 08:01:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.56,269,1280732400"; d="scan'208";a="548619092" Received: from unknown (HELO localhost.localdomain) ([10.255.13.224]) by orsmga002.jf.intel.com with ESMTP; 25 Aug 2010 08:01:48 -0700 From: Alan Cox Subject: [PATCH 1/2] fix channel allocation in the touch screen driver To: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com, greg@kroah.com Date: Wed, 25 Aug 2010 15:22:10 +0100 Message-ID: <20100825142200.2831.42013.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 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.3 (demeter.kernel.org [140.211.167.41]); Wed, 25 Aug 2010 15:01:53 +0000 (UTC) diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c index 97c7b7f..2a1a692 100644 --- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c +++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c @@ -157,8 +157,8 @@ static int mrstouch_pmic_id(uint *vendor, uint *rev) */ static int mrstouch_chan_parse(struct mrstouch_dev *tsdev) { - int err, i, j, found; - u32 r32; + int err, i, found; + u8 r8; found = -1; @@ -166,15 +166,13 @@ static int mrstouch_chan_parse(struct mrstouch_dev *tsdev) if (found >= 0) break; - err = intel_scu_ipc_ioread32(PMICADDR0, &r32); + err = intel_scu_ipc_ioread8(PMICADDR0 + i, &r8); if (err) return err; - for (j = 0; j < 32; j+= 8) { - if (((r32 >> j) & 0xFF) == END_OF_CHANNEL) { - found = i; - break; - } + if (r8 == END_OF_CHANNEL) { + found = i; + break; } } if (found < 0) @@ -284,20 +282,17 @@ static int mrstouch_ts_chan_read(u16 offset, u16 chan, u16 *vp, u16 *vm) */ static int mrstouch_ts_chan_set(uint offset) { - int count; u16 chan; - u16 reg[5]; - u8 data[5]; + + int ret, count; chan = PMICADDR0 + offset; for (count = 0; count <= 3; count++) { - reg[count] = chan++; - data[count] = MRST_TS_CHAN10 + count; + ret = intel_scu_ipc_iowrite8(chan++, MRST_TS_CHAN10 + count); + if (ret) + return ret; } - reg[count] = chan; - data[count] = END_OF_CHANNEL; - - return intel_scu_ipc_writev(reg, data, 5); + return intel_scu_ipc_iowrite8(chan++, END_OF_CHANNEL); } /* Initialize ADC */