Linux Input/HID development
 help / color / mirror / Atom feed
From: Henrik Rydberg <rydberg@euromail.se>
To: chinyeow.sim.xt@renesas.com
Cc: tsoni@codeaurora.org, dmitry.torokhov@gmail.com,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v3] Input: add ST1232 touchscreen controller driver.
Date: Wed, 15 Dec 2010 10:16:57 +0100	[thread overview]
Message-ID: <4D088789.9060102@euromail.se> (raw)
In-Reply-To: <1292400728-15521-1-git-send-email-chinyeow.sim.xt@renesas.com>

> +

> +static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
> +{
> +	int i, ret, flg;


A "int count = 0;" makes more sense than flg.

> +	struct st1232_ts_data *ts = dev_id;
> +	struct st1232_ts_finger *finger = ts->finger;
> +
> +	ret = st1232_ts_read_data(ts);
> +	if (ret < 0)
> +		goto end;
> +
> +	/* multi touch protocol */
> +	for (i = 0, flg = 0; i < MAX_FINGERS; i++) {


flg initialization is hidden here, see above comment.

> +		if (!finger[i].is_valid)
> +			continue;
> +		else
> +			flg = 1;


dropping this...

> +
> +		input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
> +					finger[i].t);
> +		input_report_abs(ts->input_dev, ABS_MT_POSITION_X, finger[i].x);
> +		input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, finger[i].y);
> +		input_mt_sync(ts->input_dev);


and simply "count++;" here.

> +	}
> +
> +	/* SYN_MT_REPORT only if no contact */
> +	if (!flg)


(!count)

> +		input_mt_sync(ts->input_dev);
> +
> +	/* SYN_REPORT */
> +	input_sync(ts->input_dev);
> +
> +end:
> +	return IRQ_HANDLED;
> +}
> +
> +
> +	input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR,
> +				0, MAX_AREA, 0, 0);
> +	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X,
> +				MIN_X, MAX_X, 0, 0);
> +	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y,
> +				MIN_Y, MAX_Y, 0, 0);
> +
> +	ret = input_register_device(ts->input_dev);
> +	if (ret) {
> +		dev_err(&client->dev, "Unable to register %s input device\n",
> +			ts->input_dev->name);
> +		goto err_free_input_device;
> +	}
> +
> +	ret = request_threaded_irq(client->irq, NULL, st1232_ts_irq_handler,
> +					IRQF_ONESHOT, client->name, ts);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to register interrupt\n");
> +		goto err_free_input_device;
> +	}
> +
> +	device_init_wakeup(&client->dev, 1);
> +
> +	return 0;
> +
> +err_free_input_device:
> +	input_free_device(ts->input_dev);
> +err_free_mem:
> +	kfree(ts);
> +err:
> +	return ret;
> +}


Thank you,
Henrik

      parent reply	other threads:[~2010-12-15  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15  8:12 [PATCH v3] Input: add ST1232 touchscreen controller driver chinyeow.sim.xt
2010-12-15  8:39 ` Trilok Soni
2010-12-15  9:16 ` Henrik Rydberg [this message]

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=4D088789.9060102@euromail.se \
    --to=rydberg@euromail.se \
    --cc=chinyeow.sim.xt@renesas.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=tsoni@codeaurora.org \
    /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