stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "spi: omap2-mcspi: Prevent duplicate gpio_request" has been added to the 4.4-stable tree
@ 2016-03-01  8:15 gregkh
  2016-03-01 16:58 ` Michael Welling
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2016-03-01  8:15 UTC (permalink / raw)
  To: mwelling, broonie, gregkh, joe; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    spi: omap2-mcspi: Prevent duplicate gpio_request

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-omap2-mcspi-prevent-duplicate-gpio_request.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 2f538c017e1a8620d19553931199c6d6a6d31bb2 Mon Sep 17 00:00:00 2001
From: Michael Welling <mwelling@ieee.org>
Date: Mon, 30 Nov 2015 09:02:39 -0600
Subject: spi: omap2-mcspi: Prevent duplicate gpio_request

From: Michael Welling <mwelling@ieee.org>

commit 2f538c017e1a8620d19553931199c6d6a6d31bb2 upstream.

Occasionally the setup function will be called multiple times. Only request
the gpio the first time otherwise -EBUSY will occur on subsequent calls to
setup.

Reported-by: Joseph Bell <joe@iachieved.it>

Signed-off-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/spi/spi-omap2-mcspi.c |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1024,6 +1024,16 @@ static int omap2_mcspi_setup(struct spi_
 		spi->controller_state = cs;
 		/* Link this to context save list */
 		list_add_tail(&cs->node, &ctx->cs);
+
+		if (gpio_is_valid(spi->cs_gpio)) {
+			ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
+			if (ret) {
+				dev_err(&spi->dev, "failed to request gpio\n");
+				return ret;
+			}
+			gpio_direction_output(spi->cs_gpio,
+					 !(spi->mode & SPI_CS_HIGH));
+		}
 	}
 
 	if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) {
@@ -1032,15 +1042,6 @@ static int omap2_mcspi_setup(struct spi_
 			return ret;
 	}
 
-	if (gpio_is_valid(spi->cs_gpio)) {
-		ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
-		if (ret) {
-			dev_err(&spi->dev, "failed to request gpio\n");
-			return ret;
-		}
-		gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
-	}
-
 	ret = pm_runtime_get_sync(mcspi->dev);
 	if (ret < 0)
 		return ret;


Patches currently in stable-queue which might be from mwelling@ieee.org are

queue-4.4/spi-omap2-mcspi-prevent-duplicate-gpio_request.patch

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch "spi: omap2-mcspi: Prevent duplicate gpio_request" has been added to the 4.4-stable tree
  2016-03-01  8:15 Patch "spi: omap2-mcspi: Prevent duplicate gpio_request" has been added to the 4.4-stable tree gregkh
@ 2016-03-01 16:58 ` Michael Welling
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Welling @ 2016-03-01 16:58 UTC (permalink / raw)
  To: gregkh; +Cc: broonie, joe, stable, stable-commits

On Tue, Mar 01, 2016 at 08:15:27AM +0000, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     spi: omap2-mcspi: Prevent duplicate gpio_request
> 
> to the 4.4-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>

Thanks Greg.
 
> The filename of the patch is:
>      spi-omap2-mcspi-prevent-duplicate-gpio_request.patch
> and it can be found in the queue-4.4 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.
> 
> 
> From 2f538c017e1a8620d19553931199c6d6a6d31bb2 Mon Sep 17 00:00:00 2001
> From: Michael Welling <mwelling@ieee.org>
> Date: Mon, 30 Nov 2015 09:02:39 -0600
> Subject: spi: omap2-mcspi: Prevent duplicate gpio_request
> 
> From: Michael Welling <mwelling@ieee.org>
> 
> commit 2f538c017e1a8620d19553931199c6d6a6d31bb2 upstream.
> 
> Occasionally the setup function will be called multiple times. Only request
> the gpio the first time otherwise -EBUSY will occur on subsequent calls to
> setup.
> 
> Reported-by: Joseph Bell <joe@iachieved.it>
> 
> Signed-off-by: Michael Welling <mwelling@ieee.org>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  drivers/spi/spi-omap2-mcspi.c |   19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1024,6 +1024,16 @@ static int omap2_mcspi_setup(struct spi_
>  		spi->controller_state = cs;
>  		/* Link this to context save list */
>  		list_add_tail(&cs->node, &ctx->cs);
> +
> +		if (gpio_is_valid(spi->cs_gpio)) {
> +			ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
> +			if (ret) {
> +				dev_err(&spi->dev, "failed to request gpio\n");
> +				return ret;
> +			}
> +			gpio_direction_output(spi->cs_gpio,
> +					 !(spi->mode & SPI_CS_HIGH));
> +		}
>  	}
>  
>  	if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) {
> @@ -1032,15 +1042,6 @@ static int omap2_mcspi_setup(struct spi_
>  			return ret;
>  	}
>  
> -	if (gpio_is_valid(spi->cs_gpio)) {
> -		ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
> -		if (ret) {
> -			dev_err(&spi->dev, "failed to request gpio\n");
> -			return ret;
> -		}
> -		gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
> -	}
> -
>  	ret = pm_runtime_get_sync(mcspi->dev);
>  	if (ret < 0)
>  		return ret;
> 
> 
> Patches currently in stable-queue which might be from mwelling@ieee.org are
> 
> queue-4.4/spi-omap2-mcspi-prevent-duplicate-gpio_request.patch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-01 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01  8:15 Patch "spi: omap2-mcspi: Prevent duplicate gpio_request" has been added to the 4.4-stable tree gregkh
2016-03-01 16:58 ` Michael Welling

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).