Commit 4efc1c61 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:adc:mcp3911: Switch to generic firmware properties.

This allows use of the driver with other types of firmware such as ACPI
PRP0001 based probing.

Also part of a general attempt to remove direct use of of_ specific
accessors from IIO.

Added an include for mod_devicetable.h whilst here to cover the
struct of_device_id definition.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Cc: Kent Gustavsson <kent@minoris.se>
Reviewed-by: default avatarMarcus Folkesson <marcus.folkesson@gmail.com>
parent c88eba5a
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/iio/iio.h> #include <linux/iio/iio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
...@@ -200,12 +202,13 @@ static const struct iio_info mcp3911_info = { ...@@ -200,12 +202,13 @@ static const struct iio_info mcp3911_info = {
.write_raw = mcp3911_write_raw, .write_raw = mcp3911_write_raw,
}; };
static int mcp3911_config(struct mcp3911 *adc, struct device_node *of_node) static int mcp3911_config(struct mcp3911 *adc)
{ {
struct device *dev = &adc->spi->dev;
u32 configreg; u32 configreg;
int ret; int ret;
of_property_read_u32(of_node, "device-addr", &adc->dev_addr); device_property_read_u32(dev, "device-addr", &adc->dev_addr);
if (adc->dev_addr > 3) { if (adc->dev_addr > 3) {
dev_err(&adc->spi->dev, dev_err(&adc->spi->dev,
"invalid device address (%i). Must be in range 0-3.\n", "invalid device address (%i). Must be in range 0-3.\n",
...@@ -289,7 +292,7 @@ static int mcp3911_probe(struct spi_device *spi) ...@@ -289,7 +292,7 @@ static int mcp3911_probe(struct spi_device *spi)
} }
} }
ret = mcp3911_config(adc, spi->dev.of_node); ret = mcp3911_config(adc);
if (ret) if (ret)
goto clk_disable; goto clk_disable;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment