linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Nuno Sá" <nuno.sa@analog.com>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Benson Leung <bleung@chromium.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Claudiu Beznea <claudiu.beznea@microchip.com>,
	Tali Perry <tali.perry1@gmail.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Jonathan Cameron <jic23@kernel.org>,
	Wan Jiabing <wanjiabing@vivo.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Amit Kucheria <amitk@kernel.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Cai Huoqing <cai.huoqing@linux.dev>,
	Saravanan Sekar <sravanhome@gmail.com>,
	Avi Fishman <avifishman70@gmail.com>,
	Nancy Yuen <yuenn@google.com>,
	Guenter Roeck <groeck@chromium.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Eugen Hristev <eugen.hristev@microchip.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Olivier Moysan <olivier.moysan@foss.st.com>,
	Patrick Venture <venture@google.com>,
	Haibo Chen <haibo.chen@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Benjamin Fair <benjaminfair@google.com>,
	Thara Gopinath <thara.gopinath@linaro.org>,
	Paul Cercueil <paul@crapouillou.net>,
	Shawn Guo <shawnguo@kernel.org>
Subject: Re: [RFC PATCH 5/6] iio: inkern: move to fwnode properties
Date: Fri, 03 Jun 2022 14:52:51 +0200	[thread overview]
Message-ID: <543ab19106938b7655ee2877bf52c8e786c1c55a.camel@gmail.com> (raw)
In-Reply-To: <CAHp75VeHwqbNTMfWA03-epKaksPNgRrXh3f5hktEE0u6qjPyyw@mail.gmail.com>

On Fri, 2022-06-03 at 13:52 +0200, Andy Shevchenko wrote:
> On Thu, Jun 2, 2022 at 4:04 PM Nuno Sá <nuno.sa@analog.com> wrote:
> > 
> > This moves the IIO in kernel interface to use fwnode properties and
> > thus
> > be firmware agnostic.
> > 
> > All the users had to be naturally updated to the new interface
> > exposed by
> > IIO.
> 
> I think you may split this in an easy way, i.e. convert core to
> fwnode, while providing inliners for of_node cases (like it's done in
> IRQ domain) and then remove them after conversion.
> 

I see, in our case that might be really simple as we only have one user
of devm_of_iio_channel_get_by_name() which is the only api directly
using OF. of_iio_channel_get_by_name() has no users and all the other
public APIs use 'struct device' so we can do the conversion
internally...

> I think of_xlate is not needed to be touched at all. Let it die with
> OF altogether. Yes, it won't be fully OF-independent, but it will
> down
> the scope of the next change where you can convert of_xlate to
> something agnostic.
> 
> ...
> 
> > --- a/drivers/iio/adc/ab8500-gpadc.c
> > +++ b/drivers/iio/adc/ab8500-gpadc.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/mfd/abx500.h>
> >  #include <linux/mfd/abx500/ab8500.h>
> > +#include <linux/fwnode.h>
> 
> Ordering.
> 

The ordering is completely wrong anyways. So, I did not cared about
ordering in drivers where it was already bad. Don't mind to fix it
while adding the missing headers (if acceptable).

> ...
> 
> > --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> > +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> > @@ -21,6 +21,7 @@
> >  #include <linux/init.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/regulator/consumer.h>
> > +#include <linux/fwnode.h>
> 
> Ordering?
> 
> ...
> 
> >   * @consumer_channel:  Unique name to identify the channel on the
> > consumer
> >   *                     side. This typically describes the channels
> > use within
> 
> used / usage ?
> 
> ...
> 
> >   * @consumer_channel:  Unique name to identify the channel on the
> > consumer
> >   *                     side. This typically describes the channels
> > use within
> 
> Ditto.
> 
> >   *                     the consumer. E.g. 'battery_voltage'
> 
> ...
> 
> > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> > index 233d2e6b7721..18ca5a7cb154 100644
> > --- a/include/linux/iio/iio.h
> > +++ b/include/linux/iio/iio.h
> > @@ -10,13 +10,14 @@
> >  #include <linux/device.h>
> >  #include <linux/cdev.h>
> >  #include <linux/iio/types.h>
> > -#include <linux/of.h>
> 
> You may split this change easily since there is nothing from of.h in
> use. Just add forward declaration as you have done, but for the OF
> case.
> 
> ...
> 
> That said, I think what you need is to split this series to three
> logical parts:
> 1) shuffle header inclusions around so, iio.h will use forward
> declaration (on driver basis);
> 2) convert inkern.c to fwnode while providing OF wrappers
> (to_of_node() helps);

Just to be clear, we should still add an fwnode_xlate() callback? So we
have both temporarily and if some new driver needs this interface it
can already use it instead of of_xlate...

> 3) convert of_xlate (on driver basis it might be tricky, up to you).
> 

Yeah, I might see how easy it is to fully convert the drivers using 
of_xlate. If easy enough, I'll probably do it...

- Nuno Sá

  reply	other threads:[~2022-06-03 12:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220602140400.213449-1-nuno.sa@analog.com>
2022-06-02 14:26 ` [RFC PATCH 0/6] iio: inkern: make interface firmware agnostic Andy Shevchenko
2022-06-02 14:32 ` Andy Shevchenko
2022-06-03  7:02   ` Nuno Sá
     [not found] ` <20220602140400.213449-2-nuno.sa@analog.com>
2022-06-03 11:16   ` [RFC PATCH 1/6] iio: inkern: fix return value in devm_of_iio_channel_get_by_name() Andy Shevchenko
2022-06-03 12:36     ` Nuno Sá
2022-06-04 13:19       ` Jonathan Cameron
     [not found] ` <20220602140400.213449-4-nuno.sa@analog.com>
2022-06-03 11:29   ` [RFC PATCH 3/6] iio: treewide: explicitly add proper header files Andy Shevchenko
     [not found] ` <20220602140400.213449-5-nuno.sa@analog.com>
2022-06-03 11:37   ` [RFC PATCH 4/6] iio: inkern: split of_iio_channel_get_by_name() Andy Shevchenko
2022-06-03 12:40     ` Nuno Sá
     [not found] ` <20220602140400.213449-6-nuno.sa@analog.com>
2022-06-03 11:52   ` [RFC PATCH 5/6] iio: inkern: move to fwnode properties Andy Shevchenko
2022-06-03 12:52     ` Nuno Sá [this message]
2022-06-03 14:48       ` Andy Shevchenko
2022-06-03 11:57   ` Andy Shevchenko
2022-06-03 12:54     ` Nuno Sá
2022-06-03 14:34       ` Andy Shevchenko

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=543ab19106938b7655ee2877bf52c8e786c1c55a.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=agross@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=amitk@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=bleung@chromium.org \
    --cc=cai.huoqing@linux.dev \
    --cc=claudiu.beznea@microchip.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=eugen.hristev@microchip.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=festevam@gmail.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=haibo.chen@nxp.com \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=paul@crapouillou.net \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sravanhome@gmail.com \
    --cc=tali.perry1@gmail.com \
    --cc=thara.gopinath@linaro.org \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=wanjiabing@vivo.com \
    --cc=yuenn@google.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;
as well as URLs for NNTP newsgroup(s).