linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: robh+dt@kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
	Guenter Roeck <linux@roeck-us.net>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [RFC PATCH 9/9] iio: inkern: Drop io-channel-ranges dt property support
Date: Sun, 21 Feb 2021 16:31:21 +0000	[thread overview]
Message-ID: <20210221163121.102e3edf@archlinux> (raw)
In-Reply-To: <20201115192951.1073632-10-jic23@kernel.org>

On Sun, 15 Nov 2020 19:29:51 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> This property has been almost exclusively missused in mainline and
> we don't actually have any instances of it being necessary.
> 
> As such Rob Herring suggested we just drop it and I can't immediately
> see any reason to disagree.
> 
> If anyone has an out of tree dts file that makes use of this then let
> me know.  I'm not against keeping the code, but documenting it as a
> deprecated property not to be used in new dts files.
> 
> Note build tested only. If someone could give it a sanity check
> on a platform that uses this interface that would be great.
> If not I'll mock something up before applying this.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hi all,

I plan to apply this given no one has mentioned using it in out of tree
dts files.  If someone has time to sanity check I didn't actually mess
up the patch below that would be great!

Thanks,

Jonathan

> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/iio/inkern.c | 49 +++++++++++++++-----------------------------
>  1 file changed, 17 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index ede99e0d5371..85a6f6103ee9 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -184,40 +184,25 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
>  						      const char *name)
>  {
>  	struct iio_channel *chan = NULL;
> -
> -	/* Walk up the tree of devices looking for a matching iio channel */
> -	while (np) {
> -		int index = 0;
> -
> -		/*
> -		 * For named iio channels, first look up the name in the
> -		 * "io-channel-names" property.  If it cannot be found, the
> -		 * index will be an error code, and of_iio_channel_get()
> -		 * will fail.
> -		 */
> -		if (name)
> -			index = of_property_match_string(np, "io-channel-names",
> +	int index = 0;
> +
> +	/*
> +	 * For named iio channels, first look up the name in the
> +	 * "io-channel-names" property.  If it cannot be found, the
> +	 * index will be an error code, and of_iio_channel_get()
> +	 * will fail.
> +	 */
> +	if (name)
> +		index = of_property_match_string(np, "io-channel-names",
>  							 name);
> -		chan = of_iio_channel_get(np, index);
> -		if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER)
> -			break;
> -		else if (name && index >= 0) {
> -			pr_err("ERROR: could not get IIO channel %pOF:%s(%i)\n",
> -				np, name ? name : "", index);
> -			return NULL;
> -		}
> +	chan = of_iio_channel_get(np, index);
> +	if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER)
> +		return chan;
> +	else if (name && index >= 0)
> +		pr_err("ERROR: could not get IIO channel %pOF:%s(%i)\n",
> +		       np, name ? name : "", index);
>  
> -		/*
> -		 * No matching IIO channel found on this node.
> -		 * If the parent node has a "io-channel-ranges" property,
> -		 * then we can try one of its channels.
> -		 */
> -		np = np->parent;
> -		if (np && !of_get_property(np, "io-channel-ranges", NULL))
> -			return NULL;
> -	}
> -
> -	return chan;
> +	return NULL;
>  }
>  
>  static struct iio_channel *of_iio_channel_get_all(struct device *dev)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2021-02-21 16:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 19:29 [PATCH 0/9] dt-bindings: IIO: Drop wrong use of io-channel-ranges then drop it as well Jonathan Cameron
2020-11-15 19:29 ` [PATCH 1/9] dt-bindings:iio:qcom-spmi-vadc drop incorrect io-channel-ranges from example Jonathan Cameron
2020-11-28 15:33   ` Jonathan Cameron
2020-11-28 18:26   ` Bjorn Andersson
2020-11-15 19:29 ` [PATCH 2/9] dt-bindings:iio:samsung, exynos-adc: drop missuse of io-channel-ranges Jonathan Cameron
2020-11-17  9:49   ` [PATCH 2/9] dt-bindings:iio:samsung,exynos-adc: " Krzysztof Kozlowski
2020-11-28 15:35     ` Jonathan Cameron
2020-11-15 19:29 ` [PATCH 3/9] ARM: dts: Cygnus: Drop incorrect io-channel-ranges property Jonathan Cameron
2020-11-16  3:23   ` Florian Fainelli
2020-11-16  9:44     ` Jonathan Cameron
2020-11-15 19:29 ` [PATCH 4/9] ARM: dts: exynos: Drop incorrect use of io-channel-ranges Jonathan Cameron
2020-11-17 19:45   ` Krzysztof Kozlowski
2020-11-15 19:29 ` [PATCH 5/9] ARM: dts: s5pv210: Drop incorrect use of io-channel-ranges property Jonathan Cameron
2020-11-17 19:46   ` Krzysztof Kozlowski
2020-11-15 19:29 ` [PATCH 6/9] ARM: dts: qcom-pma8084: Drop incorrect use of io-channel-ranges Jonathan Cameron
2020-11-28 15:37   ` Jonathan Cameron
2020-11-28 18:30     ` Bjorn Andersson
2020-11-28 18:59       ` Jonathan Cameron
2020-11-15 19:29 ` [PATCH 7/9] ARM: dts: s5pv210-aries: Drop unneeded io-channel-ranges property Jonathan Cameron
2020-11-17 19:47   ` Krzysztof Kozlowski
2020-11-15 19:29 ` [PATCH 8/9] arm64: dts: exynos: Drop incorrect use of " Jonathan Cameron
2020-11-17 19:48   ` Krzysztof Kozlowski
2020-11-15 19:29 ` [RFC PATCH 9/9] iio: inkern: Drop io-channel-ranges dt property support Jonathan Cameron
2021-02-21 16:31   ` Jonathan Cameron [this message]

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=20210221163121.102e3edf@archlinux \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    /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).