Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557921

Re: [PATCH] Input: egalax_ts - do not release gpio if probe successful

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Input: egalax_ts - do not release gpio if probe successful
Date 2017-01-13 00:50 +0100
Message-ID <sYXi2-1Pf-11@gated-at.bofh.it> (permalink)
References <sYuSJ-1hp-3@gated-at.bofh.it> <sYSs2-7lL-35@gated-at.bofh.it> <sYWFk-1zU-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Input: egalax_ts - do not release gpio if probe successful Gary Bisson <gary.bisson@boundarydevices.com> - 2017-01-11 18:30 +0100
  Re: [PATCH] Input: egalax_ts - do not release gpio if probe  successful Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-12 19:40 +0100
    Re: [PATCH] Input: egalax_ts - do not release gpio if probe  successful Gary Bisson <gary.bisson@boundarydevices.com> - 2017-01-13 00:10 +0100
      Re: [PATCH] Input: egalax_ts - do not release gpio if probe  successful Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-13 00:50 +0100
        Re: [PATCH] Input: egalax_ts - do not release gpio if probe successful Gary Bisson <gary.bisson@boundarydevices.com> - 2017-01-16 15:50 +0100

csiph-web