2007-05-11 10:41:23

by Satoru Takeuchi

[permalink] [raw]
Subject: [PATCH] Fix UCB1x00 driver to use sched_setscheduler

Fix Touchscreen driver for UCB1x00-based touchscreens to use
sched_setscheduler() instead of setting the fields of task_struct directly.

Signed-off-by: Satoru Takeuchi <[email protected]>

Index: linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c
===================================================================
--- linux-2.6.21-fix-ucb-drivers.orig/drivers/mfd/ucb1x00-ts.c 2007-05-11 18:53:36.000000000 +0900
+++ linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c 2007-05-11 19:33:20.000000000 +0900
@@ -214,8 +214,9 @@ static int ucb1x00_thread(void *_ts)
* We could run as a real-time thread. However, thus far
* this doesn't seem to be necessary.
*/
-// tsk->policy = SCHED_FIFO;
-// tsk->rt_priority = 1;
+// struct sched_param param = { .sched_priority = 1 };
+//
+// sched_setscheduler(tsk, SCHED_FIFO, &param);

valid = 0;


2007-05-11 11:32:59

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] Fix UCB1x00 driver to use sched_setscheduler

Hi!

> Fix Touchscreen driver for UCB1x00-based touchscreens to use
> sched_setscheduler() instead of setting the fields of task_struct directly.
>
> Signed-off-by: Satoru Takeuchi <[email protected]>

Looks ok to me.
Pavel

> Index: linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c
> ===================================================================
> --- linux-2.6.21-fix-ucb-drivers.orig/drivers/mfd/ucb1x00-ts.c 2007-05-11 18:53:36.000000000 +0900
> +++ linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c 2007-05-11 19:33:20.000000000 +0900
> @@ -214,8 +214,9 @@ static int ucb1x00_thread(void *_ts)
> * We could run as a real-time thread. However, thus far
> * this doesn't seem to be necessary.
> */
> -// tsk->policy = SCHED_FIFO;
> -// tsk->rt_priority = 1;
> +// struct sched_param param = { .sched_priority = 1 };
> +//
> +// sched_setscheduler(tsk, SCHED_FIFO, &param);
>
> valid = 0;
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2007-05-12 13:07:28

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH] Fix UCB1x00 driver to use sched_setscheduler

On Fri, 2007-05-11 at 19:39 +0900, Satoru Takeuchi wrote:
> Fix Touchscreen driver for UCB1x00-based touchscreens to use
> sched_setscheduler() instead of setting the fields of task_struct directly.
>
> Signed-off-by: Satoru Takeuchi <[email protected]>
>
> Index: linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c
> ===================================================================
> --- linux-2.6.21-fix-ucb-drivers.orig/drivers/mfd/ucb1x00-ts.c 2007-05-11 18:53:36.000000000 +0900
> +++ linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c 2007-05-11 19:33:20.000000000 +0900
> @@ -214,8 +214,9 @@ static int ucb1x00_thread(void *_ts)
> * We could run as a real-time thread. However, thus far
> * this doesn't seem to be necessary.
> */
> -// tsk->policy = SCHED_FIFO;
> -// tsk->rt_priority = 1;
> +// struct sched_param param = { .sched_priority = 1 };
> +//
> +// sched_setscheduler(tsk, SCHED_FIFO, &param);

Can we please remove the unused code completely instead of replacing it
by more commented out code ?

tglx




2007-05-13 23:58:36

by Satoru Takeuchi

[permalink] [raw]
Subject: Re: [PATCH] Fix UCB1x00 driver to use sched_setscheduler

At Sat, 12 May 2007 15:10:27 +0200,
Thomas Gleixner wrote:
>
> On Fri, 2007-05-11 at 19:39 +0900, Satoru Takeuchi wrote:
> > Fix Touchscreen driver for UCB1x00-based touchscreens to use
> > sched_setscheduler() instead of setting the fields of task_struct directly.
> >
> > Signed-off-by: Satoru Takeuchi <[email protected]>
> >
> > Index: linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c
> > ===================================================================
> > --- linux-2.6.21-fix-ucb-drivers.orig/drivers/mfd/ucb1x00-ts.c 2007-05-11 18:53:36.000000000 +0900
> > +++ linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c 2007-05-11 19:33:20.000000000 +0900
> > @@ -214,8 +214,9 @@ static int ucb1x00_thread(void *_ts)
> > * We could run as a real-time thread. However, thus far
> > * this doesn't seem to be necessary.
> > */
> > -// tsk->policy = SCHED_FIFO;
> > -// tsk->rt_priority = 1;
> > +// struct sched_param param = { .sched_priority = 1 };
> > +//
> > +// sched_setscheduler(tsk, SCHED_FIFO, &param);
>
> Can we please remove the unused code completely instead of replacing it
> by more commented out code ?

It's OK to me, but I'm not the driver writer and doesn't know how important
are those comments. If removing them is better for driver writers too, here
is the patch.

Thanks,

Satoru

---
Remove unnecesary comments on driver for UCB1x00-based touchscreens.

Signed-off-by: Satoru Takeuchi <[email protected]>

Index: linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c
===================================================================
--- linux-2.6.21-fix-ucb-drivers.orig/drivers/mfd/ucb1x00-ts.c 2007-05-11 18:53:36.000000000 +0900
+++ linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c 2007-05-14 08:44:03.000000000 +0900
@@ -199,7 +199,7 @@ static inline int ucb1x00_ts_pen_down(st
}

/*
- * This is a RT kernel thread that handles the ADC accesses
+ * This is a kernel thread that handles the ADC accesses
* (mainly so we can use semaphores in the UCB1200 core code
* to serialise accesses to the ADC).
*/
@@ -210,13 +210,6 @@ static int ucb1x00_thread(void *_ts)
DECLARE_WAITQUEUE(wait, tsk);
int valid;

- /*
- * We could run as a real-time thread. However, thus far
- * this doesn't seem to be necessary.
- */
-// tsk->policy = SCHED_FIFO;
-// tsk->rt_priority = 1;
-
valid = 0;

add_wait_queue(&ts->irq_wait, &wait);

2007-05-14 09:21:21

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] Fix UCB1x00 driver to use sched_setscheduler

Hi!

> > > Index: linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c
> > > ===================================================================
> > > --- linux-2.6.21-fix-ucb-drivers.orig/drivers/mfd/ucb1x00-ts.c 2007-05-11 18:53:36.000000000 +0900
> > > +++ linux-2.6.21-fix-ucb-drivers/drivers/mfd/ucb1x00-ts.c 2007-05-11 19:33:20.000000000 +0900
> > > @@ -214,8 +214,9 @@ static int ucb1x00_thread(void *_ts)
> > > * We could run as a real-time thread. However, thus far
> > > * this doesn't seem to be necessary.
> > > */
> > > -// tsk->policy = SCHED_FIFO;
> > > -// tsk->rt_priority = 1;
> > > +// struct sched_param param = { .sched_priority = 1 };
> > > +//
> > > +// sched_setscheduler(tsk, SCHED_FIFO, &param);
> >
> > Can we please remove the unused code completely instead of replacing it
> > by more commented out code ?
>
> It's OK to me, but I'm not the driver writer and doesn't know how important
> are those comments. If removing them is better for driver writers too, here
> is the patch.

I doubt anyone cares either way. Feel free to add my ACK to either
"remove" or "fix" version.
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html