iio: dac: max5821: convert device register to device managed function
authorThéo Borém Fabris <theobf@usp.br>
Sat, 24 Jul 2021 22:02:00 +0000 (19:02 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 31 Jul 2021 17:17:22 +0000 (18:17 +0100)
commit6a25893cb0e255ab8888d6a4f40e8d1e9d554ad0
tree00f3601c0758410e8f293b133271601b88391ffc
parenteaaa23d71ebf0c598eedb81d4a814b0a475273f6
iio: dac: max5821: convert device register to device managed function

Add a device managed hook, via devm_add_action_or_reset() and
max5821_regulator_disable(), to disable voltage regulator on device
detach.
Replace iio_device_register() by devm_iio_device_register() and remove
the max5821_remove() function used to unregister the device and disable the
voltage regulator.
Remove i2c_set_clientdata() from the probe function, since
i2c_get_clientdata() is not used anymore.
Remove regulator_disable() calls from the probe function.

Signed-off-by: Théo Borém Fabris <theobf@usp.br>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210724220159.11998-1-theobf@usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/max5821.c