The variable that's being used inside this block is reg_idata.
- if ((devs[j].id == TPS6586X_ID_LDO_5) ||
- (devs[j].id == TPS6586X_ID_LDO_RTC))
- reg_idata->supply_regulator = sys_rail_name;
+ if (tps6586x_matches[i].init_data) {
Admittedly the value of that variable is tps6586x_matches[i].init_data,
but I think it'd be much cleaner if the if statement checked reg_idata
directly; that way, someone reading the code wouldn't have to look above
to find out that reg_idata and tps6586x_matches[i].init_data are related.
+ if (devs[j].id == TPS6586X_ID_SYS)In the MAX8907 patch this attempts to duplicate; if there is no init
+ sys_rail_name = reg_idata->constraints.name;
data where the user gives an explicit name, the name from the descriptor
is used:
if (idata&& idata->constraints.name)
mbatt_rail_name = idata->constraints.name;
else
mbatt_rail_name = pmic->desc[i].name;
Shouldn't that same algorithm be used here?
The function tps6586x_regulator_set_slew_rate() use the platform data which is not available if init_data is not provided by platform.Sorry, I don't immediately see why that's related?
+ if (!pdev->dev.platform_data)
+ return 0;
+
return tps6586x_regulator_set_slew_rate(pdev);
}