iio: adc: viperboard: 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
27b832427e
commit
2191d0fba7
1 changed files with 1 additions and 11 deletions
|
@ -133,7 +133,7 @@ static int vprbrd_adc_probe(struct platform_device *pdev)
|
||||||
indio_dev->channels = vprbrd_adc_iio_channels;
|
indio_dev->channels = vprbrd_adc_iio_channels;
|
||||||
indio_dev->num_channels = ARRAY_SIZE(vprbrd_adc_iio_channels);
|
indio_dev->num_channels = ARRAY_SIZE(vprbrd_adc_iio_channels);
|
||||||
|
|
||||||
ret = iio_device_register(indio_dev);
|
ret = devm_iio_device_register(&pdev->dev, indio_dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "could not register iio (adc)");
|
dev_err(&pdev->dev, "could not register iio (adc)");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -144,22 +144,12 @@ static int vprbrd_adc_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vprbrd_adc_remove(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
|
|
||||||
|
|
||||||
iio_device_unregister(indio_dev);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct platform_driver vprbrd_adc_driver = {
|
static struct platform_driver vprbrd_adc_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "viperboard-adc",
|
.name = "viperboard-adc",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
},
|
},
|
||||||
.probe = vprbrd_adc_probe,
|
.probe = vprbrd_adc_probe,
|
||||||
.remove = vprbrd_adc_remove,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(vprbrd_adc_driver);
|
module_platform_driver(vprbrd_adc_driver);
|
||||||
|
|
Loading…
Add table
Reference in a new issue