Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5404dc77 authored by Sachin Kamat's avatar Sachin Kamat Committed by Jonathan Cameron
Browse files

staging: iio: ad7816: Use devm_iio_device_register



devm_iio_device_register simplifies the code.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 8fb8125a
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -412,7 +412,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
			return ret;
	}

	ret = iio_device_register(indio_dev);
	ret = devm_iio_device_register(&spi_dev->dev, indio_dev);
	if (ret)
		return ret;

@@ -422,15 +422,6 @@ static int ad7816_probe(struct spi_device *spi_dev)
	return 0;
}

static int ad7816_remove(struct spi_device *spi_dev)
{
	struct iio_dev *indio_dev = dev_get_drvdata(&spi_dev->dev);

	iio_device_unregister(indio_dev);

	return 0;
}

static const struct spi_device_id ad7816_id[] = {
	{ "ad7816", 0 },
	{ "ad7817", 0 },
@@ -446,7 +437,6 @@ static struct spi_driver ad7816_driver = {
		.owner = THIS_MODULE,
	},
	.probe = ad7816_probe,
	.remove = ad7816_remove,
	.id_table = ad7816_id,
};
module_spi_driver(ad7816_driver);