Skip to contentSkip to conversation

iio: temperature: max31856: Make use of device properties

PATCH In review Andy Shevchenko 2 participants 2 messages Apr 13, 2022 – Apr 16, 2022 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: temperature: max31856: 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/temperature/max31856.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/temperature/max31856.c +3 -3
index 54840881259a..8307aae2cb45 100644
@@ -7,9 +7,11 @@
  */
 
 #include <linux/ctype.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/err.h>
+#include <linux/property.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -422,9 +424,7 @@ static int max31856_probe(struct spi_device *spi)
 	indio_dev->channels = max31856_channels;
 	indio_dev->num_channels = ARRAY_SIZE(max31856_channels);
 
-	ret = of_property_read_u32(spi->dev.of_node, "thermocouple-type",
-				   &data->thermocouple_type);
-
+	ret = device_property_read_u32(&spi->dev, "thermocouple-type", &data->thermocouple_type);
 	if (ret) {
 		dev_info(&spi->dev,
 			 "Could not read thermocouple type DT property, configuring as a K-Type\n");
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 3 lines · On Wed, 13 Apr 2022 21:50:44 +0300 Andy Shevchenko…

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

Added note on addition of mod_devicetable.h include.

Quoted 1 line

+CC Andrea and Paresh

Seems straight forward so I've applied it but there is still time for others to take a look.

Thanks,

Jonathan

Quoted 31 lines
---
 drivers/iio/temperature/max31856.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/temperature/max31856.c +3 -3
index 54840881259a..8307aae2cb45 100644
@@ -7,9 +7,11 @@
  */
 
 #include <linux/ctype.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/err.h>
+#include <linux/property.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -422,9 +424,7 @@ static int max31856_probe(struct spi_device *spi)
 	indio_dev->channels = max31856_channels;
 	indio_dev->num_channels = ARRAY_SIZE(max31856_channels);
 
-	ret = of_property_read_u32(spi->dev.of_node, "thermocouple-type",
-				   &data->thermocouple_type);
-
+	ret = device_property_read_u32(&spi->dev, "thermocouple-type", &data->thermocouple_type);
 	if (ret) {
 		dev_info(&spi->dev,
 			 "Could not read thermocouple type DT property, configuring as a K-Type\n");