All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save
Date: Thu, 05 May 2011 10:06:30 +0100	[thread overview]
Message-ID: <4DC26896.5090800@cam.ac.uk> (raw)
In-Reply-To: <1304578268-24887-1-git-send-email-alexander.stein@systec-electronic.com>

On 05/05/11 07:51, Alexander Stein wrote:
> req.sample needs its own cacheline otherwise accessing req.msg fetches
> it in again.
> 
> Note: This effect doesn't occur if the underlying SPI driver doesn't use
> DMA at all.
I would say the comment is a bit obvious, but then you are fixing a bug
because it was wrong - so fair call.
> 
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> This obsoletes the patch
> [PATCH 1/2] ads7846: Make buffers in ads7846_read12_ser and ads7845_read12_ser DMA save
> 
>  drivers/input/touchscreen/ads7846.c |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index c24946f..ab51a8d 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -281,17 +281,25 @@ struct ser_req {
>  	u8			command;
>  	u8			ref_off;
>  	u16			scratch;
> -	__be16			sample;
>  	struct spi_message	msg;
>  	struct spi_transfer	xfer[6];
> +	/*
> +	 * DMA (thus cache coherency maintenance) requires the
> +	 * transfer buffers to live in their own cache lines.
> +	 */
> +	__be16 sample ____cacheline_aligned;
>  };
>  
>  struct ads7845_ser_req {
>  	u8			command[3];
>  	u8			pwrdown[3];
> -	u8			sample[3];
>  	struct spi_message	msg;
>  	struct spi_transfer	xfer[2];
> +	/*
> +	 * DMA (thus cache coherency maintenance) requires the
> +	 * transfer buffers to live in their own cache lines.
> +	 */
> +	u8 sample[3] ____cacheline_aligned;
>  };
>  
>  static int ads7846_read12_ser(struct device *dev, unsigned command)


  parent reply	other threads:[~2011-05-05  9:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  6:51 [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Alexander Stein
2011-05-05  6:51 ` [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req Alexander Stein
2011-05-05  9:06 ` Jonathan Cameron [this message]
2011-05-05 16:15   ` [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Dmitry Torokhov

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=4DC26896.5090800@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=alexander.stein@systec-electronic.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@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 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.