* [PATCH] regulator: tps6507x: Use "IS_ENABLED" for DT code.
@ 2014-02-05 15:35 Manish Badarkhe
0 siblings, 0 replies; only message in thread
From: Manish Badarkhe @ 2014-02-05 15:35 UTC (permalink / raw)
To: linux-kernel, davinci-linux-open-source
Cc: broonie, lgirdwood, badarkhe.manish
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>
---
:100644 100644 162a0fa... 97868b7... M drivers/regulator/tps6507x-regulator.c
drivers/regulator/tps6507x-regulator.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 162a0fa..97868b7 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -367,6 +367,7 @@ static struct of_regulator_match tps6507x_matches[] = {
{ .name = "LDO1"},
{ .name = "LDO2"},
};
+#endif
static struct tps6507x_board *tps6507x_parse_dt_reg_data(
struct platform_device *pdev,
@@ -424,15 +425,7 @@ static struct tps6507x_board *tps6507x_parse_dt_reg_data(
return tps_board;
}
-#else
-static inline struct tps6507x_board *tps6507x_parse_dt_reg_data(
- struct platform_device *pdev,
- struct of_regulator_match **tps6507x_reg_matches)
-{
- *tps6507x_reg_matches = NULL;
- return NULL;
-}
-#endif
+
static int tps6507x_pmic_probe(struct platform_device *pdev)
{
struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
@@ -453,9 +446,10 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
*/
tps_board = dev_get_platdata(tps6507x_dev->dev);
- if (!tps_board && tps6507x_dev->dev->of_node)
+ if (IS_ENABLED(CONFIG_OF) && !tps_board &&
+ tps6507x_dev->dev->of_node)
tps_board = tps6507x_parse_dt_reg_data(pdev,
- &tps6507x_reg_matches);
+ &tps6507x_reg_matches);
if (!tps_board)
return -EINVAL;
@@ -481,7 +475,7 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
tps->info[i] = info;
if (init_data->driver_data) {
struct tps6507x_reg_platform_data *data =
- init_data->driver_data;
+ init_data->driver_data;
tps->info[i]->defdcdc_default = data->defdcdc_default;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-05 15:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-05 15:35 [PATCH] regulator: tps6507x: Use "IS_ENABLED" for DT code Manish Badarkhe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®