diff options
| author | Manish Badarkhe <badarkhe.manish@gmail.com> | 2014-02-05 13:36:00 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2014-02-07 07:13:11 -0500 |
| commit | 4246e55fa830aa48cc5a7c3c023eee6553415b4b (patch) | |
| tree | e1bc8c702bc421e43d19642af94b01a140a3bfda | |
| parent | 38dbfb59d1175ef458d006556061adeaa8751b72 (diff) | |
regulator: tps6507x: Use "IS_ENABLED" for DT code.
Instead of "#ifdef CONFIG_OF" use "IS_ENABLED(CONFIG_OF)"
option for DT code to avoid if-deffery in code.
Also, modify code as per coding style.
Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
| -rw-r--r-- | drivers/regulator/tps6507x-regulator.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c index 162a0fae20b3..862cc81f822f 100644 --- a/drivers/regulator/tps6507x-regulator.c +++ b/drivers/regulator/tps6507x-regulator.c | |||
| @@ -359,7 +359,6 @@ static struct regulator_ops tps6507x_pmic_ops = { | |||
| 359 | .map_voltage = regulator_map_voltage_ascend, | 359 | .map_voltage = regulator_map_voltage_ascend, |
| 360 | }; | 360 | }; |
| 361 | 361 | ||
| 362 | #ifdef CONFIG_OF | ||
| 363 | static struct of_regulator_match tps6507x_matches[] = { | 362 | static struct of_regulator_match tps6507x_matches[] = { |
| 364 | { .name = "VDCDC1"}, | 363 | { .name = "VDCDC1"}, |
| 365 | { .name = "VDCDC2"}, | 364 | { .name = "VDCDC2"}, |
| @@ -424,15 +423,7 @@ static struct tps6507x_board *tps6507x_parse_dt_reg_data( | |||
| 424 | 423 | ||
| 425 | return tps_board; | 424 | return tps_board; |
| 426 | } | 425 | } |
| 427 | #else | 426 | |
| 428 | static inline struct tps6507x_board *tps6507x_parse_dt_reg_data( | ||
| 429 | struct platform_device *pdev, | ||
| 430 | struct of_regulator_match **tps6507x_reg_matches) | ||
| 431 | { | ||
| 432 | *tps6507x_reg_matches = NULL; | ||
| 433 | return NULL; | ||
| 434 | } | ||
| 435 | #endif | ||
| 436 | static int tps6507x_pmic_probe(struct platform_device *pdev) | 427 | static int tps6507x_pmic_probe(struct platform_device *pdev) |
| 437 | { | 428 | { |
| 438 | struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); | 429 | struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); |
| @@ -453,9 +444,10 @@ static int tps6507x_pmic_probe(struct platform_device *pdev) | |||
| 453 | */ | 444 | */ |
| 454 | 445 | ||
| 455 | tps_board = dev_get_platdata(tps6507x_dev->dev); | 446 | tps_board = dev_get_platdata(tps6507x_dev->dev); |
| 456 | if (!tps_board && tps6507x_dev->dev->of_node) | 447 | if (IS_ENABLED(CONFIG_OF) && !tps_board && |
| 448 | tps6507x_dev->dev->of_node) | ||
| 457 | tps_board = tps6507x_parse_dt_reg_data(pdev, | 449 | tps_board = tps6507x_parse_dt_reg_data(pdev, |
| 458 | &tps6507x_reg_matches); | 450 | &tps6507x_reg_matches); |
| 459 | if (!tps_board) | 451 | if (!tps_board) |
| 460 | return -EINVAL; | 452 | return -EINVAL; |
| 461 | 453 | ||
| @@ -481,7 +473,7 @@ static int tps6507x_pmic_probe(struct platform_device *pdev) | |||
| 481 | tps->info[i] = info; | 473 | tps->info[i] = info; |
| 482 | if (init_data->driver_data) { | 474 | if (init_data->driver_data) { |
| 483 | struct tps6507x_reg_platform_data *data = | 475 | struct tps6507x_reg_platform_data *data = |
| 484 | init_data->driver_data; | 476 | init_data->driver_data; |
| 485 | tps->info[i]->defdcdc_default = data->defdcdc_default; | 477 | tps->info[i]->defdcdc_default = data->defdcdc_default; |
| 486 | } | 478 | } |
| 487 | 479 | ||
