linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	"Gaëtan André" <rvlander@gaetanandre.eu>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Denis Ciocca" <denis.ciocca@st.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Peter Meerwald-Stadler" <pmeerw@pmeerw.net>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Matija Podravec" <matija_podravec@fastmail.fm>,
	"Sergey Borishchenko" <borischenko.sergey@gmail.com>
Subject: Re: [PATCH v1 6/7] iio: st_sensors: Add lsm9ds0 IMU support
Date: Sun, 18 Apr 2021 16:59:02 +0300	[thread overview]
Message-ID: <CAHp75VeRgGcat18p+dN+pbHEYqm+YLGB_06kFEjFsahB2EW9Fw@mail.gmail.com> (raw)
In-Reply-To: <CAHp75Vcrf02cVaeDevN-cEFFTPoxq6kyO3gGQYTcs-U4yHOFaQ@mail.gmail.com>

On Sun, Apr 18, 2021 at 4:49 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Sun, Apr 18, 2021 at 2:07 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> Thanks for review, my answers below.
>
> > On Wed, 14 Apr 2021 22:54:53 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > We can utilize separate drivers for accelerometer and magnetometer,
> > > so here is the glue driver to enable LSM9DS0 IMU support.
> > >
> > > The idea was suggested by Crestez Dan Leonard in [1]. The proposed change
> > > was sent as RFC due to race condition concerns, which are indeed possible.
> >
> > If you are going to mention races, good to give some flavour in here!
>
> I meant that the initial idea is racy due to different devices
> communicating to the same i2c address.
> So, any sequence of transfers are not serialized and you may end up with
>
> drv1 -> i2c
> drv2 -> i2c
> drv1 <- i2c # garbage
>
> > This driver makes me very nervous indeed.
>
> Why?! This one is race free as far as I can see. Or maybe I interpret
> this wrongly and you are talking about initial RFC?
>
> >  I haven't 'found' any places
> > where the fact we'll write the same registers from each of the drivers
> > causes problems (e.g. int pin setup etc) but perhaps I'm missing something.
> >
> > Shall we say that makes me rather keener to get eyes (and thought) on this
> > patch than normal :)
>
> How should I amend the commit message to state:
> 1. First idea (RFC by the link) *is* racy AFAIU
> 2. This one *is not* racy.

I re-read this and now understand better what you meant.
So, it may be that the initial proposal may work without any
amendment, but since I haven't investigated much, I should rather use
the phrase "potentially racy". In my variant it's using one regmap for
both drivers (not two), which makes the register state consistent. Am
I wrong?
Do we have some places where we may write to the same register concurrently?

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-04-18 13:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 19:54 [PATCH v1 1/7] iio: accel: st_accel: Move platform data from header to C file Andy Shevchenko
2021-04-14 19:54 ` [PATCH v1 2/7] iio: gyro: st_gyro: " Andy Shevchenko
2021-04-14 19:54 ` [PATCH v1 3/7] iio: magnetometer: st_magn: Provide default platform data Andy Shevchenko
2021-04-14 19:54 ` [PATCH v1 4/7] iio: st_sensors: Call st_sensors_power_enable() from bus drivers Andy Shevchenko
2021-04-18 10:54   ` Jonathan Cameron
2021-04-18 13:36     ` Andy Shevchenko
2021-04-18 19:09     ` Andy Shevchenko
2021-04-14 19:54 ` [PATCH v1 5/7] iio: st_sensors: Make accel, gyro, magn and pressure probe shared Andy Shevchenko
2021-04-14 19:54 ` [PATCH v1 6/7] iio: st_sensors: Add lsm9ds0 IMU support Andy Shevchenko
2021-04-18 11:06   ` Jonathan Cameron
2021-04-18 13:49     ` Andy Shevchenko
2021-04-18 13:59       ` Andy Shevchenko [this message]
2021-04-18 16:45         ` Jonathan Cameron
2021-04-14 19:54 ` [PATCH v1 7/7] dt-bindings: iio: st,st-sensors: Add LSM9DS0 compatible string Andy Shevchenko
2021-04-20 19:55   ` Rob Herring
2021-05-03 12:09   ` Jonathan Cameron

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=CAHp75VeRgGcat18p+dN+pbHEYqm+YLGB_06kFEjFsahB2EW9Fw@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=borischenko.sergey@gmail.com \
    --cc=denis.ciocca@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matija_podravec@fastmail.fm \
    --cc=nuno.sa@analog.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=rvlander@gaetanandre.eu \
    /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).