From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1F54A21 for ; Sat, 11 Jun 2022 15:21:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C35DC34116; Sat, 11 Jun 2022 15:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654960918; bh=3pqXIwRkCpdL23FW5mayQWHp6W7BS1dZVjgKzjnDFkg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gRYmawn2TQl74Bw/FNJHf1SJ6RAwL94/acq6k1g35qf2FOtiAN3+PihnX5bQ5hRuq 3uOrlm95IBa6x3oLDbyis8wyOj1uHpi8HmNCGoMlMNIfzh9ULQ+KeRkjppxBmhbzl1 d+nH96GOEMXAm+VfdROKid8ugRGAjmZ/iBhkTb/bFjpDF91Pe0taFShCfFdn0G8F+c ieCC0FcuZn/ZgP7lGR8Prxy6MkTWFJ8OCxjBHoqfF9f427gSJRhIH+l/onidMKd7BV HjGaJLGeQQSCS1J2IURet3Koyimbu+ry+K4+zKmyb6ZHnw7jPufymaqmNYVRg18xbt EJuPE5rmdKQ4w== Date: Sat, 11 Jun 2022 16:30:57 +0100 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: Andy Shevchenko , Nuno =?UTF-8?B?U8Oh?= , dl-linux-imx , Linux-Renesas , "open list:BROADCOM NVRAM DRIVER" , linux-arm Mailing List , chrome-platform@lists.linux.dev, Lad Prabhakar , "moderated list:ARM/Mediatek SoC support" , linux-stm32@st-md-mailman.stormreply.com, linux-arm-msm , linux-iio , OpenBMC Maillist , Cai Huoqing , Benjamin Fair , Jishnu Prakash , Linus Walleij , Lars-Peter Clausen , Alexandre Torgue , Amit Kucheria , Andy Gross , Michael Hennerich , Haibo Chen , Benson Leung , "Rafael J. Wysocki" , Alexandre Belloni , Christophe Branchereau , Patrick Venture , Arnd Bergmann , Nancy Yuen , Sascha Hauer , Daniel Lezcano , Gwendal Grignou , Saravanan Sekar , Tali Perry , Maxime Coquelin , Paul Cercueil , Thara Gopinath , Avi Fishman , Lorenzo Bianconi , Claudiu Beznea , Pengutronix Kernel Team , Fabrice Gasnier , Matthias Brugger , Tomer Maimon , Bjorn Andersson , Nicolas Ferre , Zhang Rui , Shawn Guo , Guenter Roeck , Fabio Estevam , Olivier Moysan , Eugen Hristev , Miquel Raynal Subject: Re: [PATCH 24/34] iio: inkern: move to fwnode properties Message-ID: <20220611163057.2e2606aa@jic23-huawei> In-Reply-To: <97b9278953d923008a4c1230ca9bd354117e7213.camel@gmail.com> References: <20220610084545.547700-1-nuno.sa@analog.com> <20220610084545.547700-25-nuno.sa@analog.com> <97b9278953d923008a4c1230ca9bd354117e7213.camel@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 10 Jun 2022 22:01:09 +0200 Nuno S=C3=A1 wrote: > On Fri, 2022-06-10 at 17:19 +0200, Andy Shevchenko wrote: > > On Fri, Jun 10, 2022 at 10:48 AM Nuno S=C3=A1 wrot= e: =20 > > >=20 > > > This moves the IIO in kernel interface to use fwnode properties and > > > thus > > > be firmware agnostic. > > >=20 > > > Note that the interface is still not firmware agnostic. At this > > > point we > > > have both OF and fwnode interfaces so that we don't break any user. > > > On > > > top of this we also want to have a per driver conversion and that > > > is the > > > main reason we have both of_xlate() and fwnode_xlate() support. =20 > >=20 > > Reviewed-by: Andy Shevchenko > > Thanks! > >=20 > > A few nit-picks below, though. > > =20 ... >=20 > > =20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 err =3D of_parse_phandle_with_a= rgs(np, "io-channels", > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 "#io-channel-cells", > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index, &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 err =3D fwnode_property_get_ref= erence_args(fwnode, "io- > > > channels", > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "#io-cha= nnel- > > > cells", 0, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 index, &= iiospec); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (err) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return err; > > >=20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 idev =3D bus_find_device(&iio_b= us_type, NULL, iiospec.np, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 idev =3D bus_find_device(&iio_b= us_type, NULL, iiospec.fwnode, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 iio_dev_node_match); =20 > >=20 > > Wondering if this > > https://elixir.bootlin.com/linux/v5.19-rc1/C/ident/bus_find_device_by_f= wnode > > can be utilized (yes, I noticed iio_device_type above). =20 >=20 > Hmm, at first glance I would say we can use it. AFAICT, we are already > grabbing a node which contains "#io-channel-cells" which is very > indicative that is an IIO device. I also find it very unlikely to have > two IIO devices with the same fwnode (I guess it would be an issue even > in the old code) and even more unlikely two devices of diferent types > with the same fwnode? If we are talking struct iio_dev instances, then there are quite a few cases where there are multiple with the same fwnode. We had to do that pre multiple buffers being introduced so it's fairly common, though not in ADCs which is probably why we haven't seen breakage here. Not sure how broken things already are as a result or if any of those devices (most IMUs) provide #io-channel-cells etc. I'd put that breakage down as one to look into if anyone every hits it or one of us is bored enough to poke at it. (superficially I think we'd have to check all matches for an xlate success). Also, possible (I'm not totally sure) that we have other subdevices using the same firmware node, such as triggers. I can't immediately think of why they would need it, but I'd rather we were at least partly protected against that. >=20 > Anyways, I guess Jonathan can help in here... >=20 >=20 > > =20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (idev =3D=3D NULL) { > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 of_node_put(iiospec.np); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 fwnode_handle_put(iiospec.fwnode); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return -EPROBE_DEFER; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 indio_dev =3D dev_to_iio_d= ev(idev); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 channel->indio_dev =3D ind= io_dev; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (indio_dev->info->of_xl= ate) > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D indio_dev->info->of_xlate(indio_dev, > > > &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D __fwnode_to_of_xlate(indio_dev, &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (indio_dev->info->fwnod= e_xlate) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D indio_dev->info->fwnode_xlate(indio_dev, > > > &iiospec); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D __of_iio_simple_xlate(indio_dev, &iiospec); > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of_node_put(iiospec.np); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D __fwnode_iio_simple_xlate(indio_dev, > > > &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_handle_put(iiospec.fwnod= e); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (index < 0) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 goto err_put; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 channel->channel =3D &indi= o_dev->channels[index]; > > > @@ -188,7 +209,8 @@ static int __of_iio_channel_get(struct > > > iio_channel *channel, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return index; > > > =C2=A0} > > =20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 *parent_lookup =3D false; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return chan; > > > =C2=A0} > > >=20 > > > -struct iio_channel *of_iio_channel_get_by_name(struct device_node > > > *np, > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const char *name) > > > +struct iio_channel *fwnode_iio_channel_get_by_name(struct > > > fwnode_handle *fwnode, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 const char > > > *name) > > > =C2=A0{ > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct iio_channel *chan; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct fwnode_handle *parent; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool parent_lookup =3D tru= e; > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Walk up the tree of dev= ices looking for a matching iio > > > channel */ > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 chan =3D __of_iio_channel_get_b= y_name(np, name, > > > &parent_lookup); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 chan =3D __fwnode_iio_channel_g= et_by_name(fwnode, name, > > > &parent_lookup); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!parent_lookup) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return chan; > > >=20 > > > @@ -255,33 +279,34 @@ struct iio_channel > > > *of_iio_channel_get_by_name(struct device_node *np, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * If the parent node= has a "io-channel-ranges" property, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * then we can try on= e of its channels. > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 np =3D np->parent; > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 while (np) { > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!of_get_property(np, "io-channel-ranges", > > > NULL)) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_for_each_parent_node(fwn= ode, parent) { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!fwnode_property_present(parent, "io-channel- > > > ranges")) { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_h= andle_put(parent); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retur= n chan; =20 > >=20 > > break; ? =20 >=20 > The return in place was a request from Jonathan in the RFC... :) I prefer not having to scroll down when we can get out quickly. >=20 > >=20 > > (Yes, I understand pros and cons of each variant, up to you) > > =20 > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 } > > >=20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 chan =3D __of_iio_channel_get_by_name(np, name, > > > &parent_lookup); > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!parent_lookup) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 chan =3D __fwnode_iio_channel_get_by_name(parent, > > > name, &parent_lookup); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!parent_lookup) { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_h= andle_put(parent); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retur= n chan; =20 > >=20 > > Ditto. > > =20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 np =3D np->parent; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 } > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return chan; > > > =C2=A0} > > > -EXPORT_SYMBOL_GPL(of_iio_channel_get_by_name); > > > +EXPORT_SYMBOL_GPL(fwnode_iio_channel_get_by_name); =20 > >=20 > > Wondering if we may move this to the IIO namespace. =20 >=20 > I guess it makes sense but surely on a different patch... Yup - moving to a IIO namespace is a work in progress (got snarled up by the PM related macros needed for some of the sub namespaces which is now sorted) Let's do it after this. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DEE3CC433EF for ; Sat, 11 Jun 2022 15:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+50ntpnR+wSlLVerfU89pHzK3qHTyTMtv9ok7lUB+C4=; b=PUjQ4BIPA7voHl 2lQbBmJvfrYcFM7Glgmpq3sr1zx4XIaoVT/1aaXoO/T+4S1kZ9u5tJ+VXzzTWejPvPLLVKB9dBngw PyuFsm5/81EOEKG3ji466Znwu6T8XZ0mUOhfxNIwUMH1xsmALV0r8wUizJu8lbQy8QZwGTdCFOGi9 U/Halz7bZWewpHYdOXmVtjEVu7OwMQJ9CwMIHxUlBBLop6wcK39dtSMWM23puYlGpZXKA5UZfs70g uuWVdExmBCdGes3M/7Y42Wv81LPmZfRi99dBiMRP/Sd7o99tA4d4ivBaMpH2VbUQaJLW8j0COTyVK ay0kWAKSJNZq0sUl/iuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o02wA-00DZLV-EM; Sat, 11 Jun 2022 15:22:06 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o02w6-00DZJF-KY; Sat, 11 Jun 2022 15:22:04 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1A9AB8094D; Sat, 11 Jun 2022 15:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C35DC34116; Sat, 11 Jun 2022 15:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654960918; bh=3pqXIwRkCpdL23FW5mayQWHp6W7BS1dZVjgKzjnDFkg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gRYmawn2TQl74Bw/FNJHf1SJ6RAwL94/acq6k1g35qf2FOtiAN3+PihnX5bQ5hRuq 3uOrlm95IBa6x3oLDbyis8wyOj1uHpi8HmNCGoMlMNIfzh9ULQ+KeRkjppxBmhbzl1 d+nH96GOEMXAm+VfdROKid8ugRGAjmZ/iBhkTb/bFjpDF91Pe0taFShCfFdn0G8F+c ieCC0FcuZn/ZgP7lGR8Prxy6MkTWFJ8OCxjBHoqfF9f427gSJRhIH+l/onidMKd7BV HjGaJLGeQQSCS1J2IURet3Koyimbu+ry+K4+zKmyb6ZHnw7jPufymaqmNYVRg18xbt EJuPE5rmdKQ4w== Date: Sat, 11 Jun 2022 16:30:57 +0100 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: Andy Shevchenko , Nuno =?UTF-8?B?U8Oh?= , dl-linux-imx , Linux-Renesas , "open list:BROADCOM NVRAM DRIVER" , linux-arm Mailing List , chrome-platform@lists.linux.dev, Lad Prabhakar , "moderated list:ARM/Mediatek SoC support" , linux-stm32@st-md-mailman.stormreply.com, linux-arm-msm , linux-iio , OpenBMC Maillist , Cai Huoqing , Benjamin Fair , Jishnu Prakash , Linus Walleij , Lars-Peter Clausen , Alexandre Torgue , Amit Kucheria , Andy Gross , Michael Hennerich , Haibo Chen , Benson Leung , "Rafael J. Wysocki" , Alexandre Belloni , Christophe Branchereau , Patrick Venture , Arnd Bergmann , Nancy Yuen , Sascha Hauer , Daniel Lezcano , Gwendal Grignou , Saravanan Sekar , Tali Perry , Maxime Coquelin , Paul Cercueil , Thara Gopinath , Avi Fishman , Lorenzo Bianconi , Claudiu Beznea , Pengutronix Kernel Team , Fabrice Gasnier , Matthias Brugger , Tomer Maimon , Bjorn Andersson , Nicolas Ferre , Zhang Rui , Shawn Guo , Guenter Roeck , Fabio Estevam , Olivier Moysan , Eugen Hristev , Miquel Raynal Subject: Re: [PATCH 24/34] iio: inkern: move to fwnode properties Message-ID: <20220611163057.2e2606aa@jic23-huawei> In-Reply-To: <97b9278953d923008a4c1230ca9bd354117e7213.camel@gmail.com> References: <20220610084545.547700-1-nuno.sa@analog.com> <20220610084545.547700-25-nuno.sa@analog.com> <97b9278953d923008a4c1230ca9bd354117e7213.camel@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220611_082203_007342_1F42FEF1 X-CRM114-Status: GOOD ( 36.45 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org T24gRnJpLCAxMCBKdW4gMjAyMiAyMjowMTowOSArMDIwMApOdW5vIFPDoSA8bm9uYW1lLm51bm9A Z21haWwuY29tPiB3cm90ZToKCj4gT24gRnJpLCAyMDIyLTA2LTEwIGF0IDE3OjE5ICswMjAwLCBB bmR5IFNoZXZjaGVua28gd3JvdGU6Cj4gPiBPbiBGcmksIEp1biAxMCwgMjAyMiBhdCAxMDo0OCBB TSBOdW5vIFPDoSA8bnVuby5zYUBhbmFsb2cuY29tPiB3cm90ZTogIAo+ID4gPiAKPiA+ID4gVGhp cyBtb3ZlcyB0aGUgSUlPIGluIGtlcm5lbCBpbnRlcmZhY2UgdG8gdXNlIGZ3bm9kZSBwcm9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gfQo+ID4gPiDCoMKgwqDCoMKgwqDCoCB9 Cj4gPiA+IAo+ID4gPiDCoMKgwqDCoMKgwqDCoCByZXR1cm4gY2hhbjsKPiA+ID4gwqB9Cj4gPiA+ IC1FWFBPUlRfU1lNQk9MX0dQTChvZl9paW9fY2hhbm5lbF9nZXRfYnlfbmFtZSk7Cj4gPiA+ICtF WFBPUlRfU1lNQk9MX0dQTChmd25vZGVfaWlvX2NoYW5uZWxfZ2V0X2J5X25hbWUpOyAgCj4gPiAK PiA+IFdvbmRlcmluZyBpZiB3ZSBtYXkgbW92ZSB0aGlzIHRvIHRoZSBJSU8gbmFtZXNwYWNlLiAg Cj4gCj4gSSBndWVzcyBpdCBtYWtlcyBzZW5zZSBidXQgc3VyZWx5IG9uIGEgZGlmZmVyZW50IHBh dGNoLi4uCgpZdXAgLSBtb3ZpbmcgdG8gYSBJSU8gbmFtZXNwYWNlIGlzIGEgd29yayBpbiBwcm9n cmVzcyAoZ290IHNuYXJsZWQKdXAgYnkgdGhlIFBNIHJlbGF0ZWQgbWFjcm9zIG5lZWRlZCBmb3Ig c29tZSBvZiB0aGUgc3ViIG5hbWVzcGFjZXMKd2hpY2ggaXMgbm93IHNvcnRlZCkgIExldCdzIGRv IGl0IGFmdGVyIHRoaXMuCgoKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fCkxpbnV4LW1lZGlhdGVrIG1haWxpbmcgbGlzdApMaW51eC1tZWRpYXRla0BsaXN0 cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3JnL21haWxtYW4vbGlzdGlu Zm8vbGludXgtbWVkaWF0ZWsK From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0777EC43334 for ; Thu, 16 Jun 2022 02:39:05 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LNmZv50sCz3cgY for ; Thu, 16 Jun 2022 12:39:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=gRYmawn2; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4601:e00::1; helo=ams.source.kernel.org; envelope-from=jic23@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=gRYmawn2; dkim-atps=neutral Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LL1lb5YVSz302c for ; Sun, 12 Jun 2022 01:22:03 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1A9AB8094D; Sat, 11 Jun 2022 15:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C35DC34116; Sat, 11 Jun 2022 15:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654960918; bh=3pqXIwRkCpdL23FW5mayQWHp6W7BS1dZVjgKzjnDFkg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gRYmawn2TQl74Bw/FNJHf1SJ6RAwL94/acq6k1g35qf2FOtiAN3+PihnX5bQ5hRuq 3uOrlm95IBa6x3oLDbyis8wyOj1uHpi8HmNCGoMlMNIfzh9ULQ+KeRkjppxBmhbzl1 d+nH96GOEMXAm+VfdROKid8ugRGAjmZ/iBhkTb/bFjpDF91Pe0taFShCfFdn0G8F+c ieCC0FcuZn/ZgP7lGR8Prxy6MkTWFJ8OCxjBHoqfF9f427gSJRhIH+l/onidMKd7BV HjGaJLGeQQSCS1J2IURet3Koyimbu+ry+K4+zKmyb6ZHnw7jPufymaqmNYVRg18xbt EJuPE5rmdKQ4w== Date: Sat, 11 Jun 2022 16:30:57 +0100 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Subject: Re: [PATCH 24/34] iio: inkern: move to fwnode properties Message-ID: <20220611163057.2e2606aa@jic23-huawei> In-Reply-To: <97b9278953d923008a4c1230ca9bd354117e7213.camel@gmail.com> References: <20220610084545.547700-1-nuno.sa@analog.com> <20220610084545.547700-25-nuno.sa@analog.com> <97b9278953d923008a4c1230ca9bd354117e7213.camel@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Thu, 16 Jun 2022 12:05:37 +1000 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Daniel Lezcano , Tomer Maimon , "Rafael J. Wysocki" , linux-iio , Linus Walleij , Amit Kucheria , Alexandre Torgue , Nuno =?UTF-8?B?U8Oh?= , Paul Cercueil , Miquel Raynal , Guenter Roeck , Fabio Estevam , linux-stm32@st-md-mailman.stormreply.com, chrome-platform@lists.linux.dev, Lars-Peter Clausen , Benjamin Fair , OpenBMC Maillist , Jishnu Prakash , Haibo Chen , Andy Shevchenko , Andy Gross , dl-linux-imx , Olivier Moysan , Zhang Rui , Christophe Branchereau , Bjorn Andersson , Saravanan Sekar , Michael Hennerich , linux-arm-msm , Sascha Hauer , Nicolas Ferre , Lad Prabhakar , Fabrice Gasnier , "moderated list:ARM/Mediatek SoC support" , Eugen Hristev , Matthias Brugger , Gwendal Grignou , Tali Perry , Benson Leung , Pengutronix Kernel Team , linux-arm Mailing List , Lorenzo Bianconi , Avi Fishman , Patrick Venture , "open list:BROADCOM NVRAM DRIVER" , Thara Gopinath , Linux-Renesas , Arnd Bergmann , Maxime Coquelin , Cai Huoqing , Shawn Guo , Claudiu Beznea Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Fri, 10 Jun 2022 22:01:09 +0200 Nuno S=C3=A1 wrote: > On Fri, 2022-06-10 at 17:19 +0200, Andy Shevchenko wrote: > > On Fri, Jun 10, 2022 at 10:48 AM Nuno S=C3=A1 wrot= e: =20 > > >=20 > > > This moves the IIO in kernel interface to use fwnode properties and > > > thus > > > be firmware agnostic. > > >=20 > > > Note that the interface is still not firmware agnostic. At this > > > point we > > > have both OF and fwnode interfaces so that we don't break any user. > > > On > > > top of this we also want to have a per driver conversion and that > > > is the > > > main reason we have both of_xlate() and fwnode_xlate() support. =20 > >=20 > > Reviewed-by: Andy Shevchenko > > Thanks! > >=20 > > A few nit-picks below, though. > > =20 ... >=20 > > =20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 err =3D of_parse_phandle_with_a= rgs(np, "io-channels", > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 "#io-channel-cells", > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index, &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 err =3D fwnode_property_get_ref= erence_args(fwnode, "io- > > > channels", > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "#io-cha= nnel- > > > cells", 0, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 index, &= iiospec); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (err) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return err; > > >=20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 idev =3D bus_find_device(&iio_b= us_type, NULL, iiospec.np, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 idev =3D bus_find_device(&iio_b= us_type, NULL, iiospec.fwnode, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 iio_dev_node_match); =20 > >=20 > > Wondering if this > > https://elixir.bootlin.com/linux/v5.19-rc1/C/ident/bus_find_device_by_f= wnode > > can be utilized (yes, I noticed iio_device_type above). =20 >=20 > Hmm, at first glance I would say we can use it. AFAICT, we are already > grabbing a node which contains "#io-channel-cells" which is very > indicative that is an IIO device. I also find it very unlikely to have > two IIO devices with the same fwnode (I guess it would be an issue even > in the old code) and even more unlikely two devices of diferent types > with the same fwnode? If we are talking struct iio_dev instances, then there are quite a few cases where there are multiple with the same fwnode. We had to do that pre multiple buffers being introduced so it's fairly common, though not in ADCs which is probably why we haven't seen breakage here. Not sure how broken things already are as a result or if any of those devices (most IMUs) provide #io-channel-cells etc. I'd put that breakage down as one to look into if anyone every hits it or one of us is bored enough to poke at it. (superficially I think we'd have to check all matches for an xlate success). Also, possible (I'm not totally sure) that we have other subdevices using the same firmware node, such as triggers. I can't immediately think of why they would need it, but I'd rather we were at least partly protected against that. >=20 > Anyways, I guess Jonathan can help in here... >=20 >=20 > > =20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (idev =3D=3D NULL) { > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 of_node_put(iiospec.np); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 fwnode_handle_put(iiospec.fwnode); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return -EPROBE_DEFER; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 indio_dev =3D dev_to_iio_d= ev(idev); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 channel->indio_dev =3D ind= io_dev; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (indio_dev->info->of_xl= ate) > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D indio_dev->info->of_xlate(indio_dev, > > > &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D __fwnode_to_of_xlate(indio_dev, &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (indio_dev->info->fwnod= e_xlate) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D indio_dev->info->fwnode_xlate(indio_dev, > > > &iiospec); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D __of_iio_simple_xlate(indio_dev, &iiospec); > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of_node_put(iiospec.np); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 index =3D __fwnode_iio_simple_xlate(indio_dev, > > > &iiospec); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_handle_put(iiospec.fwnod= e); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (index < 0) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 goto err_put; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 channel->channel =3D &indi= o_dev->channels[index]; > > > @@ -188,7 +209,8 @@ static int __of_iio_channel_get(struct > > > iio_channel *channel, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return index; > > > =C2=A0} > > =20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 *parent_lookup =3D false; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return chan; > > > =C2=A0} > > >=20 > > > -struct iio_channel *of_iio_channel_get_by_name(struct device_node > > > *np, > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const char *name) > > > +struct iio_channel *fwnode_iio_channel_get_by_name(struct > > > fwnode_handle *fwnode, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 const char > > > *name) > > > =C2=A0{ > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct iio_channel *chan; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct fwnode_handle *parent; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool parent_lookup =3D tru= e; > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Walk up the tree of dev= ices looking for a matching iio > > > channel */ > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 chan =3D __of_iio_channel_get_b= y_name(np, name, > > > &parent_lookup); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 chan =3D __fwnode_iio_channel_g= et_by_name(fwnode, name, > > > &parent_lookup); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!parent_lookup) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return chan; > > >=20 > > > @@ -255,33 +279,34 @@ struct iio_channel > > > *of_iio_channel_get_by_name(struct device_node *np, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * If the parent node= has a "io-channel-ranges" property, > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * then we can try on= e of its channels. > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 np =3D np->parent; > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 while (np) { > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!of_get_property(np, "io-channel-ranges", > > > NULL)) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_for_each_parent_node(fwn= ode, parent) { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!fwnode_property_present(parent, "io-channel- > > > ranges")) { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_h= andle_put(parent); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retur= n chan; =20 > >=20 > > break; ? =20 >=20 > The return in place was a request from Jonathan in the RFC... :) I prefer not having to scroll down when we can get out quickly. >=20 > >=20 > > (Yes, I understand pros and cons of each variant, up to you) > > =20 > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 } > > >=20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 chan =3D __of_iio_channel_get_by_name(np, name, > > > &parent_lookup); > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!parent_lookup) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 chan =3D __fwnode_iio_channel_get_by_name(parent, > > > name, &parent_lookup); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 if (!parent_lookup) { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fwnode_h= andle_put(parent); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 retur= n chan; =20 > >=20 > > Ditto. > > =20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 np =3D np->parent; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 } > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return chan; > > > =C2=A0} > > > -EXPORT_SYMBOL_GPL(of_iio_channel_get_by_name); > > > +EXPORT_SYMBOL_GPL(fwnode_iio_channel_get_by_name); =20 > >=20 > > Wondering if we may move this to the IIO namespace. =20 >=20 > I guess it makes sense but surely on a different patch... Yup - moving to a IIO namespace is a work in progress (got snarled up by the PM related macros needed for some of the sub namespaces which is now sorted) Let's do it after this.