From: Michael Grzeschik <mgr@pengutronix.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, support.opensource@diasemi.com,
kernel@pengutronix.de
Subject: Re: [PATCH] Input: da9052_tsi: remove unnecessary worker
Date: Tue, 20 Jan 2015 12:04:30 +0100 [thread overview]
Message-ID: <20150120110430.GC7404@pengutronix.de> (raw)
In-Reply-To: <20150120072100.GB36091@dtor-ws>
On Mon, Jan 19, 2015 at 11:21:00PM -0800, Dmitry Torokhov wrote:
> Hi Michael,
>
> On Sun, Jan 18, 2015 at 04:36:08PM +0100, Michael Grzeschik wrote:
> > With the datardy irq we get the information if the
> > pen got pulled from the screen. This patch changes
> > the irq by checking this condition every time instead
> > of triggering the worker.
> >
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> > drivers/input/touchscreen/da9052_tsi.c | 68 ++++++++++++++--------------------
> > 1 file changed, 27 insertions(+), 41 deletions(-)
> >
> > diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c
> > index 5a013bb..e6019dd 100644
> > --- a/drivers/input/touchscreen/da9052_tsi.c
> > +++ b/drivers/input/touchscreen/da9052_tsi.c
> > @@ -25,7 +25,6 @@
> > struct da9052_tsi {
> > struct da9052 *da9052;
> > struct input_dev *dev;
> > - struct delayed_work ts_pen_work;
> > struct mutex mutex;
> > bool stopped;
> > bool adc_on;
> > @@ -47,8 +46,6 @@ static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data)
> > da9052_enable_irq(tsi->da9052, DA9052_IRQ_TSIREADY);
> >
> > da9052_ts_adc_toggle(tsi, true);
> > -
> > - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50);
> > }
> >
> > return IRQ_HANDLED;
> > @@ -89,6 +86,33 @@ static void da9052_ts_read(struct da9052_tsi *tsi)
> > y = ((y << 2) & 0x3fc) | ((v & 0xc) >> 2);
> > z = ((z << 2) & 0x3fc) | ((v & 0x30) >> 4);
> >
> > + /* Check for last TSI_READY irq */
> > + if (!(ret & TSI_PEN_DOWN_STATUS)) {
> > +
> > + /* Pen UP */
> > + da9052_ts_adc_toggle(tsi, false);
>
> Now it is racy WRT tsi->adc_on checks in da9052_ts_input_close();
> previously we'd disable pendown IRQ and cancel the work, so no one
> would be touching tsi->adc_on.
I have been testing this and did not run into any race.
But ok, that resource should probably be surrounded by some
locking. I will give it a try.
> Also I'd rather we did event reporting in this function, but do IRQ
> switchover in da9052_ts_datardy_irq().
Sounds good in aspect of code structure.
Thanks,
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2015-01-20 11:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-18 15:36 [PATCH] Input: da9052_tsi: remove unnecessary worker Michael Grzeschik
2015-01-20 7:21 ` Dmitry Torokhov
2015-01-20 11:04 ` Michael Grzeschik [this message]
2015-02-06 11:05 ` [PATCH v2] " Michael Grzeschik
2015-02-06 23:24 ` Dmitry Torokhov
2015-02-06 23:41 ` Michael Grzeschik
2015-02-06 23:54 ` Dmitry Torokhov
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=20150120110430.GC7404@pengutronix.de \
--to=mgr@pengutronix.de \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-input@vger.kernel.org \
--cc=support.opensource@diasemi.com \
/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;
as well as URLs for NNTP newsgroup(s).