iio: mcp320x: Fix occasional incorrect readings
PATCH v2 1/1 iio: mcp320x: Fix occasional incorrect readings
Without the cacheline alignment, the readings will occasionally incorrectly return 0.
---
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(-)
drivers/iio/adc/mcp320x.c +3 -3
@@ -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,
Signature · 1 line
1.7.9.5
Quoted 4 lines · Michael Welling
Without the cacheline alignment, the readings will occasionally incorrectly return 0.
Signed-off-by Michael Welling <[email protected]>
Applied to the fixes-togreg branch of iio.git. Not sure when I'll be able to push this out publicly as travelling / working nights and generally having a silly week.
J
Quoted 29 lines
---
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(-)drivers/iio/adc/mcp320x.c +3
-3@@ -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,
Quoted 10 lines · Jonathan Cameron
Quoted 4 lines · Michael Welling
Without the cacheline alignment, the readings will occasionally incorrectly return 0.
Signed-off-by Michael Welling <[email protected]>Applied to the fixes-togreg branch of iio.git. Not sure when I'll be able to push this out publicly as travelling / working nights and generally having a silly week.
J
Thanks.
Appearently code can be silly too:
https://lkml.org/lkml/2015/5/7/879
Quoted 30 lines
Quoted 29 lines
---
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(-)drivers/iio/adc/mcp320x.c +3
-3@@ -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,
Quoted 10 lines · Michael Welling
Quoted 9 lines · Jonathan Cameron
Quoted 4 lines · Michael Welling
Without the cacheline alignment, the readings will occasionally incorrectly return 0.
Signed-off-by Michael Welling <[email protected]>Applied to the fixes-togreg branch of iio.git. Not sure when I'll be able to push this out publicly as travelling / working nights and generally having a silly week.
Quoted 6 lines
Quoted 1 line
J
Thanks.
Appearently code can be silly too:
https://lkml.org/lkml/2015/5/7/879
*laughs*. Hmm. 8.56pm. Chances are Mark was a beer or two down ;)
Quoted 35 lines
Quoted 28 lines
Quoted 28 lines
---
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(-)drivers/iio/adc/mcp320x.c +3
-3@@ -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 ]; };Quoted 3 lines
drivers/iio/adc/mcp320x.c struct mcp320x { · line 71
Quoted 2 lines
drivers/iio/adc/mcp320x.c +0
-0static int mcp320x_channel_to_tx_data(int device_index,--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html