Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Input: convert ucb1x00-ts to dynamic input_dev allocation

Input: convert ucb1x00-ts to dynamic input_dev allocation

This is required for input_dev sysfs integration

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Dmitry Torokhov and committed by
Greg Kroah-Hartman
bd622663 c5b7c7c3

+24 -19
+24 -19
drivers/mfd/ucb1x00-ts.c
··· 40 40 41 41 42 42 struct ucb1x00_ts { 43 - struct input_dev idev; 43 + struct input_dev *idev; 44 44 struct ucb1x00 *ucb; 45 45 46 46 wait_queue_head_t irq_wait; ··· 56 56 57 57 static 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); 60 - input_report_abs(&ts->idev, ABS_Y, y); 61 - input_report_abs(&ts->idev, ABS_PRESSURE, pressure); 62 - input_sync(&ts->idev); 59 + input_report_abs(ts->idev, ABS_X, x); 60 + input_report_abs(ts->idev, ABS_Y, y); 61 + input_report_abs(ts->idev, ABS_PRESSURE, pressure); 62 + input_sync(ts->idev); 63 63 } 64 64 65 65 static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts) 66 66 { 67 - input_report_abs(&ts->idev, ABS_PRESSURE, 0); 68 - input_sync(&ts->idev); 67 + input_report_abs(ts->idev, ABS_PRESSURE, 0); 68 + input_sync(ts->idev); 69 69 } 70 70 71 71 /* ··· 341 341 { 342 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 345 if (!ts) 346 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 354 ts->ucb = dev->ucb; 351 355 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 352 356 353 - ts->idev.name = "Touchscreen panel"; 354 - ts->idev.id.product = ts->ucb->id; 355 - ts->idev.open = ucb1x00_ts_open; 356 - ts->idev.close = ucb1x00_ts_close; 357 + ts->idev->name = "Touchscreen panel"; 358 + ts->idev->id.product = ts->ucb->id; 359 + ts->idev->open = ucb1x00_ts_open; 360 + ts->idev->close = ucb1x00_ts_close; 357 361 358 - __set_bit(EV_ABS, ts->idev.evbit); 359 - __set_bit(ABS_X, ts->idev.absbit); 360 - __set_bit(ABS_Y, ts->idev.absbit); 361 - __set_bit(ABS_PRESSURE, ts->idev.absbit); 362 + __set_bit(EV_ABS, ts->idev->evbit); 363 + __set_bit(ABS_X, ts->idev->absbit); 364 + __set_bit(ABS_Y, 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 369 dev->priv = ts; 366 370 ··· 374 370 static void ucb1x00_ts_remove(struct ucb1x00_dev *dev) 375 371 { 376 372 struct ucb1x00_ts *ts = dev->priv; 377 - input_unregister_device(&ts->idev); 373 + 374 + input_unregister_device(ts->idev); 378 375 kfree(ts); 379 376 } 380 377