All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Paterniani <a.paterniani-03BXCEkGbFHYGGNLXY5/rw@public.gmane.org>
To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: SPI Devel General
	<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Linux ARM Kernel
	<linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
Subject: Re: [patch 2.6.28-rc5] SPI -- Freescale iMX SPI controller driver
Date: Tue, 18 Nov 2008 09:30:07 +0100	[thread overview]
Message-ID: <49227D0F.1030806@swapp-eng.it> (raw)
In-Reply-To: <200811171218.47550.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 3364 bytes --]

It's ok.
The only difference I see is a character * added a the beginning of a 
comment:

+	/* NULL rx means write-only transfer and no map needed
+	 * since rx DMA will not be used */

should be

+	/* NULL rx means write-only transfer and no map needed
+	   since rx DMA will not be used */


Regards,
- Andrea


David Brownell ha scritto:
> On Monday 17 November 2008, Andrea Paterniani wrote:
>   
>> Fix unsafe order in dma mapping operation.
>>     
>
> This arrived horribly mangled.  Can you verify that the
> appended patch is an appropriate un-mangled version?
>
> ======= CUT HERE
> From: Andrea Paterniani <a.paterniani-03BXCEkGbFHYGGNLXY5/rw@public.gmane.org>
>
> Fix unsafe order in dma mapping operation: always flush data from
> the cache *BEFORE* invalidating it, to allow full duplex transfers
> where the same buffer may be used for both writes and reads.
>
> Signed-off-by: Andrea Paterniani <a.paterniani-03BXCEkGbFHYGGNLXY5/rw@public.gmane.org>
> ---
>  drivers/spi/spi_imx.c |   45 ++++++++++++++++++++++-----------------------
>  1 file changed, 22 insertions(+), 23 deletions(-)
>
> --- a/drivers/spi/spi_imx.c
> +++ b/drivers/spi/spi_imx.c
> @@ -506,20 +506,6 @@ static int map_dma_buffers(struct driver
>  	if (!IS_DMA_ALIGNED(drv_data->rx) || !IS_DMA_ALIGNED(drv_data->tx))
>  		return -1;
>  
> -	/* NULL rx means write-only transfer and no map needed
> -	   since rx DMA will not be used */
> -	if (drv_data->rx) {
> -		buf = drv_data->rx;
> -		drv_data->rx_dma = dma_map_single(
> -					dev,
> -					buf,
> -					drv_data->len,
> -					DMA_FROM_DEVICE);
> -		if (dma_mapping_error(dev, drv_data->rx_dma))
> -			return -1;
> -		drv_data->rx_dma_needs_unmap = 1;
> -	}
> -
>  	if (drv_data->tx == NULL) {
>  		/* Read only message --> use drv_data->dummy_dma_buf for dummy
>  		   writes to achive reads */
> @@ -533,18 +519,31 @@ static int map_dma_buffers(struct driver
>  					buf,
>  					drv_data->tx_map_len,
>  					DMA_TO_DEVICE);
> -	if (dma_mapping_error(dev, drv_data->tx_dma)) {
> -		if (drv_data->rx_dma) {
> -			dma_unmap_single(dev,
> -					drv_data->rx_dma,
> -					drv_data->len,
> -					DMA_FROM_DEVICE);
> -			drv_data->rx_dma_needs_unmap = 0;
> -		}
> +	if (dma_mapping_error(dev, drv_data->tx_dma))
>  		return -1;
> -	}
>  	drv_data->tx_dma_needs_unmap = 1;
>  
> +	/* NULL rx means write-only transfer and no map needed
> +	 * since rx DMA will not be used */
> +	if (drv_data->rx) {
> +		buf = drv_data->rx;
> +		drv_data->rx_dma = dma_map_single(dev,
> +						buf,
> +						drv_data->len,
> +						DMA_FROM_DEVICE);
> +		if (dma_mapping_error(dev, drv_data->rx_dma)) {
> +			if (drv_data->tx_dma) {
> +				dma_unmap_single(dev,
> +						drv_data->tx_dma,
> +						drv_data->tx_map_len,
> +						DMA_TO_DEVICE);
> +				drv_data->tx_dma_needs_unmap = 0;
> +			}
> +			return -1;
> +		}
> +		drv_data->rx_dma_needs_unmap = 1;
> +	}
> +
>  	return 0;
>  }
>  
>
>
>   

-- 


 

------------------------------------------------------------------------

*Ing. Andrea Paterniani*

*SWAPP* - Studio Professionale
Via degli Abeti, 312 - 61100 Pesaro
Tel 0721 24256
Fax 178 220 8730
 
a.paterniani-03BXCEkGbFHYGGNLXY5/rw@public.gmane.org
www.swapp-eng.it 
<mailto:%0d%0aa.paterniani-03BXCEkGbFHYGGNLXY5/rw@public.gmane.org%0d%0awww.swapp-eng.it>

------------------------------------------------------------------------

[-- Attachment #1.2.1: Type: text/html, Size: 4583 bytes --]

[-- Attachment #1.2.2: logo.jpg --]
[-- Type: image/jpeg, Size: 43789 bytes --]

[-- Attachment #2: Type: text/plain, Size: 363 bytes --]

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

[-- Attachment #3: Type: text/plain, Size: 210 bytes --]

_______________________________________________
spi-devel-general mailing list
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

      parent reply	other threads:[~2008-11-18  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17 14:08 [patch 2.6.28-rc5] SPI -- Freescale iMX SPI controller driver Andrea Paterniani
     [not found] ` <49217ACF.7080904-03BXCEkGbFHYGGNLXY5/rw@public.gmane.org>
2008-11-17 20:18   ` David Brownell
     [not found]     ` <200811171218.47550.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-18  8:30       ` Andrea Paterniani [this message]

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=49227D0F.1030806@swapp-eng.it \
    --to=a.paterniani-03bxcekgbfhyggnlxy5/rw@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.