regulator: rn5t618: Do not index regulator_desc arrays by id
authorLeonard Crestez <leonard.crestez@nxp.com>
Fri, 13 Oct 2017 16:37:31 +0000 (19:37 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 18 Oct 2017 10:23:21 +0000 (11:23 +0100)
The regulator_desc arrays in this driver are indexed by RN5T618_*
constants and some elements can be missing. This causes probe failures
on older models:

rn5t618-regulator rn5t618-regulator: failed to register (null) regulator
rn5t618-regulator: probe of rn5t618-regulator failed with error -22

Fix this by making the arrays flat. This also saves a little memory
because the regulator_desc arrays become smaller.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Fixes: 83b2a3c2ab24 ("regulator: rn5t618: add RC5T619 PMIC support")
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/rn5t618-regulator.c

index ef2be56460fe2779765311473944c48e9bb9ba85..790a4a73ea2c8f94c3fb80c8567827d0e8b0860b 100644 (file)
@@ -29,7 +29,7 @@ static const struct regulator_ops rn5t618_reg_ops = {
 };
 
 #define REG(rid, ereg, emask, vreg, vmask, min, max, step)             \
-       [RN5T618_##rid] = {                                             \
+       {                                                               \
                .name           = #rid,                                 \
                .of_match       = of_match_ptr(#rid),                   \
                .regulators_node = of_match_ptr("regulators"),          \