Commit 3e55bb6f authored by Lucas Stankus's avatar Lucas Stankus Committed by Jonathan Cameron
Browse files

iio: adc: ad7923: register device with devm_iio_device_register



Registers the device using the devm variant.
This is the final step of converting the ad7923 to only use devm routines,
meaning that the ad7923_remove() function is no longer needed to release
resources on device detach.

Signed-off-by: default avatarLucas Stankus <lucas.p.stankus@gmail.com>
Reviewed-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/b0146465d52f4e259f5f95c83c71e72f065093da.1616966903.git.lucas.p.stankus@gmail.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 075dff33
Loading
Loading
Loading
Loading
+1 −13
Original line number Original line Diff line number Diff line
@@ -313,8 +313,6 @@ static int ad7923_probe(struct spi_device *spi)


	st = iio_priv(indio_dev);
	st = iio_priv(indio_dev);


	spi_set_drvdata(spi, indio_dev);

	st->spi = spi;
	st->spi = spi;
	st->settings = AD7923_CODING | AD7923_RANGE |
	st->settings = AD7923_CODING | AD7923_RANGE |
			AD7923_PM_MODE_WRITE(AD7923_PM_MODE_OPS);
			AD7923_PM_MODE_WRITE(AD7923_PM_MODE_OPS);
@@ -356,16 +354,7 @@ static int ad7923_probe(struct spi_device *spi)
	if (ret)
	if (ret)
		return ret;
		return ret;


	return iio_device_register(indio_dev);
	return devm_iio_device_register(&spi->dev, indio_dev);
}

static int ad7923_remove(struct spi_device *spi)
{
	struct iio_dev *indio_dev = spi_get_drvdata(spi);

	iio_device_unregister(indio_dev);

	return 0;
}
}


static const struct spi_device_id ad7923_id[] = {
static const struct spi_device_id ad7923_id[] = {
@@ -398,7 +387,6 @@ static struct spi_driver ad7923_driver = {
		.of_match_table = ad7923_of_match,
		.of_match_table = ad7923_of_match,
	},
	},
	.probe		= ad7923_probe,
	.probe		= ad7923_probe,
	.remove		= ad7923_remove,
	.id_table	= ad7923_id,
	.id_table	= ad7923_id,
};
};
module_spi_driver(ad7923_driver);
module_spi_driver(ad7923_driver);