Re: [RFC PATCH 9/9] iio: inkern: Drop io-channel-ranges dt property support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
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@xxxxxxxxxxxx>
> Cc: Lars-Peter Clausen <lars@xxxxxxxxxx>
> ---
>  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)




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux