Skip to contentSkip to conversation

iio: dac: ltc2632: Make use of device properties

PATCH Superseded Andy Shevchenko 2 participants 2 messages Apr 13, 2022 – Apr 28, 2022 IIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: dac: ltc2632: Make use of device properties

Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.

---
 drivers/iio/dac/ltc2632.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/dac/ltc2632.c +3 -3
index aed46c80757e..c0255f402056 100644
@@ -10,6 +10,7 @@
 #include <linux/spi/spi.h>
 #include <linux/module.h>
 #include <linux/iio/iio.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 
 #include <asm/unaligned.h>
@@ -362,8 +363,7 @@ static int ltc2632_probe(struct spi_device *spi)
 		}
 	}
 
-	indio_dev->name = dev_of_node(&spi->dev) ? dev_of_node(&spi->dev)->name
-						 : spi_get_device_id(spi)->name;
+	indio_dev->name = fwnode_get_name(dev_fwnode(&spi->dev)) ?: spi_get_device_id(spi)->name;
 	indio_dev->info = &ltc2632_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = chip_info->channels;
@@ -469,7 +469,7 @@ MODULE_DEVICE_TABLE(of, ltc2632_of_match);
 static struct spi_driver ltc2632_driver = {
 	.driver		= {
 		.name	= "ltc2632",
-		.of_match_table = of_match_ptr(ltc2632_of_match),
+		.of_match_table = ltc2632_of_match,
 	},
 	.probe		= ltc2632_probe,
 	.remove		= ltc2632_remove,
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 4 lines · On Wed, 13 Apr 2022 22:22:03 +0300 Andy Shevchenko…

Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.

Hi Andy,

Not sure why I was sitting on this one.

Anyhow, now applied to the togreg branch of iio.git and pushed out as testing for all the normal reasons.

Thanks,

Jonathan

Quoted 35 lines
---
 drivers/iio/dac/ltc2632.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/dac/ltc2632.c +3 -3
index aed46c80757e..c0255f402056 100644
@@ -10,6 +10,7 @@
 #include <linux/spi/spi.h>
 #include <linux/module.h>
 #include <linux/iio/iio.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 
 #include <asm/unaligned.h>
@@ -362,8 +363,7 @@ static int ltc2632_probe(struct spi_device *spi)
 		}
 	}
 
-	indio_dev->name = dev_of_node(&spi->dev) ? dev_of_node(&spi->dev)->name
-						 : spi_get_device_id(spi)->name;
+	indio_dev->name = fwnode_get_name(dev_fwnode(&spi->dev)) ?: spi_get_device_id(spi)->name;
 	indio_dev->info = &ltc2632_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = chip_info->channels;
@@ -469,7 +469,7 @@ MODULE_DEVICE_TABLE(of, ltc2632_of_match);
 static struct spi_driver ltc2632_driver = {
 	.driver		= {
 		.name	= "ltc2632",
-		.of_match_table = of_match_ptr(ltc2632_of_match),
+		.of_match_table = ltc2632_of_match,
 	},
 	.probe		= ltc2632_probe,
 	.remove		= ltc2632_remove,