Re: [PATCH 21/22] iio/ti_am335x_adc: Allow to specify input line

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

 



> @@ -199,8 +213,11 @@ static int tiadc_probe(struct platform_device *pdev)
>  	struct tiadc_device	*adc_dev;
>  	struct ti_tscadc_dev	*tscadc_dev = ti_tscadc_dev_get(pdev);
>  	struct device_node	*node = tscadc_dev->dev->of_node;
> +	struct property		*prop;
> +	const __be32		*cur;
>  	int			err;
> -	u32			val32;
> +	u32			val;
> +	int channels		= 0;

The indention here looks a bit strange.

>  
>  	if (!node) {
>  		dev_err(&pdev->dev, "Could not find valid DT data.\n");
> @@ -222,11 +239,13 @@ static int tiadc_probe(struct platform_device *pdev)
>  		err = -EINVAL;
>  		goto err_free_device;
>  	}
> -	err = of_property_read_u32(node,
> -			"ti,adc-channels", &val32);
> -	if (err < 0)
> -		goto err_free_device;
> -	adc_dev->channels = val32;
> +
> +	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
> +

No need for the extra new line

> +		adc_dev->channel_line[channels] = val;
> +		channels++;

You should make sure that channels is never >= 8

> +	}
> +	adc_dev->channels = channels;
>  
>  	indio_dev->dev.parent = &pdev->dev;
>  	indio_dev->name = dev_name(&pdev->dev);
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux