public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: mcp320x: Fix occasional incorrect readings
@ 2015-05-05 16:29 Michael Welling
  2015-05-05 17:29 ` Lars-Peter Clausen
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Welling @ 2015-05-05 16:29 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, san, linux-kernel, linux-iio
  Cc: Michael Welling

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

Signed-off-by: Michael Welling <mwelling@ieee.org>
---
 drivers/iio/adc/mcp320x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index efbfd12..46b98cf 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -60,7 +60,7 @@ struct mcp320x {
 	struct spi_message msg;
 	struct spi_transfer transfer[2];
 
-	u8 tx_buf;
+	u8 tx_buf ____cacheline_aligned;
 	u8 rx_buf[2];
 
 	struct regulator *reg;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: mcp320x: Fix occasional incorrect readings
  2015-05-05 16:29 [PATCH] iio: mcp320x: Fix occasional incorrect readings Michael Welling
@ 2015-05-05 17:29 ` Lars-Peter Clausen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars-Peter Clausen @ 2015-05-05 17:29 UTC (permalink / raw)
  To: Michael Welling, jic23, knaack.h, pmeerw, san, linux-kernel,
	linux-iio

On 05/05/2015 06:29 PM, Michael Welling wrote:
> Without the cacheline alignment, the readings will occasionally incorrectly
> return 0.
>
> Signed-off-by: Michael Welling <mwelling@ieee.org>
> ---
>   drivers/iio/adc/mcp320x.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
> index efbfd12..46b98cf 100644
> --- a/drivers/iio/adc/mcp320x.c
> +++ b/drivers/iio/adc/mcp320x.c
> @@ -60,7 +60,7 @@ struct mcp320x {
>   	struct spi_message msg;
>   	struct spi_transfer transfer[2];
>
> -	u8 tx_buf;
> +	u8 tx_buf ____cacheline_aligned;
>   	u8 rx_buf[2];

The buffers should probably be moved at the end, e.g. reg will still be on 
the same cacheline.

>
>   	struct regulator *reg;




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-05 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05 16:29 [PATCH] iio: mcp320x: Fix occasional incorrect readings Michael Welling
2015-05-05 17:29 ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox