aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ucb1x00-ts.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-12-12 03:37:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-12 11:57:45 -0500
commit1393c3edc307e0a2ec4274f67e342907ffd7deb5 (patch)
tree08e9e2bba7013301b30ea0a51ba9651a60f61620 /drivers/mfd/ucb1x00-ts.c
parent68799398cea44b81d1e919f842d8d84d471053d5 (diff)
[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;
59 59
60static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y) 60static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
61{ 61{
62 input_report_abs(ts->idev, ABS_X, x); 62 struct input_dev *idev = ts->idev;
63 input_report_abs(ts->idev, ABS_Y, y); 63 input_report_abs(idev, ABS_X, x);
64 input_report_abs(ts->idev, ABS_PRESSURE, pressure); 64 input_report_abs(idev, ABS_Y, y);
65 input_sync(ts->idev); 65 input_report_abs(idev, ABS_PRESSURE, pressure);
66 input_sync(idev);
66} 67}
67 68
68static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts) 69static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
69{ 70{
70 input_report_abs(ts->idev, ABS_PRESSURE, 0); 71 struct input_dev *idev = ts->idev;
71 input_sync(ts->idev); 72 input_report_abs(idev, ABS_PRESSURE, 0);
73 input_sync(idev);
72} 74}
73 75
74/* 76/*
@@ -297,7 +299,7 @@ static void ucb1x00_ts_irq(int idx, void *id)
297 299
298static int ucb1x00_ts_open(struct input_dev *idev) 300static int ucb1x00_ts_open(struct input_dev *idev)
299{ 301{
300 struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; 302 struct ucb1x00_ts *ts = idev->private;
301 int ret = 0; 303 int ret = 0;
302 304
303 BUG_ON(ts->rtask); 305 BUG_ON(ts->rtask);
@@ -334,7 +336,7 @@ static int ucb1x00_ts_open(struct input_dev *idev)
334 */ 336 */
335static void ucb1x00_ts_close(struct input_dev *idev) 337static void ucb1x00_ts_close(struct input_dev *idev)
336{ 338{
337 struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; 339 struct ucb1x00_ts *ts = idev->private;
338 340
339 if (ts->rtask) 341 if (ts->rtask)
340 kthread_stop(ts->rtask); 342 kthread_stop(ts->rtask);
@@ -386,6 +388,7 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
386 ts->ucb = dev->ucb; 388 ts->ucb = dev->ucb;
387 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 389 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
388 390
391 ts->idev->private = ts;
389 ts->idev->name = "Touchscreen panel"; 392 ts->idev->name = "Touchscreen panel";
390 ts->idev->id.product = ts->ucb->id; 393 ts->idev->id.product = ts->ucb->id;
391 ts->idev->open = ucb1x00_ts_open; 394 ts->idev->open = ucb1x00_ts_open;