mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Welling <mwelling@ieee.org>
To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, san@rosetechnology.dk,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Cc: Michael Welling <mwelling@ieee.org>
Subject: [PATCH v2] iio: mcp320x: Fix occasional incorrect readings
Date: Wed,  6 May 2015 11:49:17 -0500	[thread overview]
Message-ID: <1430930957-14588-1-git-send-email-mwelling@ieee.org> (raw)

Without the cacheline alignment, the readings will occasionally incorrectly
return 0.

Signed-off-by: Michael Welling <mwelling@ieee.org>
---

v2: Moved buffers to the end of the mcp320x struct per suggestion to keep
them on their own cacheline.

 drivers/iio/adc/mcp320x.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index efbfd12..8d9c9b9 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -60,12 +60,12 @@ struct mcp320x {
 	struct spi_message msg;
 	struct spi_transfer transfer[2];
 
-	u8 tx_buf;
-	u8 rx_buf[2];
-
 	struct regulator *reg;
 	struct mutex lock;
 	const struct mcp320x_chip_info *chip_info;
+
+	u8 tx_buf ____cacheline_aligned;
+	u8 rx_buf[2];
 };
 
 static int mcp320x_channel_to_tx_data(int device_index,
-- 
1.7.9.5


             reply	other threads:[~2015-05-06 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 16:49 Michael Welling [this message]
2015-05-07 10:13 ` Jonathan Cameron
2015-05-07 23:48   ` Michael Welling
2015-05-08 10:54     ` jic23

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=1430930957-14588-1-git-send-email-mwelling@ieee.org \
    --to=mwelling@ieee.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=san@rosetechnology.dk \
    /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

all inboxes | Powered by JetHome®