Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Lin and committed by
Mark Brown
f4192c2c 2106e9bb

+4 -8
+4 -8
drivers/regulator/cpcap-regulator.c
··· 505 505 static int cpcap_regulator_probe(struct platform_device *pdev) 506 506 { 507 507 struct cpcap_ddata *ddata; 508 - const struct of_device_id *match; 508 + const struct cpcap_regulator *match_data; 509 509 struct regulator_config config; 510 510 int i; 511 511 512 - match = of_match_device(of_match_ptr(cpcap_regulator_id_table), 513 - &pdev->dev); 514 - if (!match) 515 - return -EINVAL; 516 - 517 - if (!match->data) { 512 + match_data = of_device_get_match_data(&pdev->dev); 513 + if (!match_data) { 518 514 dev_err(&pdev->dev, "no configuration data found\n"); 519 515 520 516 return -ENODEV; ··· 525 529 return -ENODEV; 526 530 527 531 ddata->dev = &pdev->dev; 528 - ddata->soc = match->data; 532 + ddata->soc = match_data; 529 533 platform_set_drvdata(pdev, ddata); 530 534 531 535 memset(&config, 0, sizeof(config));