iio: gyro: adxrs450: Use devm_iio_device_register
devm_iio_device_register simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
79788b7c44
commit
9bcbf02ae3
|
@ -434,23 +434,14 @@ static int adxrs450_probe(struct spi_device *spi)
|
||||||
indio_dev->num_channels = ARRAY_SIZE(adxrs450_channels);
|
indio_dev->num_channels = ARRAY_SIZE(adxrs450_channels);
|
||||||
indio_dev->name = spi->dev.driver->name;
|
indio_dev->name = spi->dev.driver->name;
|
||||||
|
|
||||||
ret = iio_device_register(indio_dev);
|
ret = devm_iio_device_register(&spi->dev, indio_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Get the device into a sane initial state */
|
/* Get the device into a sane initial state */
|
||||||
ret = adxrs450_initial_setup(indio_dev);
|
ret = adxrs450_initial_setup(indio_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_initial;
|
return ret;
|
||||||
return 0;
|
|
||||||
error_initial:
|
|
||||||
iio_device_unregister(indio_dev);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int adxrs450_remove(struct spi_device *spi)
|
|
||||||
{
|
|
||||||
iio_device_unregister(spi_get_drvdata(spi));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -468,7 +459,6 @@ static struct spi_driver adxrs450_driver = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
},
|
},
|
||||||
.probe = adxrs450_probe,
|
.probe = adxrs450_probe,
|
||||||
.remove = adxrs450_remove,
|
|
||||||
.id_table = adxrs450_id,
|
.id_table = adxrs450_id,
|
||||||
};
|
};
|
||||||
module_spi_driver(adxrs450_driver);
|
module_spi_driver(adxrs450_driver);
|
||||||
|
|
Loading…
Reference in New Issue