iio: adc: ti-adc161s626: Use devm managed functions for all of probe.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 16 May 2021 17:25:20 +0000 (18:25 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Jun 2021 17:24:14 +0000 (18:24 +0100)
commit09f75a2bab0394bf1bab47a476d1d187abf93c06
tree6ec74ec007f96a430d6a294be15f81e5cacf32bb
parent9ecc2ebbb6360101fed75baa0cc7c80769d00b56
iio: adc: ti-adc161s626: Use devm managed functions for all of probe.

Simplifies error handling and allows us to drop remove entirely.

The regulator handling in this driver was unusual as it would try to
acquire the regulator, but if that failed with an error would continue.

We should get a stub regulator if one isn't provided in DT and an error
could indicate an actual problem preventing the device being powered
(perhaps a need to defer). So this handling is cleaned up (arguably
that might be a fix but given no one has run into it, I haven't broken
it out separately.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-9-jic23@kernel.org
drivers/iio/adc/ti-adc161s626.c