All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Gary Bisson <gary.bisson@boundarydevices.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: egalax_ts - do not release gpio if probe successful
Date: Thu, 12 Jan 2017 15:40:57 -0800	[thread overview]
Message-ID: <20170112234057.GA17933@dtor-ws> (raw)
In-Reply-To: <20170112230343.rt6e2qrhnvl4cvqq@x240.lan>

On Fri, Jan 13, 2017 at 12:03:43AM +0100, Gary Bisson wrote:
> Hi Dmitri,
> 
> On Thu, Jan 12, 2017 at 10:30:19AM -0800, Dmitry Torokhov wrote:
> > Hi Gary,
> > 
> > On Wed, Jan 11, 2017 at 06:28:41PM +0100, Gary Bisson wrote:
> > > Thus preventing anyone to later modify the interrupt GPIO direction
> > > and/or state without the driver knowing.
> > 
> > I am afraid not releasing gpio after waking up the controller will cause
> > request_irq to fail if we are using the same pin for interrupt and
> > wakeup (as majority of current DTSes do: see
> > arch/arm/boot/dts/imx53-tx53-x13x.dts for example).
> 
> No, keeping the GPIO doesn't prevent from requesting the IRQ.
> 
> However it keeps other drivers/users from changing the GPIO as output
> later on.


Hmm, I think _gpiod_direction_output_raw() will not let them as it
checks FLAG_USED_AS_IRQ, so as long as it's the same line it's OK. But I
guess if they are separate some other component might try to grab it and
mess with it.

OK, in this case please:

- use devm_gpiod_get
- request with GPIOD_OUT_LOW
- do not override the return value with -ENODEV (especially important
  with probe deferrals)
- lose gpiod_direction_output() call
- move everything into egalax_ts_probe() as egalax_wake_up_device() is
  no longer self-contained. 

Thanks!

-- 
Dmitry

  reply	other threads:[~2017-01-12 23:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 17:28 [PATCH] Input: egalax_ts - do not release gpio if probe successful Gary Bisson
2017-01-12 18:30 ` Dmitry Torokhov
2017-01-12 23:03   ` Gary Bisson
2017-01-12 23:40     ` Dmitry Torokhov [this message]
2017-01-16 14:43       ` Gary Bisson

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=20170112234057.GA17933@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=gary.bisson@boundarydevices.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.