Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: appletouch - remove extra KERN_DEBUG use from dprintk
  Input: bu21013_ts - fix null dereference in error handling
  Input: ad7879 - prevent invalid finger data reports
  • Loading branch information
Linus Torvalds committed Nov 1, 2010
2 parents ce9d8d9 + d745b53 commit 09d692e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drivers/input/mouse/appletouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ static void atp_complete_geyser_3_4(struct urb *urb)
/* Just update the base values (i.e. touchpad in untouched state) */
if (dev->data[dev->info->datalen - 1] & ATP_STATUS_BASE_UPDATE) {

dprintk(KERN_DEBUG "appletouch: updated base values\n");
dprintk("appletouch: updated base values\n");

memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
goto exit;
Expand Down
32 changes: 27 additions & 5 deletions drivers/input/touchscreen/ad7879.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ struct ad7879 {
u16 cmd_crtl1;
u16 cmd_crtl2;
u16 cmd_crtl3;
int x;
int y;
int Rt;
};

static int ad7879_read(struct ad7879 *ts, u8 reg)
Expand Down Expand Up @@ -175,13 +178,32 @@ static int ad7879_report(struct ad7879 *ts)
Rt /= z1;
Rt = (Rt + 2047) >> 12;

if (!timer_pending(&ts->timer))
/*
* Sample found inconsistent, pressure is beyond
* the maximum. Don't report it to user space.
*/
if (Rt > ts->pressure_max)
return -EINVAL;

/*
* Note that we delay reporting events by one sample.
* This is done to avoid reporting last sample of the
* touch sequence, which may be incomplete if finger
* leaves the surface before last reading is taken.
*/
if (timer_pending(&ts->timer)) {
/* Touch continues */
input_report_key(input_dev, BTN_TOUCH, 1);
input_report_abs(input_dev, ABS_X, ts->x);
input_report_abs(input_dev, ABS_Y, ts->y);
input_report_abs(input_dev, ABS_PRESSURE, ts->Rt);
input_sync(input_dev);
}

ts->x = x;
ts->y = y;
ts->Rt = Rt;

input_report_abs(input_dev, ABS_X, x);
input_report_abs(input_dev, ABS_Y, y);
input_report_abs(input_dev, ABS_PRESSURE, Rt);
input_sync(input_dev);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/bu21013_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static int __devinit bu21013_probe(struct i2c_client *client,
err_cs_disable:
pdata->cs_dis(pdata->cs_pin);
err_free_mem:
input_free_device(bu21013_data->in_dev);
input_free_device(in_dev);
kfree(bu21013_data);

return error;
Expand Down

0 comments on commit 09d692e

Please sign in to comment.