public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] i2c: mxs: support non-dma mapable buffers
Date: Wed, 13 Feb 2013 14:21:24 +0000	[thread overview]
Message-ID: <20130213142124.GB17833@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1360763336-1931-1-git-send-email-enrico.scholz@sigma-chemnitz.de>

On Wed, Feb 13, 2013 at 02:48:56PM +0100, Enrico Scholz wrote:
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index d6abaf2..c995393 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -139,6 +139,13 @@ struct mxs_i2c_dev {
>  	uint32_t			addr_data;
>  	struct scatterlist		sg_io[2];
>  	bool				dma_read;
> +
> +	/*
> +	 * internal buffer for handling non-dma mapable buffers; when message
> +	 * exceeds the (arbitrary) size of '8', a buffer will be kmalloc()'ed
> +	 * instead of using this attribute
> +	 */
> +	unsigned char			xfer_buf[8];

Beware.  Remember that DMA cache maintanence operates on a granularity of
a cache line, and make sure that you're not going to be upset should the
cache line be read by accessing the other members of this struct.  It's
probably altogether safer if you kmalloc this buffer separately at driver
init time, and make it an "unsigned char *xfer_buf".

  reply	other threads:[~2013-02-13 14:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 13:48 [PATCH 1/3] i2c: mxs: support non-dma mapable buffers Enrico Scholz
2013-02-13 14:21 ` Russell King - ARM Linux [this message]
2013-02-13 14:26   ` Enrico Scholz

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=20130213142124.GB17833@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox