Skip to content

Commit

Permalink
[PATCH] Input: convert ucb1x00-ts to dynamic input_dev allocation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent c5b7c7c commit bd62266
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions drivers/mfd/ucb1x00-ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


struct ucb1x00_ts {
struct input_dev idev;
struct input_dev *idev;
struct ucb1x00 *ucb;

wait_queue_head_t irq_wait;
Expand All @@ -56,16 +56,16 @@ 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);
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);
}

static inline void ucb1x00_ts_event_release(struct ucb1x00_ts *ts)
{
input_report_abs(&ts->idev, ABS_PRESSURE, 0);
input_sync(&ts->idev);
input_report_abs(ts->idev, ABS_PRESSURE, 0);
input_sync(ts->idev);
}

/*
Expand Down Expand Up @@ -341,26 +341,30 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
{
struct ucb1x00_ts *ts;

ts = kmalloc(sizeof(struct ucb1x00_ts), GFP_KERNEL);
ts = kzalloc(sizeof(struct ucb1x00_ts), GFP_KERNEL);
if (!ts)
return -ENOMEM;

memset(ts, 0, sizeof(struct ucb1x00_ts));
ts->idev = input_allocate_device();
if (!ts->idev) {
kfree(ts);
return -ENOMEM;
}

ts->ucb = dev->ucb;
ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;

ts->idev.name = "Touchscreen panel";
ts->idev.id.product = ts->ucb->id;
ts->idev.open = ucb1x00_ts_open;
ts->idev.close = ucb1x00_ts_close;
ts->idev->name = "Touchscreen panel";
ts->idev->id.product = ts->ucb->id;
ts->idev->open = ucb1x00_ts_open;
ts->idev->close = ucb1x00_ts_close;

__set_bit(EV_ABS, ts->idev.evbit);
__set_bit(ABS_X, ts->idev.absbit);
__set_bit(ABS_Y, ts->idev.absbit);
__set_bit(ABS_PRESSURE, ts->idev.absbit);
__set_bit(EV_ABS, ts->idev->evbit);
__set_bit(ABS_X, ts->idev->absbit);
__set_bit(ABS_Y, ts->idev->absbit);
__set_bit(ABS_PRESSURE, ts->idev->absbit);

input_register_device(&ts->idev);
input_register_device(ts->idev);

dev->priv = ts;

Expand All @@ -370,7 +374,8 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
static void ucb1x00_ts_remove(struct ucb1x00_dev *dev)
{
struct ucb1x00_ts *ts = dev->priv;
input_unregister_device(&ts->idev);

input_unregister_device(ts->idev);
kfree(ts);
}

Expand Down

0 comments on commit bd62266

Please sign in to comment.