Re: [patch 2/2] Touchscreen support for sharp sl-5500

From: Dmitry Torokhov
Date: Fri Jul 22 2005 - 22:52:31 EST


On Friday 22 July 2005 19:28, Pavel Machek wrote:
> This adds support for touchscreen on Sharp Zaurus sl-5500. Vojtech,
> please apply,

I have couple more commnets...

> +static int ucb1x00_thread(void *_ts)
> +{
> + struct ucb1x00_ts *ts = _ts;
> + struct task_struct *tsk = current;
> + int valid;
> +
> + ts->rtask = tsk;
> + allow_signal(SIGKILL);

This is not needed...

> +
> + /*
> + * We run as a real-time thread. However, thus far
> + * this doesn't seem to be necessary.
> + */
> + tsk->policy = SCHED_FIFO;
> + tsk->rt_priority = 1;
> +
> + complete(&ts->init_exit);
> +

Neither this one - kthread_create does not return until thread is actually
created and started.

> +
> + if (signal_pending(tsk))
> + break;

if (kthread_should_stop(..))
break;

> + }
> +
> + ts->rtask = NULL;
> + complete_and_exit(&ts->init_exit, 0);

This is not needed.

> +static int ucb1x00_ts_open(struct input_dev *idev)
> +{
> + struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
> + int ret = 0;
> + struct task_struct *task;
> +
> + if (ts->rtask)
> + panic("ucb1x00: rtask running?");
> +

Do you really need to panic here???

> +
> + init_completion(&ts->init_exit);
> + task = kthread_run(ucb1x00_thread, ts, "ktsd");
> + if (!IS_ERR(task)) {
> + wait_for_completion(&ts->init_exit);

Just call kthread_run() and kill that init_exit completion.

> +static void ucb1x00_ts_close(struct input_dev *idev)
> +{
> + struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev;
> +
> + if (ts->rtask) {
> + send_sig(SIGKILL, ts->rtask, 1);
> + wait_for_completion(&ts->init_exit);

kthread_stop().

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/