linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] spi: pxa2xx: handle error of pxa2xx_spi_dma_prepare()
@ 2015-12-23 19:50 Andy Shevchenko
       [not found] ` <1450900200-120644-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2015-12-23 19:50 UTC (permalink / raw)
  To: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA
  Cc: Andy Shevchenko, Jarkko Nikula

If by some reason pxa2xx_spi_dma_prepare() fails we have not to ignore its
error. In such case we abort the transfer and return the error to upper level.

Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/spi/spi-pxa2xx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 267a3a2..2e6915c 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -890,6 +890,7 @@ static void pump_transfers(unsigned long data)
 	u32 dma_thresh = drv_data->cur_chip->dma_threshold;
 	u32 dma_burst = drv_data->cur_chip->dma_burst_size;
 	u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data);
+	int err;
 
 	/* Get current state information */
 	message = drv_data->cur_msg;
@@ -1024,7 +1025,12 @@ static void pump_transfers(unsigned long data)
 		/* Ensure we have the correct interrupt handler */
 		drv_data->transfer_handler = pxa2xx_spi_dma_transfer;
 
-		pxa2xx_spi_dma_prepare(drv_data, dma_burst);
+		err = pxa2xx_spi_dma_prepare(drv_data, dma_burst);
+		if (err) {
+			message->status = err;
+			giveback(drv_data);
+			return;
+		}
 
 		/* Clear status and start DMA engine */
 		cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v1 1/1] spi: pxa2xx: handle error of pxa2xx_spi_dma_prepare()
       [not found] ` <1450900200-120644-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-01-20 11:13   ` Jarkko Nikula
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Nikula @ 2016-01-20 11:13 UTC (permalink / raw)
  To: Andy Shevchenko, Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA

On 12/23/2015 09:50 PM, Andy Shevchenko wrote:
> If by some reason pxa2xx_spi_dma_prepare() fails we have not to ignore its
> error. In such case we abort the transfer and return the error to upper level.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>   drivers/spi/spi-pxa2xx.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
> index 267a3a2..2e6915c 100644
> --- a/drivers/spi/spi-pxa2xx.c
> +++ b/drivers/spi/spi-pxa2xx.c
> @@ -890,6 +890,7 @@ static void pump_transfers(unsigned long data)
>   	u32 dma_thresh = drv_data->cur_chip->dma_threshold;
>   	u32 dma_burst = drv_data->cur_chip->dma_burst_size;
>   	u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data);
> +	int err;
>
>   	/* Get current state information */
>   	message = drv_data->cur_msg;
> @@ -1024,7 +1025,12 @@ static void pump_transfers(unsigned long data)
>   		/* Ensure we have the correct interrupt handler */
>   		drv_data->transfer_handler = pxa2xx_spi_dma_transfer;
>
> -		pxa2xx_spi_dma_prepare(drv_data, dma_burst);
> +		err = pxa2xx_spi_dma_prepare(drv_data, dma_burst);
> +		if (err) {
> +			message->status = err;
> +			giveback(drv_data);
> +			return;
> +		}
>
Hmm, I've managed to read this patch but not acked it. Luckily noticed 
it now.

Acked-by: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-01-20 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 19:50 [PATCH v1 1/1] spi: pxa2xx: handle error of pxa2xx_spi_dma_prepare() Andy Shevchenko
     [not found] ` <1450900200-120644-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-01-20 11:13   ` Jarkko Nikula

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