mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
regulator: tps65910: check TPS65910_NUM_REGS at build time
Check TPS65910_NUM_REGS at build time instead of silently registering not all regulators at runtime. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2ea659a9ef
commit
fe953904f3
1 changed files with 3 additions and 2 deletions
|
@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
switch (tps65910_chip_id(tps65910)) {
|
switch (tps65910_chip_id(tps65910)) {
|
||||||
case TPS65910:
|
case TPS65910:
|
||||||
|
BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
|
||||||
pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
|
pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
|
||||||
pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
|
pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
|
||||||
pmic->ext_sleep_control = tps65910_ext_sleep_control;
|
pmic->ext_sleep_control = tps65910_ext_sleep_control;
|
||||||
|
@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
|
||||||
DCDCCTRL_DCDCCKSYNC_MASK);
|
DCDCCTRL_DCDCCKSYNC_MASK);
|
||||||
break;
|
break;
|
||||||
case TPS65911:
|
case TPS65911:
|
||||||
|
BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
|
||||||
pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
|
pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
|
||||||
pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
|
pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
|
||||||
pmic->ext_sleep_control = tps65911_ext_sleep_control;
|
pmic->ext_sleep_control = tps65911_ext_sleep_control;
|
||||||
|
@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
|
||||||
if (!pmic->rdev)
|
if (!pmic->rdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
|
for (i = 0; i < pmic->num_regulators; i++, info++) {
|
||||||
i++, info++) {
|
|
||||||
/* Register the regulators */
|
/* Register the regulators */
|
||||||
pmic->info[i] = info;
|
pmic->info[i] = info;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue