diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2012-06-28 09:08:21 -0400 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2012-06-29 09:58:06 -0400 |
commit | 04a79181c40d3ad99885e7f799c799c153e93431 (patch) | |
tree | 6b1f4d1bda4dd23f605ff664e821e5a400391900 /drivers/input | |
parent | 333e5a9a99b8bba14f1a8631218d2d1e55fd58b1 (diff) |
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.c | 14 |
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, | |||
554 | input_sync(input_dev); | 554 | input_sync(input_dev); |
555 | } | 555 | } |
556 | 556 | ||
557 | static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) | ||
558 | { | ||
559 | u8 id = msg->reportid; | ||
560 | return (id >= data->T9_reportid_min && id <= data->T9_reportid_max); | ||
561 | } | ||
562 | |||
557 | static irqreturn_t mxt_interrupt(int irq, void *dev_id) | 563 | static irqreturn_t mxt_interrupt(int irq, void *dev_id) |
558 | { | 564 | { |
559 | struct mxt_data *data = dev_id; | 565 | struct mxt_data *data = dev_id; |
@@ -561,8 +567,6 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) | |||
561 | struct device *dev = &data->client->dev; | 567 | struct device *dev = &data->client->dev; |
562 | int id; | 568 | int id; |
563 | u8 reportid; | 569 | u8 reportid; |
564 | u8 max_reportid; | ||
565 | u8 min_reportid; | ||
566 | 570 | ||
567 | do { | 571 | do { |
568 | if (mxt_read_message(data, &message)) { | 572 | if (mxt_read_message(data, &message)) { |
@@ -572,11 +576,9 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) | |||
572 | 576 | ||
573 | reportid = message.reportid; | 577 | reportid = message.reportid; |
574 | 578 | ||
575 | max_reportid = data->T9_reportid_max; | 579 | id = reportid - data->T9_reportid_min; |
576 | min_reportid = data->T9_reportid_min; | ||
577 | id = reportid - min_reportid; | ||
578 | 580 | ||
579 | if (reportid >= min_reportid && reportid <= max_reportid) | 581 | if (mxt_is_T9_message(data, &message)) |
580 | mxt_input_touchevent(data, &message, id); | 582 | mxt_input_touchevent(data, &message, id); |
581 | else | 583 | else |
582 | mxt_dump_message(dev, &message); | 584 | mxt_dump_message(dev, &message); |