diff options
author | Rob Herring <robh@kernel.org> | 2023-10-17 23:34:41 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-10-17 23:38:48 +0300 |
commit | 8f7e17d847edf6bc02d0813b123b9d78ba504098 (patch) | |
tree | 120904e8da64019d8776c30c7c05959470e5e9b5 /drivers/regulator/ti-abb-regulator.c | |
parent | 46537a8676d6555141c4b98ec1bf5f3eea971128 (diff) | |
download | linux-8f7e17d847edf6bc02d0813b123b9d78ba504098.tar.xz |
regulator: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203442.2699322-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/ti-abb-regulator.c')
-rw-r--r-- | drivers/regulator/ti-abb-regulator.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index 86d2d80b4b41..f48214e2c3b4 100644 --- a/drivers/regulator/ti-abb-regulator.c +++ b/drivers/regulator/ti-abb-regulator.c @@ -14,7 +14,6 @@ #include <linux/err.h> #include <linux/io.h> #include <linux/module.h> -#include <linux/of_device.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> @@ -688,7 +687,6 @@ MODULE_DEVICE_TABLE(of, ti_abb_of_match); static int ti_abb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - const struct of_device_id *match; struct resource *res; struct ti_abb *abb; struct regulator_init_data *initdata = NULL; @@ -699,21 +697,15 @@ static int ti_abb_probe(struct platform_device *pdev) char *pname; int ret = 0; - match = of_match_device(ti_abb_of_match, dev); - if (!match) { - /* We do not expect this to happen */ - dev_err(dev, "%s: Unable to match device\n", __func__); - return -ENODEV; - } - if (!match->data) { - dev_err(dev, "%s: Bad data in match\n", __func__); - return -EINVAL; - } - abb = devm_kzalloc(dev, sizeof(struct ti_abb), GFP_KERNEL); if (!abb) return -ENOMEM; - abb->regs = match->data; + + abb->regs = device_get_match_data(dev); + if (!abb->regs) { + dev_err(dev, "%s: Bad data in match\n", __func__); + return -EINVAL; + } /* Map ABB resources */ if (abb->regs->setup_off || abb->regs->control_off) { @@ -866,7 +858,7 @@ static struct platform_driver ti_abb_driver = { .driver = { .name = "ti_abb", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(ti_abb_of_match), + .of_match_table = ti_abb_of_match, }, }; module_platform_driver(ti_abb_driver); |