Skip to content

Commit

Permalink
Input: atmel_mxt_ts - refactor reportid checking in mxt_interrupt
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Kurtz authored and Henrik Rydberg committed Jun 29, 2012
1 parent 333e5a9 commit 04a7918
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,15 +554,19 @@ 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;
struct mxt_message message;
struct device *dev = &data->client->dev;
int id;
u8 reportid;
u8 max_reportid;
u8 min_reportid;

do {
if (mxt_read_message(data, &message)) {
Expand All @@ -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);
Expand Down

0 comments on commit 04a7918

Please sign in to comment.