Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4246e55f authored by Manish Badarkhe's avatar Manish Badarkhe Committed by Mark Brown
Browse files

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: default avatarManish Badarkhe <badarkhe.manish@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 38dbfb59
Loading
Loading
Loading
Loading
+5 −13
Original line number Original line Diff line number Diff line
@@ -359,7 +359,6 @@ static struct regulator_ops tps6507x_pmic_ops = {
	.map_voltage = regulator_map_voltage_ascend,
	.map_voltage = regulator_map_voltage_ascend,
};
};


#ifdef CONFIG_OF
static struct of_regulator_match tps6507x_matches[] = {
static struct of_regulator_match tps6507x_matches[] = {
	{ .name = "VDCDC1"},
	{ .name = "VDCDC1"},
	{ .name = "VDCDC2"},
	{ .name = "VDCDC2"},
@@ -424,15 +423,7 @@ static struct tps6507x_board *tps6507x_parse_dt_reg_data(


	return tps_board;
	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)
static int tps6507x_pmic_probe(struct platform_device *pdev)
{
{
	struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
	struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
@@ -453,7 +444,8 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
	 */
	 */


	tps_board = dev_get_platdata(tps6507x_dev->dev);
	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,
		tps_board = tps6507x_parse_dt_reg_data(pdev,
				&tps6507x_reg_matches);
				&tps6507x_reg_matches);
	if (!tps_board)
	if (!tps_board)