regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14

Probing of regulators can be a slow operation and can contribute to
slower boot times. This is especially true if a regulator is turned on
at probe time (with regulator-boot-on or regulator-always-on) and the
regulator requires delays (off-on-time, ramp time, etc).

While the overall kernel is not ready to switch to async probe by
default, as per the discussion on the mailing lists [1] it is believed
that the regulator subsystem is in good shape and we can move
regulator drivers over wholesale. There is no way to just magically
opt in all regulators (regulators are just normal drivers like
platform_driver), so we set PROBE_PREFER_ASYNCHRONOUS for all
regulators found in 'drivers/regulator' individually.

Given the number of drivers touched and the impossibility to test this
ahead of time, it wouldn't be shocking at all if this caused a
regression for someone. If there is a regression caused by this patch,
it's likely to be one of the cases talked about in [1]. As a "quick
fix", drivers involved in the regression could be fixed by changing
them to PROBE_FORCE_SYNCHRONOUS. That being said, the correct fix
would be to directly fix the problem that caused the issue with async
probe.

The approach here follows a similar approach that was used for the mmc
subsystem several years ago [2]. In fact, I ran nearly the same python
script to auto-generate the changes. The only thing I changed was to
search for "i2c_driver", "spmi_driver", and "spi_driver" in addition
to "platform_driver".

[1] https://lore.kernel.org/r/06db017f-e985-4434-8d1d-02ca2100cca0@sirena.org.uk
[2] https://lore.kernel.org/r/20200903232441.2694866-1-dianders@chromium.org/

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230316125351.1.I2a4677392a38db5758dee0788b2cea5872562a82@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Douglas Anderson
2023-03-16 12:54:38 -07:00
committed by Mark Brown
parent 691c1fcda5
commit 259b93b21a
114 changed files with 121 additions and 1 deletions

View File

@@ -274,6 +274,7 @@ static int pm800_regulator_probe(struct platform_device *pdev)
static struct platform_driver pm800_regulator_driver = {
.driver = {
.name = "88pm80x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = pm800_regulator_probe,
};

View File

@@ -383,6 +383,7 @@ MODULE_DEVICE_TABLE(platform, pm8607_regulator_driver_ids);
static struct platform_driver pm8607_regulator_driver = {
.driver = {
.name = "88pm860x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = pm8607_regulator_probe,
.id_table = pm8607_regulator_driver_ids,

View File

@@ -178,6 +178,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
static struct platform_driver aat2870_regulator_driver = {
.driver = {
.name = "aat2870-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = aat2870_regulator_probe,
};

View File

@@ -446,6 +446,7 @@ static struct platform_driver ab8500_ext_regulator_driver = {
.probe = ab8500_ext_regulator_probe,
.driver = {
.name = "ab8500-ext-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@@ -1737,6 +1737,7 @@ static struct platform_driver ab8500_regulator_driver = {
.probe = ab8500_regulator_probe,
.driver = {
.name = "ab8500-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@@ -789,6 +789,7 @@ MODULE_DEVICE_TABLE(i2c, act8865_ids);
static struct i2c_driver act8865_pmic_driver = {
.driver = {
.name = "act8865",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe_new = act8865_pmic_probe,
.id_table = act8865_ids,

View File

@@ -348,6 +348,7 @@ static void act8945a_pmic_shutdown(struct platform_device *pdev)
static struct platform_driver act8945a_pmic_driver = {
.driver = {
.name = "act8945a-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.pm = &act8945a_pm,
},
.probe = act8945a_pmic_probe,

View File

@@ -257,6 +257,7 @@ static struct i2c_driver ad5398_driver = {
.probe_new = ad5398_probe,
.driver = {
.name = "ad5398",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.id_table = ad5398_id,
};

View File

@@ -328,6 +328,7 @@ MODULE_DEVICE_TABLE(of, of_anatop_regulator_match_tbl);
static struct platform_driver anatop_regulator_driver = {
.driver = {
.name = "anatop_regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_anatop_regulator_match_tbl,
},
.probe = anatop_regulator_probe,

View File

@@ -380,6 +380,7 @@ static struct platform_driver arizona_ldo1_driver = {
.remove = arizona_ldo1_remove,
.driver = {
.name = "arizona-ldo1",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@@ -365,6 +365,7 @@ static struct platform_driver arizona_micsupp_driver = {
.probe = arizona_micsupp_probe,
.driver = {
.name = "arizona-micsupp",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@@ -243,6 +243,7 @@ static int as3711_regulator_probe(struct platform_device *pdev)
static struct platform_driver as3711_regulator_driver = {
.driver = {
.name = "as3711-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = as3711_regulator_probe,
};

View File

@@ -831,6 +831,7 @@ MODULE_DEVICE_TABLE(of, of_as3722_regulator_match);
static struct platform_driver as3722_regulator_driver = {
.driver = {
.name = "as3722-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_as3722_regulator_match,
},
.probe = as3722_regulator_probe,

View File

@@ -1364,6 +1364,7 @@ static struct platform_driver axp20x_regulator_driver = {
.probe = axp20x_regulator_probe,
.driver = {
.name = "axp20x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@@ -354,6 +354,7 @@ static int bcm590xx_probe(struct platform_device *pdev)
static struct platform_driver bcm590xx_regulator_driver = {
.driver = {
.name = "bcm590xx-vregs",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = bcm590xx_probe,
};

View File

@@ -353,6 +353,7 @@ MODULE_DEVICE_TABLE(platform, bd9571mwv_regulator_id_table);
static struct platform_driver bd9571mwv_regulator_driver = {
.driver = {
.name = "bd9571mwv-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.pm = DEV_PM_OPS,
},
.probe = bd9571mwv_regulator_probe,

View File

@@ -553,6 +553,7 @@ static struct platform_driver cpcap_regulator_driver = {
.probe = cpcap_regulator_probe,
.driver = {
.name = "cpcap-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(cpcap_regulator_id_table),
},
};

View File

@@ -471,6 +471,7 @@ static int da903x_regulator_probe(struct platform_device *pdev)
static struct platform_driver da903x_regulator_driver = {
.driver = {
.name = "da903x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = da903x_regulator_probe,
};

View File

@@ -438,6 +438,7 @@ static struct platform_driver da9052_regulator_driver = {
.probe = da9052_regulator_probe,
.driver = {
.name = "da9052-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@@ -576,6 +576,7 @@ static struct platform_driver da9055_regulator_driver = {
.probe = da9055_regulator_probe,
.driver = {
.name = "da9055-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

Some files were not shown because too many files have changed in this diff Show More