* [PATCH v2] iio: mcp320x: Fix occasional incorrect readings
@ 2015-05-06 16:49 Michael Welling
2015-05-07 10:13 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Michael Welling @ 2015-05-06 16:49 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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: mcp320x: Fix occasional incorrect readings
2015-05-06 16:49 [PATCH v2] iio: mcp320x: Fix occasional incorrect readings Michael Welling
@ 2015-05-07 10:13 ` Jonathan Cameron
2015-05-07 23:48 ` Michael Welling
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2015-05-07 10:13 UTC (permalink / raw)
To: Michael Welling, knaack.h, lars, pmeerw, san, linux-kernel, linux-iio
On 06/05/15 17:49, Michael Welling wrote:
> Without the cacheline alignment, the readings will occasionally incorrectly
> return 0.
>
> Signed-off-by: Michael Welling <mwelling@ieee.org>
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
> ---
>
> 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,
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: mcp320x: Fix occasional incorrect readings
2015-05-07 10:13 ` Jonathan Cameron
@ 2015-05-07 23:48 ` Michael Welling
2015-05-08 10:54 ` jic23
0 siblings, 1 reply; 4+ messages in thread
From: Michael Welling @ 2015-05-07 23:48 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: knaack.h, lars, pmeerw, san, linux-kernel, linux-iio
On Thu, May 07, 2015 at 11:13:15AM +0100, Jonathan Cameron wrote:
> On 06/05/15 17:49, Michael Welling wrote:
> > Without the cacheline alignment, the readings will occasionally incorrectly
> > return 0.
> >
> > Signed-off-by: Michael Welling <mwelling@ieee.org>
> 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
> > ---
> >
> > 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,
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: mcp320x: Fix occasional incorrect readings
2015-05-07 23:48 ` Michael Welling
@ 2015-05-08 10:54 ` jic23
0 siblings, 0 replies; 4+ messages in thread
From: jic23 @ 2015-05-08 10:54 UTC (permalink / raw)
To: Michael Welling
Cc: Jonathan Cameron, knaack.h, lars, pmeerw, san, linux-kernel, linux-iio
Michael Welling writes:
> On Thu, May 07, 2015 at 11:13:15AM +0100, Jonathan Cameron wrote:
>> On 06/05/15 17:49, Michael Welling wrote:
>> > Without the cacheline alignment, the readings will occasionally incorrectly
>> > return 0.
>> >
>> > Signed-off-by: Michael Welling <mwelling@ieee.org>
>> 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
*laughs*. Hmm. 8.56pm. Chances are Mark was a beer or two down ;)
>
>> > ---
>> >
>> > 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,
>> >
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-08 10:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 16:49 [PATCH v2] iio: mcp320x: Fix occasional incorrect readings Michael Welling
2015-05-07 10:13 ` Jonathan Cameron
2015-05-07 23:48 ` Michael Welling
2015-05-08 10:54 ` jic23
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.