From: "Andrew F. Davis" <afd@ti.com>
To: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>, Dan Murphy <dmurphy@ti.com>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>
Cc: <linux-iio@vger.kernel.org>, <linux-api@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 4/4] iio: health: Add driver for the TI AFE4403 heart monitor
Date: Tue, 2 Feb 2016 11:38:09 -0600 [thread overview]
Message-ID: <56B0E981.5040203@ti.com> (raw)
In-Reply-To: <56ACD24E.3050308@kernel.org>
On 01/30/2016 09:10 AM, Jonathan Cameron wrote:
> On 25/01/16 17:29, Andrew F. Davis wrote:
>> +
>> +static int afe4403_read(struct afe4403_data *afe, unsigned int reg, u32 *val)
>> +{
>> + u8 tx[4] ____cacheline_aligned = {AFE440X_CONTROL0, 0x0, 0x0,
>> + AFE440X_CONTROL0_READ};
> hmm. Can you do this on the stack? Don't think so but maybe I'm wrong..
> The cachline aligned trick relies on the start of the allocation on the
> heap being aligned and then pads to ensure that the element so tagged
> is also aligned appropriately.
I am not sure ether, I think I borrowed this from some example that did
it like this, but I can't find it now. So, I'll change this to be safe.
>> + u8 rx[3];
>> + int ret;
> Even if this were possible, ret is in the same cacheline as tx and rx so
> chaos may well occur.
>
> If you really want to avoid having allocations elsewhere, just use
> spi_write_then_read(afe->spi, tx, 4, NULL, 0) and you should be fine
> as spi_write_then_read uses safe bounce buffers.
spi_write_then_read performs a memcpy to the rx buffer, even though
the length is 0 I believe it is still technically undefined behavior,
but it doesn't seem to cause any issues with the current implementation
so I'll do this.
Thanks,
Andrew
next prev parent reply other threads:[~2016-02-02 17:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1453742941-12086-1-git-send-email-afd@ti.com>
[not found] ` <1453742941-12086-5-git-send-email-afd@ti.com>
2016-01-25 20:21 ` [PATCH v4 4/4] iio: health: Add driver for the TI AFE4403 heart monitor Peter Meerwald-Stadler
2016-01-25 20:36 ` Andrew F. Davis
2016-01-30 15:10 ` Jonathan Cameron
2016-02-02 17:38 ` Andrew F. Davis [this message]
[not found] ` <1453742941-12086-3-git-send-email-afd@ti.com>
2016-01-30 14:59 ` [PATCH v4 2/4] iio: health: Add driver for the TI AFE4404 " Jonathan Cameron
2016-02-02 15:50 ` Andrew F. Davis
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=56B0E981.5040203@ti.com \
--to=afd@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-api@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@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 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).