int avg_z2;
};
+struct ts_coords {
+ u16 x;
+ u16 y;
+ u16 z1;
+ u16 z2;
+};
+
struct tsc2301_ts {
struct input_dev *idev;
char phys[32];
struct spi_transfer read_xfer[2];
struct spi_message read_msg;
- u16 data[4];
+ struct ts_coords *coords;
struct ts_filter filter;
int send_event;
int x, y, z1, z2;
- x = ts->data[0];
- y = ts->data[1];
- z1 = ts->data[2];
- z2 = ts->data[3];
+ x = ts->coords->x;
+ y = ts->coords->y;
+ z1 = ts->coords->z1;
+ z2 = ts->coords->z2;
send_event = filter(ts, x, y, z1, z2);
if (send_event) {
spi_message_add_tail(x, m);
x++;
- x->rx_buf = &ts->data;
+ x->rx_buf = ts->coords;
x->len = 8;
spi_message_add_tail(x, m);
return -ENOMEM;
tsc->ts = ts;
+ ts->coords = kzalloc(sizeof(*ts->coords), GFP_KERNEL);
+ if (ts->coords == NULL) {
+ kfree(ts);
+ return -ENOMEM;
+ }
+
ts->irq = pdata->dav_int;
init_timer(&ts->penup_timer);
tsc2301_ts_stop_scan(tsc);
input_free_device(idev);
err2:
+ kfree(ts->coords);
kfree(ts);
return r;
}
free_irq(ts->irq, tsc);
input_unregister_device(ts->idev);
+ kfree(ts->coords);
kfree(ts);
}
MODULE_AUTHOR("Jarkko Oikarinen <jarkko.oikarinen@nokia.com>");