Re: [PATCH 14/33] staging: iio: adis16220: Use devm_iio_device_register

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

 



On 10/29/13 11:39, Sachin Kamat wrote:
> devm_iio_device_register simplifies the code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
Hmm. I've applied this one.  The driver doesn't make use
of it, but there is a power down mode on the device.  However
the part is obsolete so the chances that anyone will ever
implement that are rather low  I guess.

We can always put everything back again if we have to.  Note
for anyone reading this. The driver is a long way from compliant
with our ABI so beware of this one...

Jonathan
> ---
>  drivers/staging/iio/accel/adis16220_core.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c
> index 4c9364b..6f38ca9 100644
> --- a/drivers/staging/iio/accel/adis16220_core.c
> +++ b/drivers/staging/iio/accel/adis16220_core.c
> @@ -439,13 +439,13 @@ static int adis16220_probe(struct spi_device *spi)
>  	indio_dev->channels = adis16220_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(adis16220_channels);
>  
> -	ret = iio_device_register(indio_dev);
> +	ret = devm_iio_device_register(&spi->dev, indio_dev);
>  	if (ret)
>  		return ret;
>  
>  	ret = sysfs_create_bin_file(&indio_dev->dev.kobj, &accel_bin);
>  	if (ret)
> -		goto error_unregister_dev;
> +		return ret;
>  
>  	ret = sysfs_create_bin_file(&indio_dev->dev.kobj, &adc1_bin);
>  	if (ret)
> @@ -470,8 +470,6 @@ error_rm_adc1_bin:
>  	sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc1_bin);
>  error_rm_accel_bin:
>  	sysfs_remove_bin_file(&indio_dev->dev.kobj, &accel_bin);
> -error_unregister_dev:
> -	iio_device_unregister(indio_dev);
>  	return ret;
>  }
>  
> @@ -482,7 +480,6 @@ static int adis16220_remove(struct spi_device *spi)
>  	sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc2_bin);
>  	sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc1_bin);
>  	sysfs_remove_bin_file(&indio_dev->dev.kobj, &accel_bin);
> -	iio_device_unregister(indio_dev);
>  
>  	return 0;
>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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