linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: [PATCH 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released
Date: Thu, 26 Sep 2019 09:59:41 +0200	[thread overview]
Message-ID: <20190926095941.0615f335@jawa> (raw)
In-Reply-To: <CAMuHMdXseZppE74D8XW=5ZWNNNLXZFLTSiqqe_qoZ8C1rAFQSg@mail.gmail.com>

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

Hi Geert,

> Hi Lukasz,
> 
> On Thu, Sep 26, 2019 at 3:33 AM Lukasz Majewski <lukma@denx.de> wrote:
> > This change is necessary for spidev devices (e.g. /dev/spidev3.0)
> > working in the slave mode (like NXP's dspi driver for Vybrid SoC).
> >
> > When SPI HW works in this mode - the master is responsible for
> > providing CS and CLK signals. However, when some fault happens -
> > like for example distortion on SPI lines - the SPI Linux driver
> > needs a chance to recover from this abnormal situation and prepare
> > itself for next (correct) transmission.
> >
> > This change doesn't pose any threat on drivers working in master
> > mode as spi_slave_abort() function checks if SPI slave mode is
> > supported.
> >
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>  
> 
> Thanks for your patch!
> 
> Yesterday I saw this appear on spi/for-next, but I couldn't find the
> email in my mbox.  Today it has arrived. Looks like gmail had some
> troubles ("Delivered after 138401 seconds", ugh).

I've already sent v2 of this patch, as Intel Linux test setup spot the
error with lack of #define guards.

> 
> > --- a/drivers/spi/spidev.c
> > +++ b/drivers/spi/spidev.c
> > @@ -627,6 +627,7 @@ static int spidev_release(struct inode *inode,
> > struct file *filp) if (dofree)
> >                         kfree(spidev);
> >         }
> > +       spi_slave_abort(spidev->spi);  
> 
> Looks good to me.  Just wondering if this should be done for the last
> user only, i.e. in the "if" block above, like resetting speed_hz?

I also thought about this. However, from my use case the user must end
the transmission with CTRL+C on his user space program, which in turn
communicate via SPI with /dev/spidev3.0.

There might be many (potential) programs using the /dev/spidev3.0 at the
same time, so the usage count may be not one.

For the above reason I've moved it outside the above if().

> 
> >         mutex_unlock(&device_list_lock);
> >
> >         return 0;  
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 




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  7:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 11:05 [PATCH 0/2] spi: Fix problem with interrupted slave transmission Lukasz Majewski
2019-09-24 11:05 ` [PATCH 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Lukasz Majewski
2019-09-24 20:08   ` Applied "spi: Add call to spi_slave_abort() function when spidev driver is released" to the spi tree Mark Brown
2019-09-26  6:52   ` [PATCH 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Geert Uytterhoeven
2019-09-26  7:59     ` Lukasz Majewski [this message]
2019-09-24 11:05 ` [PATCH 2/2] spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver Lukasz Majewski
2019-10-01 11:41   ` Applied "spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver" to the spi tree Mark Brown
2019-09-25  9:11 ` [PATCH v2 0/2] spi: Fix problem with interrupted slave transmission Lukasz Majewski
2019-09-25  9:11   ` [PATCH v2 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Lukasz Majewski
2019-09-25 16:45     ` Mark Brown
2019-09-25 19:57       ` Lukasz Majewski
2019-09-25 16:47     ` Applied "spi: Add call to spi_slave_abort() function when spidev driver is released" to the spi tree Mark Brown
2019-09-25  9:11   ` [PATCH v2 2/2] spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver Lukasz Majewski

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=20190926095941.0615f335@jawa \
    --to=lukma@denx.de \
    --cc=broonie@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=krzk@kernel.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).