[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190927003849.0c9e4335@jawa>
Date: Fri, 27 Sep 2019 00:38:49 +0200
From: Lukasz Majewski <lukma@...x.de>
To: Mark Brown <broonie@...nel.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
Colin Ian King <colin.king@...onical.com>,
linux-spi <linux-spi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: spi: Add call to spi_slave_abort() function when spidev driver
is released
Hi Mark, Geert,
> On Thu, Sep 26, 2019 at 04:06:45PM +0200, Lukasz Majewski wrote:
> > > On Thu, Sep 26, 2019 at 2:49 PM Lukasz Majewski <lukma@...x.de>
> > > wrote:
>
> > > > The question is if we shall call the spi_slave_abort() when
> > > > cleaning up spi after releasing last reference, or each time
> > > > release callback is called ?
>
> > > TBH, I don't know. Is it realistic that there are multiple
> > > opens?
>
> > I'm using on my setup only one test program to use /dev/spidevX.Y
> > and /dev/spidevA.B (loopback with wired connection).
>
> > However, you also shall be able to connect via ssh and run the same
> > setup in parallel...
>
> It doesn't seem entirely realistic, but I can imagine cases like
> fork()/exec() where we end up with two copies of the file open
> but end up immediately closing one.
>
> > > That means the abort is called only for the last user.
> > > And only if the underlying device still exists. Which means that
> > > if it has disappeared (how can that happen? spidev unbind?),
>
> > In my case, I just disconnect some SPI signals and the test program
> > just hangs. I do need to ctrl+c to stop it (or use timeout).
>
> > From my debugging the .release callback is called each time the
> > program is aborted (either with ctrl+c or timeout).
>
> Should be on file close IIRC.
Any ideas on how to solve this issue?
Maybe, it would be sufficient for now to move the spi_slave_abort() in
spi_release() before we decrease (spidev->users--) the use count?
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@...x.de
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists