aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ucb1x00-ts.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index a260f83bcb02..585cded3d365 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -40,7 +40,7 @@
40 40
41 41
42struct ucb1x00_ts { 42struct ucb1x00_ts {
43 struct input_dev idev; 43 struct input_dev *idev;
44 struct ucb1x00 *ucb; 44 struct ucb1x00 *ucb;
45 45
46 wait_queue_head_t irq_wait; 46 wait_queue_head_t irq_wait;
@@ -56,16 +56,16 @@ static int adcsync;
56 56
57static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y) 57static inline void ucb1x00_ts_evt_add(struct ucb1x00_ts *ts, u16 pressure, u16 x, u16 y)
58{ 58{
59 input_report_abs(&ts->idev, ABS_X, x); 59 input_report_abs(ts->idev, ABS_X, x);
60 input_report_abs(&ts->idev, ABS_Y, y); 60 input_report_abs(ts->idev, ABS_Y, y);
61 input_report_abs(&ts->idev, ABS_PRESSURE, pressure); 61 input_report_abs(ts->idev, ABS_PRESSURE, pressure);
62 input_sync(&ts->idev); 62 input_sync(ts->idev);
63} 63}
64 64
65static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts) 65static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
66{ 66{
67 input_report_abs(&ts->idev, ABS_PRESSURE, 0); 67 input_report_abs(ts->idev, ABS_PRESSURE, 0);
68 input_sync(&ts->idev); 68 input_sync(ts->idev);
69} 69}
70 70
71/* 71/*
@@ -341,26 +341,30 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
341{ 341{
342 struct ucb1x00_ts *ts; 342 struct ucb1x00_ts *ts;
343 343
344 ts = kmalloc(sizeof(struct ucb1x00_ts), GFP_KERNEL); 344 ts = kzalloc(sizeof(struct ucb1x00_ts), GFP_KERNEL);
345 if (!ts) 345 if (!ts)
346 return -ENOMEM; 346 return -ENOMEM;
347 347
348 memset(ts, 0, sizeof(struct ucb1x00_ts)); 348 ts->idev = input_allocate_device();
349 if (!ts->idev) {
350 kfree(ts);
351 return -ENOMEM;
352 }
349 353
350 ts->ucb = dev->ucb; 354 ts->ucb = dev->ucb;
351 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 355 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
352 356
353 ts->idev.name = "Touchscreen panel"; 357 ts->idev->name = "Touchscreen panel";
354 ts->idev.id.product = ts->ucb->id; 358 ts->idev->id.product = ts->ucb->id;
355 ts->idev.open = ucb1x00_ts_open; 359 ts->idev->open = ucb1x00_ts_open;
356 ts->idev.close = ucb1x00_ts_close; 360 ts->idev->close = ucb1x00_ts_close;
357 361
358 __set_bit(EV_ABS, ts->idev.evbit); 362 __set_bit(EV_ABS, ts->idev->evbit);
359 __set_bit(ABS_X, ts->idev.absbit); 363 __set_bit(ABS_X, ts->idev->absbit);
360 __set_bit(ABS_Y, ts->idev.absbit); 364 __set_bit(ABS_Y, ts->idev->absbit);
361 __set_bit(ABS_PRESSURE, ts->idev.absbit); 365 __set_bit(ABS_PRESSURE, ts->idev->absbit);
362 366
363 input_register_device(&ts->idev); 367 input_register_device(ts->idev);
364 368
365 dev->priv = ts; 369 dev->priv = ts;
366 370
@@ -370,7 +374,8 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
370static void ucb1x00_ts_remove(struct ucb1x00_dev *dev) 374static void ucb1x00_ts_remove(struct ucb1x00_dev *dev)
371{ 375{
372 struct ucb1x00_ts *ts = dev->priv; 376 struct ucb1x00_ts *ts = dev->priv;
373 input_unregister_device(&ts->idev); 377
378 input_unregister_device(ts->idev);
374 kfree(ts); 379 kfree(ts);
375} 380}
376 381