[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fae735c-c227-4f60-8ba8-8cb13dfb2626@linaro.org>
Date: Mon, 6 Nov 2023 10:24:58 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: alisadariana@...il.com
Cc: Alisa-Dariana Roman <alisa.roman@...log.com>,
Alexandru Tachici <alexandru.tachici@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Maksim Kiselev <bigunclemax@...il.com>,
Cosmin Tanislav <demonsingur@...il.com>,
Arnd Bergmann <arnd@...db.de>,
Liam Beguin <liambeguin@...il.com>,
Marius Cristea <marius.cristea@...rochip.com>,
Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
ChiaEn Wu <chiaen_wu@...htek.com>,
Ivan Mikhaylov <fr0st61te@...il.com>,
Marcus Folkesson <marcus.folkesson@...il.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] iio: adc: ad7192: Use device api
On 05/11/2023 20:31, alisadariana@...il.com wrote:
> From: Alisa-Dariana Roman <alisa.roman@...log.com>
>
> Replace of.h and corresponding functions with preferred device specific
> functions.
>
> Also replace of_device_get_match_data function with
> spi_get_device_match_data.
>
> Signed-off-by: Alisa-Dariana Roman <alisa.roman@...log.com>
> ---
> drivers/iio/adc/ad7192.c | 32 +++++++++++++++-----------------
> 1 file changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index adc3cbe92d6e..48e0357564af 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -17,7 +17,6 @@
> #include <linux/err.h>
> #include <linux/sched.h>
> #include <linux/delay.h>
> -#include <linux/of.h>
>
> #include <linux/iio/iio.h>
> #include <linux/iio/sysfs.h>
> @@ -364,19 +363,19 @@ static inline bool ad7192_valid_external_frequency(u32 freq)
> freq <= AD7192_EXT_FREQ_MHZ_MAX);
> }
>
> -static int ad7192_of_clock_select(struct ad7192_state *st)
> +static int ad7192_device_clock_select(struct ad7192_state *st)
> {
> - struct device_node *np = st->sd.spi->dev.of_node;
> + struct device *dev = &st->sd.spi->dev;
> unsigned int clock_sel;
>
> clock_sel = AD7192_CLK_INT;
>
> /* use internal clock */
> if (!st->mclk) {
> - if (of_property_read_bool(np, "adi,int-clock-output-enable"))
> + if (device_property_read_bool(dev, "adi,int-clock-output-enable"))
> clock_sel = AD7192_CLK_INT_CO;
> } else {
> - if (of_property_read_bool(np, "adi,clock-xtal"))
> + if (device_property_read_bool(dev, "adi,clock-xtal"))
> clock_sel = AD7192_CLK_EXT_MCLK1_2;
> else
> clock_sel = AD7192_CLK_EXT_MCLK2;
> @@ -385,9 +384,10 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
> return clock_sel;
> }
>
> -static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np)
> +static int ad7192_setup(struct iio_dev *indio_dev)
> {
> struct ad7192_state *st = iio_priv(indio_dev);
> + struct device *dev = &st->sd.spi->dev;
> bool rej60_en, refin2_en;
> bool buf_en, bipolar, burnout_curr_en;
> unsigned long long scale_uv;
> @@ -416,26 +416,26 @@ static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np)
>
> st->conf = FIELD_PREP(AD7192_CONF_GAIN_MASK, 0);
>
> - rej60_en = of_property_read_bool(np, "adi,rejection-60-Hz-enable");
> + rej60_en = device_property_read_bool(dev, "adi,rejection-60-Hz-enable");
Not strictly related to your patch, but where are these properties
documented?
Best regards,
Krzysztof
Powered by blists - more mailing lists