From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org,
linux-amlogic@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-imx@nxp.com,
Chen-Yu Tsai <wens@csie.org>,
Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com>,
Ciprian Regus <ciprian.regus@analog.com>,
Vladimir Zapolskiy <vz@mleia.com>,
Cixi Geng <cixi.geng1@unisoc.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Heiko Stuebner <heiko@sntech.de>,
Fabio Estevam <festevam@gmail.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Hans de Goede <hdegoede@redhat.com>,
Alexandru Ardelean <aardelean@deviqon.com>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Haibo Chen <haibo.chen@nxp.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jyoti Bhayana <jbhayana@google.com>,
Jonathan Cameron <jic23@kernel.org>,
Florian Boor <florian.boor@kernelconcepts.de>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Orson Zhai <orsonzhai@gmail.com>,
Shawn Guo <shawnguo@kernel.org>,
Kevin Hilman <khilman@baylibre.com>
Subject: Re: [PATCH v3 0/4] Make 'mlock' really private
Date: Wed, 12 Oct 2022 20:49:13 +0300 [thread overview]
Message-ID: <CAHp75VcUaSaAQ5Gs32bmpUyROqRLjMuDykdKp34p+2DYsovSPw@mail.gmail.com> (raw)
In-Reply-To: <20221012151620.1725215-1-nuno.sa@analog.com>
On Wed, Oct 12, 2022 at 6:15 PM Nuno Sá <nuno.sa@analog.com> wrote:
>
> This patchset cleans all the drivers directly using the iio_device 'mlock'.
> This lock is private and should not be used outside the core (or by using
> proper helpers).
>
> Most of the conversions where straight, but there are some that really need
> extra looking. Mainly patches [13/15] and [14/15] were a bit hacky since
> iio_device_claim_direct_mode() does not fit 100%. The reason is that we
> want to check if the device is buffering and do something if it is (in
> which case the API return -EBUSY and released the lock. I just used a
> combinations of locks to get around this (hopefully I did not messed up).
>
> Note that this series was only compiled tested using allyesconfig for
> ARM. I ran 'git grep' to make sure there were no more users of 'mlock'.
> Hopefully I covered them all...
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
I haven't seen any serious issues, some small ones regarding spelling,
indentation and comment are per individual patches.
> v2:
>
> [PATCH 1-8, 10-12/16]
> * Mention the inclusion of mutex.h in the commit message.
>
> [PATCH 1-8, 10, 12/16]
> * Initialize mutex as late as possible.
> Note that [PATCH 11/16] was not included since the code to do so was not
> direct enough. Would need to get a pointer to the private struture
> outside of scmi_alloc_iiodev() to do it. While not hard, the added changes
> in the code is not really worth it (IMO of course).
>
> [PATCH 1/16]
> * Refactored the commit message a bit. I guess this one will still needs
> more discussion...
>
> [PATCH 9/16]
> * New patch to add an helper function to read the samples.
>
> [PATCH 13/16]
> * New patch to introduce iio_device_{claim|release}_buffer_mode() APIs.
>
> [PATCH 14/16]
> * Make use of the new iio_device_{claim|release}_buffer_mode() helpers
>
> [PATCH 15/16]
> * Make use of the new iio_device_{claim|release}_buffer_mode() helpers
> in combination with claim_direct_mode(). This is needed so that we make sure
> we always get one of the modes (and hence the iio_dev lock) to safely call
> max30102_get_temp(). Note that I'm not particular "happy" with the code but
> OTOH, it does not look as bad as I thought :). Anyways, if there are no
> complains with it, I'm ok to leave it as-is. Otherwise, I think we can think
> on the flag approach (briefly discussed in the first series).
>
> v3:
>
> [PATCH 1/4]
> * fix 'make W=1' warning about prototypes mismatch.
>
> [PATCH 2/4]
> * improved commit message to explain why we are shadowing error codes.
>
> [PATCH 4/4]
> * minor English fix on the commit message (as suggested by Andy).
>
> Nuno Sá (4):
> iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs
> iio: health: max30100: do not use internal iio_dev lock
> iio: health: max30102: do not use internal iio_dev lock
> iio: core: move 'mlock' to 'struct iio_dev_opaque'
>
> drivers/iio/TODO | 3 --
> drivers/iio/health/max30100.c | 9 ++---
> drivers/iio/health/max30102.c | 19 +++++++---
> drivers/iio/industrialio-buffer.c | 29 ++++++++-------
> drivers/iio/industrialio-core.c | 58 +++++++++++++++++++++++++-----
> drivers/iio/industrialio-event.c | 4 +--
> drivers/iio/industrialio-trigger.c | 12 +++----
> include/linux/iio/iio-opaque.h | 2 ++
> include/linux/iio/iio.h | 5 ++-
> 9 files changed, 97 insertions(+), 44 deletions(-)
>
> --
> 2.38.0
>
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-10-12 17:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 15:16 Nuno Sá
2022-10-12 15:16 ` [PATCH v3 1/4] iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs Nuno Sá
2022-10-12 17:41 ` Andy Shevchenko
2022-10-12 15:16 ` [PATCH v3 2/4] iio: health: max30100: do not use internal iio_dev lock Nuno Sá
2022-10-12 17:46 ` Andy Shevchenko
2022-10-14 7:16 ` Nuno Sá
2022-10-12 15:16 ` [PATCH v3 3/4] iio: health: max30102: " Nuno Sá
2022-10-12 18:45 ` Miquel Raynal
2022-10-14 7:25 ` Nuno Sá
2022-10-14 15:21 ` Jonathan Cameron
2022-10-12 15:16 ` [PATCH v3 4/4] iio: core: move 'mlock' to 'struct iio_dev_opaque' Nuno Sá
2022-10-12 17:49 ` Andy Shevchenko [this message]
2022-10-15 16:10 ` [PATCH v3 0/4] Make 'mlock' really private 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=CAHp75VcUaSaAQ5Gs32bmpUyROqRLjMuDykdKp34p+2DYsovSPw@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=aardelean@deviqon.com \
--cc=andriy.tryshnivskyy@opensynergy.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=ciprian.regus@analog.com \
--cc=cixi.geng1@unisoc.com \
--cc=festevam@gmail.com \
--cc=florian.boor@kernelconcepts.de \
--cc=haibo.chen@nxp.com \
--cc=hdegoede@redhat.com \
--cc=heiko@sntech.de \
--cc=jbhayana@google.com \
--cc=jbrunet@baylibre.com \
--cc=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=lars@metafoo.de \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-rockchip@lists.infradead.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=miquel.raynal@bootlin.com \
--cc=narmstrong@baylibre.com \
--cc=nuno.sa@analog.com \
--cc=orsonzhai@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=vz@mleia.com \
--cc=wens@csie.org \
--cc=zhang.lyra@gmail.com \
/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®