public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@suse.cz>,
	rpurdie@rpsys.net, lenz@cs.wisc.edu, rmk@arm.linux.org.uk,
	vojtech@suse.cz
Subject: Re: [patch 2/2] Touchscreen support for sharp sl-5500
Date: Fri, 22 Jul 2005 22:51:31 -0500	[thread overview]
Message-ID: <200507222251.31931.dtor_core@ameritech.net> (raw)
In-Reply-To: <20050723002839.GA2077@elf.ucw.cz>

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

  reply	other threads:[~2005-07-23  3:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-23  0:28 [patch 2/2] Touchscreen support for sharp sl-5500 Pavel Machek
2005-07-23  3:51 ` Dmitry Torokhov [this message]
2005-07-23 13:20   ` Pavel Machek
2005-07-23 13:41   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507222251.31931.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=lenz@cs.wisc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=rmk@arm.linux.org.uk \
    --cc=rpurdie@rpsys.net \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox