linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296
@ 2010-01-07 10:23 Peter Korsgaard
  2010-01-11 10:57 ` Anton Vorontsov
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Korsgaard @ 2010-01-07 10:23 UTC (permalink / raw)
  To: avorontsov, dbrownell, galak, linuxppc-dev

Commit 4c1fba44296 (Add support for QE DMA mode and CPM1/CPM2 chips)
added unconditional calls to _cpm_init() / _cpm_free() from
probe()/remove(), but only checked if we're actually using CPM mode
in _init(), causing the WARN_ON in mpc8xxx_spi_free_dummy_rx() for !CPM.

Fix it by adding the same check in _cpm_free() as well.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 drivers/spi/spi_mpc8xxx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Changes since v1:
Fix return statement, mpc8xxx_spi_cpm_free() has void return type.
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index 1fb2a6e..674e7a2 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -946,6 +946,9 @@ static void mpc8xxx_spi_cpm_free(struct mpc8xxx_spi *mspi)
 {
 	struct device *dev = mspi->dev;
 
+	if (!(mspi->flags & SPI_CPM_MODE))
+		return;
+
 	dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE);
 	dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE);
 	cpm_muram_free(cpm_muram_offset(mspi->tx_bd));
-- 
1.6.5

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

* Re: [PATCHv2] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296
  2010-01-07 10:23 [PATCHv2] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296 Peter Korsgaard
@ 2010-01-11 10:57 ` Anton Vorontsov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2010-01-11 10:57 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-dev, dbrownell

On Thu, Jan 07, 2010 at 11:23:57AM +0100, Peter Korsgaard wrote:
> Commit 4c1fba44296 (Add support for QE DMA mode and CPM1/CPM2 chips)
> added unconditional calls to _cpm_init() / _cpm_free() from
> probe()/remove(), but only checked if we're actually using CPM mode
> in _init(), causing the WARN_ON in mpc8xxx_spi_free_dummy_rx() for !CPM.
> 
> Fix it by adding the same check in _cpm_free() as well.
> 
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>

Grant, can you please push it for 2.6.33?

Thanks!

> ---
>  drivers/spi/spi_mpc8xxx.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> Changes since v1:
> Fix return statement, mpc8xxx_spi_cpm_free() has void return type.
> diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
> index 1fb2a6e..674e7a2 100644
> --- a/drivers/spi/spi_mpc8xxx.c
> +++ b/drivers/spi/spi_mpc8xxx.c
> @@ -946,6 +946,9 @@ static void mpc8xxx_spi_cpm_free(struct mpc8xxx_spi *mspi)
>  {
>  	struct device *dev = mspi->dev;
>  
> +	if (!(mspi->flags & SPI_CPM_MODE))
> +		return;
> +
>  	dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE);
>  	dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE);
>  	cpm_muram_free(cpm_muram_offset(mspi->tx_bd));
> -- 
> 1.6.5
> 

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

end of thread, other threads:[~2010-01-11 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-07 10:23 [PATCHv2] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296 Peter Korsgaard
2010-01-11 10:57 ` Anton Vorontsov

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