mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Antoniu Miclaus <antoniu.miclaus@analog.com>
To: "Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 11/12] iio: filter: admv8818: add dev variable
Date: Fri, 27 Feb 2026 16:01:40 +0200	[thread overview]
Message-ID: <20260227140152.77529-12-antoniu.miclaus@analog.com> (raw)
In-Reply-To: <20260227140152.77529-1-antoniu.miclaus@analog.com>

Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/filter/admv8818.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c
index 19f823446cda..5fafd71da2b3 100644
--- a/drivers/iio/filter/admv8818.c
+++ b/drivers/iio/filter/admv8818.c
@@ -701,12 +701,12 @@ static int admv8818_init(struct admv8818_state *st)
 
 static int admv8818_clk_setup(struct admv8818_state *st)
 {
-	struct spi_device *spi = st->spi;
+	struct device *dev = &st->spi->dev;
 	int ret;
 
-	st->clkin = devm_clk_get_optional(&spi->dev, "rf_in");
+	st->clkin = devm_clk_get_optional(dev, "rf_in");
 	if (IS_ERR(st->clkin))
-		return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
+		return dev_err_probe(dev, PTR_ERR(st->clkin),
 				     "failed to get the input clock\n");
 	else if (!st->clkin)
 		return 0;
@@ -715,7 +715,7 @@ static int admv8818_clk_setup(struct admv8818_state *st)
 	if (ret)
 		return ret;
 
-	ret = devm_add_action_or_reset(&spi->dev, admv8818_clk_disable, st);
+	ret = devm_add_action_or_reset(dev, admv8818_clk_disable, st);
 	if (ret)
 		return ret;
 
@@ -724,16 +724,16 @@ static int admv8818_clk_setup(struct admv8818_state *st)
 	if (ret < 0)
 		return ret;
 
-	return devm_add_action_or_reset(&spi->dev, admv8818_clk_notifier_unreg, st);
+	return devm_add_action_or_reset(dev, admv8818_clk_notifier_unreg, st);
 }
 
 static int admv8818_read_properties(struct admv8818_state *st)
 {
-	struct spi_device *spi = st->spi;
+	struct device *dev = &st->spi->dev;
 	u32 mhz;
 	int ret;
 
-	ret = device_property_read_u32(&spi->dev, "adi,lpf-margin-mhz", &mhz);
+	ret = device_property_read_u32(dev, "adi,lpf-margin-mhz", &mhz);
 	if (ret == 0)
 		st->lpf_margin_hz = (u64)mhz * HZ_PER_MHZ;
 	else if (ret == -EINVAL)
@@ -742,7 +742,7 @@ static int admv8818_read_properties(struct admv8818_state *st)
 		return ret;
 
 
-	ret = device_property_read_u32(&spi->dev, "adi,hpf-margin-mhz", &mhz);
+	ret = device_property_read_u32(dev, "adi,hpf-margin-mhz", &mhz);
 	if (ret == 0)
 		st->hpf_margin_hz = (u64)mhz * HZ_PER_MHZ;
 	else if (ret == -EINVAL)
@@ -758,9 +758,10 @@ static int admv8818_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	struct regmap *regmap;
 	struct admv8818_state *st;
+	struct device *dev = &spi->dev;
 	int ret;
 
-	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
 	if (!indio_dev)
 		return -ENOMEM;
 
@@ -792,7 +793,7 @@ static int admv8818_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	return devm_iio_device_register(&spi->dev, indio_dev);
+	return devm_iio_device_register(dev, indio_dev);
 }
 
 static const struct spi_device_id admv8818_id[] = {
-- 
2.43.0


  parent reply	other threads:[~2026-02-27 14:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 14:01 [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 01/12] iio: frequency: adrf6780: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 02/12] iio: frequency: adrf6780: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 03/12] iio: frequency: admv1014: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 04/12] iio: frequency: admv1014: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 05/12] iio: frequency: admv1013: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 06/12] iio: frequency: admv1013: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 07/12] iio: frequency: adf4377: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 08/12] iio: frequency: adf4377: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 09/12] iio: dac: ad7293: add dev variable Antoniu Miclaus
2026-02-27 14:01 ` [PATCH v4 10/12] iio: dac: ad7293: use dev_err_probe Antoniu Miclaus
2026-02-27 14:01 ` Antoniu Miclaus [this message]
2026-02-27 14:01 ` [PATCH v4 12/12] iio: filter: admv8818: " Antoniu Miclaus
2026-02-27 15:03 ` [PATCH v4 00/12] iio: use dev_err_probe in probe path for ADI drivers Andy Shevchenko
2026-02-28 11:37   ` 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=20260227140152.77529-12-antoniu.miclaus@analog.com \
    --to=antoniu.miclaus@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®