From: Erikas Bitovtas <xerikasxx@gmail.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Peter Meerwald" <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org,
Erikas Bitovtas <xerikasxx@gmail.com>
Subject: [PATCH v2 3/3] iio: light: vcnl4000: move client->dev in probe into a variable
Date: Thu, 12 Mar 2026 13:53:14 +0200 [thread overview]
Message-ID: <20260312-vcnl4000-regulators-v2-3-2bdebbcbb58a@gmail.com> (raw)
In-Reply-To: <20260312-vcnl4000-regulators-v2-0-2bdebbcbb58a@gmail.com>
Move client->dev into a variable of its own and replace all instances of
client->dev being used by it.
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
drivers/iio/light/vcnl4000.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 04bde498aec4..36a3d8075eb3 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -1987,9 +1987,10 @@ static int vcnl4000_probe(struct i2c_client *client)
const char * const regulator_names[] = { "vdd", "vddio", "vled" };
struct vcnl4000_data *data;
struct iio_dev *indio_dev;
+ struct device *dev = &client->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
if (!indio_dev)
return -ENOMEM;
@@ -1999,7 +2000,7 @@ static int vcnl4000_probe(struct i2c_client *client)
data->id = id->driver_data;
data->chip_spec = &vcnl4000_chip_spec_cfg[data->id];
- ret = devm_regulator_bulk_get_enable(&client->dev,
+ ret = devm_regulator_bulk_get_enable(dev,
ARRAY_SIZE(regulator_names),
regulator_names);
if (ret < 0)
@@ -2011,10 +2012,10 @@ static int vcnl4000_probe(struct i2c_client *client)
if (ret < 0)
return ret;
- dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
+ dev_dbg(dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
data->chip_spec->prod, data->rev);
- if (device_property_read_u32(&client->dev, "proximity-near-level",
+ if (device_property_read_u32(dev, "proximity-near-level",
&data->near_level))
data->near_level = 0;
@@ -2026,26 +2027,26 @@ static int vcnl4000_probe(struct i2c_client *client)
if (data->chip_spec->trig_buffer_func &&
data->chip_spec->buffer_setup_ops) {
- ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev,
+ ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
NULL,
data->chip_spec->trig_buffer_func,
data->chip_spec->buffer_setup_ops);
if (ret < 0) {
- dev_err(&client->dev,
+ dev_err(dev,
"unable to setup iio triggered buffer\n");
return ret;
}
}
if (client->irq && data->chip_spec->irq_thread) {
- ret = devm_request_threaded_irq(&client->dev, client->irq,
- NULL, data->chip_spec->irq_thread,
+ ret = devm_request_threaded_irq(dev, client->irq, NULL,
+ data->chip_spec->irq_thread,
IRQF_TRIGGER_FALLING |
IRQF_ONESHOT,
"vcnl4000_irq",
indio_dev);
if (ret < 0) {
- dev_err(&client->dev, "irq request failed\n");
+ dev_err(dev, "irq request failed\n");
return ret;
}
@@ -2054,7 +2055,7 @@ static int vcnl4000_probe(struct i2c_client *client)
return ret;
}
- ret = pm_runtime_set_active(&client->dev);
+ ret = pm_runtime_set_active(dev);
if (ret < 0)
goto fail_poweroff;
@@ -2062,9 +2063,9 @@ static int vcnl4000_probe(struct i2c_client *client)
if (ret < 0)
goto fail_poweroff;
- pm_runtime_enable(&client->dev);
- pm_runtime_set_autosuspend_delay(&client->dev, VCNL4000_SLEEP_DELAY_MS);
- pm_runtime_use_autosuspend(&client->dev);
+ pm_runtime_enable(dev);
+ pm_runtime_set_autosuspend_delay(dev, VCNL4000_SLEEP_DELAY_MS);
+ pm_runtime_use_autosuspend(dev);
return 0;
fail_poweroff:
--
2.53.0
next prev parent reply other threads:[~2026-03-12 11:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 11:53 [PATCH v2 0/3] iio: light: vcnl4000: add regulator support Erikas Bitovtas
2026-03-12 11:53 ` [PATCH v2 1/3] dt-bindings: iio: light: vcnl4000: add regulators Erikas Bitovtas
2026-03-12 17:39 ` Conor Dooley
2026-03-13 16:39 ` Erikas Bitovtas
2026-03-13 16:51 ` Conor Dooley
2026-03-12 11:53 ` [PATCH v2 2/3] iio: light: vcnl4000: add support for regulators Erikas Bitovtas
2026-03-12 14:30 ` Andy Shevchenko
2026-03-12 11:53 ` Erikas Bitovtas [this message]
2026-03-12 14:33 ` [PATCH v2 3/3] iio: light: vcnl4000: move client->dev in probe into a variable Andy Shevchenko
2026-03-12 14:34 ` [PATCH v2 0/3] iio: light: vcnl4000: add regulator support Andy Shevchenko
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=20260312-vcnl4000-regulators-v2-3-2bdebbcbb58a@gmail.com \
--to=xerikasxx@gmail.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=phone-devel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=robh@kernel.org \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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®