linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Mark Brown <broonie@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Colin Ian King <colin.king@canonical.com>,
	linux-spi <linux-spi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: spi: Add call to spi_slave_abort() function when spidev driver is released
Date: Fri, 27 Sep 2019 00:38:49 +0200	[thread overview]
Message-ID: <20190927003849.0c9e4335@jawa> (raw)
In-Reply-To: <20190926151752.GU2036@sirena.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1831 bytes --]

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@denx.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@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-09-26 22:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 10:00 spi: Add call to spi_slave_abort() function when spidev driver is released Colin Ian King
2019-09-26 10:14 ` Lukasz Majewski
2019-09-26 10:15   ` Colin Ian King
2019-09-26 10:32   ` Geert Uytterhoeven
2019-09-26 12:49     ` Lukasz Majewski
2019-09-26 13:51       ` Geert Uytterhoeven
2019-09-26 14:06         ` Lukasz Majewski
2019-09-26 15:17           ` Mark Brown
2019-09-26 22:38             ` Lukasz Majewski [this message]
2019-10-07 17:02               ` Mark Brown

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=20190927003849.0c9e4335@jawa \
    --to=lukma@denx.de \
    --cc=broonie@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@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 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).