summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2012-06-28 17:08:21 +0400
committerHenrik Rydberg <rydberg@euromail.se>2012-06-29 17:58:06 +0400
commit04a79181c40d3ad99885e7f799c799c153e93431 (patch)
tree6b1f4d1bda4dd23f605ff664e821e5a400391900 /drivers/input
parent333e5a9a99b8bba14f1a8631218d2d1e55fd58b1 (diff)
downloadlinux-04a79181c40d3ad99885e7f799c799c153e93431.tar.xz
Input: atmel_mxt_ts - refactor reportid checking in mxt_interrupt
This small refactor is in preparation for checking more report types in the mxt_interrupt message processing loop. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 48f3637aecaa..a9e0b541c638 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -554,6 +554,12 @@ static void mxt_input_touchevent(struct mxt_data *data,
input_sync(input_dev);
}
+static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg)
+{
+ u8 id = msg->reportid;
+ return (id >= data->T9_reportid_min && id <= data->T9_reportid_max);
+}
+
static irqreturn_t mxt_interrupt(int irq, void *dev_id)
{
struct mxt_data *data = dev_id;
@@ -561,8 +567,6 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)
struct device *dev = &data->client->dev;
int id;
u8 reportid;
- u8 max_reportid;
- u8 min_reportid;
do {
if (mxt_read_message(data, &message)) {
@@ -572,11 +576,9 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)
reportid = message.reportid;
- max_reportid = data->T9_reportid_max;
- min_reportid = data->T9_reportid_min;
- id = reportid - min_reportid;
+ id = reportid - data->T9_reportid_min;
- if (reportid >= min_reportid && reportid <= max_reportid)
+ if (mxt_is_T9_message(data, &message))
mxt_input_touchevent(data, &message, id);
else
mxt_dump_message(dev, &message);