ARM: davinci: fix build failure without I2C
authorArnd Bergmann <arnd@arndb.de>
Wed, 27 May 2020 13:37:34 +0000 (15:37 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 28 May 2020 10:35:00 +0000 (12:35 +0200)
The two supplies are referenced outside of #ifdef CONFIG_I2C but
defined inside, which breaks the build if that is not built-in:

mach-davinci/board-dm644x-evm.c:861:21: error: use of undeclared identifier 'fixed_supplies_1_8v'
                                     ARRAY_SIZE(fixed_supplies_1_8v), 1800000);
                                                ^
mach-davinci/board-dm644x-evm.c:861:21: error: use of undeclared identifier 'fixed_supplies_1_8v'
mach-davinci/board-dm644x-evm.c:861:21: error: use of undeclared identifier 'fixed_supplies_1_8v'
mach-davinci/board-dm644x-evm.c:860:49: error: use of undeclared identifier 'fixed_supplies_1_8v'
        regulator_register_always_on(0, "fixed-dummy", fixed_supplies_1_8v,

I don't know if the regulators are used anywhere without I2C, but
always registering them seems to be the safe choice here.

On a related note, it might be best to also deal with CONFIG_I2C=m
across the file, unless this is going to be moved to DT and removed
really soon anyway.

Link: https://lore.kernel.org/r/20200527133746.643895-1-arnd@arndb.de
Fixes: 5e06d19694a4 ("ARM: davinci: dm644x-evm: Add Fixed regulators needed for tlv320aic33")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-davinci/board-dm644x-evm.c

index 3461d12..a5d3708 100644 (file)
@@ -655,19 +655,6 @@ static struct i2c_board_info __initdata i2c_info[] =  {
        },
 };
 
-/* Fixed regulator support */
-static struct regulator_consumer_supply fixed_supplies_3_3v[] = {
-       /* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */
-       REGULATOR_SUPPLY("AVDD", "1-001b"),
-       REGULATOR_SUPPLY("DRVDD", "1-001b"),
-};
-
-static struct regulator_consumer_supply fixed_supplies_1_8v[] = {
-       /* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */
-       REGULATOR_SUPPLY("IOVDD", "1-001b"),
-       REGULATOR_SUPPLY("DVDD", "1-001b"),
-};
-
 #define DM644X_I2C_SDA_PIN     GPIO_TO_PIN(2, 12)
 #define DM644X_I2C_SCL_PIN     GPIO_TO_PIN(2, 11)
 
@@ -700,6 +687,19 @@ static void __init evm_init_i2c(void)
 }
 #endif
 
+/* Fixed regulator support */
+static struct regulator_consumer_supply fixed_supplies_3_3v[] = {
+       /* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */
+       REGULATOR_SUPPLY("AVDD", "1-001b"),
+       REGULATOR_SUPPLY("DRVDD", "1-001b"),
+};
+
+static struct regulator_consumer_supply fixed_supplies_1_8v[] = {
+       /* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */
+       REGULATOR_SUPPLY("IOVDD", "1-001b"),
+       REGULATOR_SUPPLY("DVDD", "1-001b"),
+};
+
 #define VENC_STD_ALL   (V4L2_STD_NTSC | V4L2_STD_PAL)
 
 /* venc standard timings */