iio: potentiometer: max5481: convert probe to device-managed
authorAlexandru Ardelean <aardelean@deviqon.com>
Thu, 24 Jun 2021 08:06:41 +0000 (11:06 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 19 Jul 2021 08:51:59 +0000 (09:51 +0100)
commitd272e0ab5f4bcaf0a29e7606854cfb5a9b725758
tree7ef26b6bf272d8cb08ae8a61ca8e2b8d749bff6e
parentc359a80ca29099be951a1fa5c7529792cadf3e8f
iio: potentiometer: max5481: convert probe to device-managed

The change converts the probe function to use the
devm_iio_device_register() function.

Before calling that, we need to register an action to store the wiper back
to non-volatile memory when the device is de-registered.

We don't need to do this if the probe fails, because the only place where
the probe can fail now is devm_iio_device_register() and that shouldn't
create an IIO device (for userspace to poke at) if it fails.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210624080641.9953-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/potentiometer/max5481.c