Commit f4192c2c authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: cpcap: Convert to use of_device_get_match_data

Use of_device_get_match_data to simplify the code a bit.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2106e9bb
...@@ -505,16 +505,12 @@ MODULE_DEVICE_TABLE(of, cpcap_regulator_id_table); ...@@ -505,16 +505,12 @@ MODULE_DEVICE_TABLE(of, cpcap_regulator_id_table);
static int cpcap_regulator_probe(struct platform_device *pdev) static int cpcap_regulator_probe(struct platform_device *pdev)
{ {
struct cpcap_ddata *ddata; struct cpcap_ddata *ddata;
const struct of_device_id *match; const struct cpcap_regulator *match_data;
struct regulator_config config; struct regulator_config config;
int i; int i;
match = of_match_device(of_match_ptr(cpcap_regulator_id_table), match_data = of_device_get_match_data(&pdev->dev);
&pdev->dev); if (!match_data) {
if (!match)
return -EINVAL;
if (!match->data) {
dev_err(&pdev->dev, "no configuration data found\n"); dev_err(&pdev->dev, "no configuration data found\n");
return -ENODEV; return -ENODEV;
...@@ -529,7 +525,7 @@ static int cpcap_regulator_probe(struct platform_device *pdev) ...@@ -529,7 +525,7 @@ static int cpcap_regulator_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
ddata->dev = &pdev->dev; ddata->dev = &pdev->dev;
ddata->soc = match->data; ddata->soc = match_data;
platform_set_drvdata(pdev, ddata); platform_set_drvdata(pdev, ddata);
memset(&config, 0, sizeof(config)); memset(&config, 0, sizeof(config));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment