iio: adc: lpc18xx_adc: Convert probe to device managed version
authorAndré Gustavo Nakagomi Lopez <andregnl@usp.br>
Fri, 15 Oct 2021 18:47:12 +0000 (15:47 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 20 Oct 2021 13:43:51 +0000 (14:43 +0100)
commit0be844470eb929dd2a1388c6dc6d7d6ea2edaf2e
tree8896e9c31efb22a5a052efe00a26202f107bf7e5
parent26fa68c1d7a1d6504d6cc158db015acc1a8bc0fd
iio: adc: lpc18xx_adc: Convert probe to device managed version

The remove function and the goto sections are not necessary if devm
functions are used.

Convert device register to devm version. Add hook functions to release
device resources, and use them inside probe with devm_add_action,
which will release resources on driver detach.

To maintain the order of which device resources were released/reseted,
register the hook functions as soon as resources are obtained/initialized.
Since devres actions are called on driver detach, the remove
function and the error-handling goto sections are no longer necessary.

Signed-off-by: André Gustavo Nakagomi Lopez <andregnl@usp.br>
Link: https://lore.kernel.org/r/YWnMsGlc/I35gYvy@Andryuu.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/lpc18xx_adc.c