* [PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation
@ 2005-12-09 20:32 Nicolas Pitre
2005-12-09 21:08 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Pitre @ 2005-12-09 20:32 UTC (permalink / raw)
To: Dmitry Torokhov, Greg Kroah-Hartman; +Cc: Russell King, lkml
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>
---
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index a984c0e..e0794c2 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
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_
*/
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
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;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation
2005-12-09 20:32 [PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation Nicolas Pitre
@ 2005-12-09 21:08 ` Dmitry Torokhov
2005-12-09 22:25 ` Nicolas Pitre
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2005-12-09 21:08 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Greg Kroah-Hartman, Russell King, lkml
On 12/9/05, Nicolas Pitre <nico@cam.org> wrote:
> 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>
>
> ---
>
> diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
> index a984c0e..e0794c2 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);
> }
>
The changes above are not really needed. The rest is good and we
should get it int before 2.6.15 I think.
Thanks!
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation
2005-12-09 21:08 ` Dmitry Torokhov
@ 2005-12-09 22:25 ` Nicolas Pitre
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Pitre @ 2005-12-09 22:25 UTC (permalink / raw)
To: dtor_core; +Cc: Greg Kroah-Hartman, Russell King, lkml
On Fri, 9 Dec 2005, Dmitry Torokhov wrote:
> On 12/9/05, Nicolas Pitre <nico@cam.org> wrote:
> > 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>
> >
> > ---
> >
> > diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
> > index a984c0e..e0794c2 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);
> > }
> >
>
> The changes above are not really needed.
They are, I hope, obvious enough, and they fix what I'd call a generated
assembly regression which was introduced by said commit above. Before
that commit the generated assembly was (more) optimal and the those
changes are meant to bring that state back.
> The rest is good and we
> should get it int before 2.6.15 I think.
Indeed. Otherwise the driver simply crashes.
Nicolas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-12-09 22:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-09 20:32 [PATCH] input: fix ucb1x00-ts breakage after conversion to dynamic input_dev allocation Nicolas Pitre
2005-12-09 21:08 ` Dmitry Torokhov
2005-12-09 22:25 ` Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®