Skip to contentSkip to conversation

iio: adc: rn5t618-adc: use devm_iio_map_array_register() function

PATCH In review Alexandru Ardelean 3 participants 3 messages Sep 26, 2021 – Sep 30, 2021 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: rn5t618-adc: use devm_iio_map_array_register() function

This driver already hooks a similar unwind callback via devm_add_action_or_reset().

They pretty much do the same thing, so this change converts it to the devm_iio_map_array_register().

---
 drivers/iio/adc/rn5t618-adc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/iio/adc/rn5t618-adc.c +1 -12
index c56fccb2c8e1..7d891b4ea461 100644
@@ -197,13 +197,6 @@ static struct iio_map rn5t618_maps[] = {
 	{ /* sentinel */ }
 };
 
-static void unregister_map(void *data)
-{
-	struct iio_dev *iio_dev = (struct iio_dev *) data;
-
-	iio_map_array_unregister(iio_dev);
-}
-
 static int rn5t618_adc_probe(struct platform_device *pdev)
 {
 	int ret;
@@ -254,11 +247,7 @@ static int rn5t618_adc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = iio_map_array_register(iio_dev, rn5t618_maps);
-	if (ret < 0)
-		return ret;
-
-	ret = devm_add_action_or_reset(adc->dev, unregister_map, iio_dev);
+	ret = devm_iio_map_array_register(adc->dev, iio_dev, rn5t618_maps);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Sun, 26 Sep 2021 19:28:59 +0300 Alexandru Ardelean <[email protected]>…

This driver already hooks a similar unwind callback via devm_add_action_or_reset().

They pretty much do the same thing, so this change converts it to the devm_iio_map_array_register().

---
 drivers/iio/adc/rn5t618-adc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

yes, looks sane, the patches it depens on are not in linux-next yet. But it seems that they are accepted, so:

maintainer
#2 lore raw
Quoted 9 lines · On Mon, 27 Sep 2021 22:08:34 +0200 Andreas Kemnade <[email protected]> wrote:
Quoted 6 lines · On Sun, 26 Sep 2021 19:28:59 +0300 Alexandru Ardelean <[email protected]>…

This driver already hooks a similar unwind callback via devm_add_action_or_reset().

They pretty much do the same thing, so this change converts it to the devm_iio_map_array_register().

Quoted 6 lines
Quoted 4 lines
---
 drivers/iio/adc/rn5t618-adc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)  

yes, looks sane, the patches it depens on are not in linux-next yet.

I was waiting for 0-day confirmation which for some reason has gone astray (not problems reported either). Ah well - I'll assume it's fine and risk next breakage.

Quoted 3 lines

But it seems that they are accepted, so:

Thanks and applied to the togreg branch of iio.git, pushed out as testing to see if 0-day notices this time.

Thanks,

Jonathan