Input: stmfts - switch to devm_regulator_bulk_get_const

Switch to devm_regulator_bulk_get_const() to stop setting the supplies
list in probe(), and move the regulator_bulk_data struct in static const.

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20260409-stmfts5-v4-3-64fe62027db5@ixit.cz
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
David Heidelberg 2026-04-26 13:05:12 -07:00 committed by Dmitry Torokhov
parent 04336c6e93
commit 18ac49e763

View File

@ -69,9 +69,9 @@
#define STMFTS_MAX_FINGERS 10
#define STMFTS_DEV_NAME "stmfts"
enum stmfts_regulators {
STMFTS_REGULATOR_VDD,
STMFTS_REGULATOR_AVDD,
static const struct regulator_bulk_data stmfts_supplies[] = {
{ .supply = "vdd" },
{ .supply = "avdd" },
};
struct stmfts_data {
@ -82,7 +82,7 @@ struct stmfts_data {
struct touchscreen_properties prop;
struct regulator_bulk_data regulators[2];
struct regulator_bulk_data *supplies;
/*
* Presence of ledvdd will be used also to check
@ -523,8 +523,8 @@ static int stmfts_power_on(struct stmfts_data *sdata)
int err;
u8 reg[8];
err = regulator_bulk_enable(ARRAY_SIZE(sdata->regulators),
sdata->regulators);
err = regulator_bulk_enable(ARRAY_SIZE(stmfts_supplies),
sdata->supplies);
if (err)
return err;
@ -589,8 +589,7 @@ static void stmfts_power_off(void *data)
struct stmfts_data *sdata = data;
disable_irq(sdata->client->irq);
regulator_bulk_disable(ARRAY_SIZE(sdata->regulators),
sdata->regulators);
regulator_bulk_disable(ARRAY_SIZE(stmfts_supplies), sdata->supplies);
}
static int stmfts_enable_led(struct stmfts_data *sdata)
@ -638,11 +637,10 @@ static int stmfts_probe(struct i2c_client *client)
mutex_init(&sdata->mutex);
init_completion(&sdata->cmd_done);
sdata->regulators[STMFTS_REGULATOR_VDD].supply = "vdd";
sdata->regulators[STMFTS_REGULATOR_AVDD].supply = "avdd";
err = devm_regulator_bulk_get(dev,
ARRAY_SIZE(sdata->regulators),
sdata->regulators);
err = devm_regulator_bulk_get_const(dev,
ARRAY_SIZE(stmfts_supplies),
stmfts_supplies,
&sdata->supplies);
if (err)
return err;