All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Kent Gustavsson <kent@minoris.se>,
	Marcus Folkesson <marcus.folkesson@gmail.com>
Subject: [PATCH 08/12] iio:adc:mcp3911: Switch to generic firmware properties.
Date: Sun, 28 Nov 2021 19:26:31 +0000	[thread overview]
Message-ID: <20211128192635.2724359-9-jic23@kernel.org> (raw)
In-Reply-To: <20211128192635.2724359-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Kent Gustavsson <kent@minoris.se>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/iio/adc/mcp3911.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
index e573da5397bb..f6895acb8838 100644
--- a/drivers/iio/adc/mcp3911.c
+++ b/drivers/iio/adc/mcp3911.c
@@ -10,6 +10,8 @@
 #include <linux/err.h>
 #include <linux/iio/iio.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
@@ -200,12 +202,12 @@ static const struct iio_info mcp3911_info = {
 	.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)
 {
 	u32 configreg;
 	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) {
 		dev_err(&adc->spi->dev,
 			"invalid device address (%i). Must be in range 0-3.\n",
@@ -289,7 +291,7 @@ static int mcp3911_probe(struct spi_device *spi)
 		}
 	}
 
-	ret = mcp3911_config(adc, spi->dev.of_node);
+	ret = mcp3911_config(adc, &spi->dev);
 	if (ret)
 		goto clk_disable;
 
-- 
2.34.1


  parent reply	other threads:[~2021-11-28 19:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 19:26 [PATCH 00/12] IIO: Mroe of to generic fw conversions Jonathan Cameron
2021-11-28 19:26 ` [PATCH 01/12] iio:dac:ad5755: Switch to generic firmware properties Jonathan Cameron
2021-11-28 19:40   ` Lars-Peter Clausen
2021-12-04 16:52     ` Jonathan Cameron
2021-11-28 19:26 ` [PATCH 02/12] iio:dac:ad5758: Drop unused of specific headers Jonathan Cameron
2021-11-28 19:26 ` [PATCH 03/12] iio:dac:dpot-dac: Swap of.h for mod_devicetable.h Jonathan Cameron
2021-11-28 21:46   ` Peter Rosin
2021-11-28 19:26 ` [PATCH 04/12] iio:dac:lpc18xx_dac: Swap from of* to mod_devicetable.h Jonathan Cameron
2021-11-28 19:26 ` [PATCH 05/12] iio:pot:mcp41010: Switch to generic firmware properties Jonathan Cameron
2021-11-28 19:26 ` [PATCH 06/12] iio:light:cm3605: " Jonathan Cameron
2021-11-30  0:24   ` Linus Walleij
2021-11-28 19:26 ` [PATCH 07/12] iio:adc:max9611: " Jonathan Cameron
2021-11-28 19:26 ` Jonathan Cameron [this message]
2021-11-28 19:26 ` [PATCH 09/12] iio:adc:ti-adc12138: " Jonathan Cameron
2021-11-28 19:26 ` [PATCH 10/12] iio:adc:envelope-detector: Switch from of headers to mod_devicetable.h Jonathan Cameron
2021-11-28 21:48   ` Peter Rosin
2021-11-28 19:26 ` [PATCH 11/12] iio:adc:ti-ads124s08: Drop dependency on OF Jonathan Cameron
2021-11-28 19:26 ` [PATCH 12/12] iio:adc/dac:Kconfig: Update to drop OF dependencies Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211128192635.2724359-9-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=kent@minoris.se \
    --cc=linux-iio@vger.kernel.org \
    --cc=marcus.folkesson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.