From: Alisa-Dariana Roman <alisadariana@gmail.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alisa-Dariana Roman <alisa.roman@analog.com>,
Alexandru Tachici <alexandru.tachici@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Maksim Kiselev <bigunclemax@gmail.com>,
Cosmin Tanislav <demonsingur@gmail.com>,
Arnd Bergmann <arnd@arndb.de>, Liam Beguin <liambeguin@gmail.com>,
Marius Cristea <marius.cristea@microchip.com>,
Ibrahim Tilki <Ibrahim.Tilki@analog.com>,
ChiaEn Wu <chiaen_wu@richtek.com>,
Ivan Mikhaylov <fr0st61te@gmail.com>,
Marcus Folkesson <marcus.folkesson@gmail.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] iio: adc: ad7192: Use device api
Date: Tue, 14 Nov 2023 17:43:32 +0200 [thread overview]
Message-ID: <e4cd1c34-0127-4574-8c62-80ec25afc420@gmail.com> (raw)
In-Reply-To: <8fae735c-c227-4f60-8ba8-8cb13dfb2626@linaro.org>
On 06.11.2023 11:24, Krzysztof Kozlowski wrote:
> On 05/11/2023 20:31, alisadariana@gmail.com wrote:
>> From: Alisa-Dariana Roman <alisa.roman@analog.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@analog.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
>
Thank you for the feedback! The properties are documented in
Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml. But the
properties related to the clock configuration are indeed missing. I will
add them.
Kind regards,
Alisa-Dariana Roman
next prev parent reply other threads:[~2023-11-14 15:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 19:31 [PATCH 0/3] iio: adc: ad7192: Add support for AD7194 alisadariana
2023-11-05 19:31 ` [PATCH 1/3] iio: adc: ad7192: Use device api alisadariana
2023-11-06 9:24 ` Krzysztof Kozlowski
2023-11-14 15:43 ` Alisa-Dariana Roman [this message]
2023-11-06 10:22 ` Andy Shevchenko
2023-11-05 19:31 ` [PATCH 2/3] dt-bindings: iio: adc: ad7192: Add AD7194 support alisadariana
2023-11-06 8:56 ` Krzysztof Kozlowski
2023-11-14 16:02 ` Alisa-Dariana Roman
2023-11-14 17:39 ` Krzysztof Kozlowski
2023-11-14 18:27 ` Alisa-Dariana Roman
2023-11-14 20:32 ` Krzysztof Kozlowski
2023-11-05 19:31 ` [PATCH 3/3] " alisadariana
2023-11-06 10:27 ` Andy Shevchenko
2023-11-06 11:07 ` 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=e4cd1c34-0127-4574-8c62-80ec25afc420@gmail.com \
--to=alisadariana@gmail.com \
--cc=Ibrahim.Tilki@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.tachici@analog.com \
--cc=alisa.roman@analog.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bigunclemax@gmail.com \
--cc=chiaen_wu@richtek.com \
--cc=conor+dt@kernel.org \
--cc=demonsingur@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=fr0st61te@gmail.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lars@metafoo.de \
--cc=liambeguin@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=marius.cristea@microchip.com \
--cc=robh+dt@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox