Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH] spi: Make spi_delay_exec() warn if called from atomic context
Date: Fri, 22 May 2020 19:02:33 +0300	[thread overview]
Message-ID: <20200522160233.GH1634618@smile.fi.intel.com> (raw)
In-Reply-To: <20200522155005.46099-1-broonie@kernel.org>

On Fri, May 22, 2020 at 04:50:05PM +0100, Mark Brown wrote:
> If the delay used is long enough the spi_delay_exec() will use a sleeping
> function to implement it. Add a might_sleep() here to help avoid callers
> using this from an atomic context and running into problems at runtime on
> other systems.

Thanks!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Suggested-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  drivers/spi/spi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index e02f434affca..c69d23379e08 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1160,6 +1160,8 @@ int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer)
>  {
>  	int delay;
>  
> +	might_sleep();
> +
>  	if (!_delay)
>  		return -EINVAL;
>  
> -- 
> 2.20.1
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-05-22 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 15:50 [PATCH] spi: Make spi_delay_exec() warn if called from atomic context Mark Brown
2020-05-22 16:02 ` Andy Shevchenko [this message]
2020-05-22 16:04   ` Andy Shevchenko
2020-05-22 16:10     ` Serge Semin
2020-05-22 16:18       ` Mark Brown
2020-05-25 14:57 ` 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=20200522160233.GH1634618@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=broonie@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