summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ucb1x00-ts.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-12-12 00:37:36 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-12 08:57:45 -0800
commit1393c3edc307e0a2ec4274f67e342907ffd7deb5 (patch)
tree08e9e2bba7013301b30ea0a51ba9651a60f61620 /drivers/mfd/ucb1x00-ts.c
parent68799398cea44b81d1e919f842d8d84d471053d5 (diff)
downloadlinux-1393c3edc307e0a2ec4274f67e342907ffd7deb5.tar.bz2
[PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation
The bd622663192e8ebebb27dc1d9397f352a82d2495 commit broke the UCB1x00 touchscreen driver since the idev structure was assumed to be into the ts structure, simply casting the former to the later in a couple places. This patch fixes those, and also cache the idev pointer between multiple calls to input_report_abs() to avoid growing the compiled code needlessly. Signed-off-by: Nicolas Pitre <nico@cam.org> Cc: Dmitry Torokhov <dtor_core@ameritech.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mfd/ucb1x00-ts.c')
-rw-r--r--drivers/mfd/ucb1x00-ts.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index a984c0efabf0..551061c2eadf 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -59,16 +59,18 @@ static int adcsync;
static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
{
- input_report_abs(ts->idev, ABS_X, x);
- input_report_abs(ts->idev, ABS_Y, y);
- input_report_abs(ts->idev, ABS_PRESSURE, pressure);
- input_sync(ts->idev);
+ struct input_dev *idev = ts->idev;
+ input_report_abs(idev, ABS_X, x);
+ input_report_abs(idev, ABS_Y, y);
+ input_report_abs(idev, ABS_PRESSURE, pressure);
+ input_sync(idev);
}
static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
{
- input_report_abs(ts->idev, ABS_PRESSURE, 0);
- input_sync(ts->idev);
+ struct input_dev *idev = ts->idev;
+ input_report_abs(idev, ABS_PRESSURE, 0);
+ input_sync(idev);
}
/*
@@ -297,7 +299,7 @@ static void ucb1x00_ts_irq(int idx, void *id)
static int ucb1x00_ts_open(struct input_dev *idev)
{
- struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
+ struct ucb1x00_ts *ts = idev->private;
int ret = 0;
BUG_ON(ts->rtask);
@@ -334,7 +336,7 @@ static int ucb1x00_ts_open(struct input_dev *idev)
*/
static void ucb1x00_ts_close(struct input_dev *idev)
{
- struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
+ struct ucb1x00_ts *ts = idev->private;
if (ts->rtask)
kthread_stop(ts->rtask);
@@ -386,6 +388,7 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
ts->ucb = dev->ucb;
ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
+ ts->idev->private = ts;
ts->idev->name = "Touchscreen panel";
ts->idev->id.product = ts->ucb->id;
ts->idev->open = ucb1x00_ts_open;