ARM: U300: Add proper ifdef guard to fix build error when CONFIG_I2C_STU300=m
Subsystems (2)
PATCH 1/1 ARM: U300: Add proper ifdef guard to fix build error when CONFIG_I2C_STU300=m
I got below build error if CONFIG_I2C_STU300=m.
ERROR: "i2c_register_board_info" [arch/arm/mach-u300/i2c.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
Fix it by adding proper ifdef guard in i2c.h and Makefile. So arch/arm/mach-u300/i2c.c will be compiled when CONFIG_I2C_STU300 is configured as built-in or as a module.
--- arch/arm/mach-u300/Makefile | 4 +++- arch/arm/mach-u300/i2c.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-u300/Makefile +3 -1
@@ -9,5 +9,7 @@ obj- := obj-$(CONFIG_SPI_PL022) += spi.o obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o -obj-$(CONFIG_I2C_STU300) += i2c.o +ifneq ($(CONFIG_I2C_STU300),) +obj-y += i2c.o +endif obj-$(CONFIG_REGULATOR_AB3100) += regulator.o
arch/arm/mach-u300/i2c.h +1 -1
@@ -11,7 +11,7 @@#ifndef MACH_U300_I2C_H #define MACH_U300_I2C_H -#ifdef CONFIG_I2C_STU300 +#if IS_ENABLED (ISCONFIG_I2C_STU300 )void __init u300_i2c_register_board_devices (void );#else /* Compile out this stuff if no I2C adapter is available */
Signature · 1 line
1.8.1.2
Quoted 11 lines · Axel Lin
I got below build error if
CONFIG_I2C_STU300=m.ERROR: "
i2c_register_board_info" [arch/arm/mach-u300/i2c.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2Fix it by adding proper ifdef guard in
i2c.handMakefile. Soarch/arm/mach-u300/i2c.cwill be compiled whenCONFIG_I2C_STU300is configured as built-in or as a module.Signed-off-by Axel Lin <[email protected]>
This file will be deleted in v3.11, see:
http://marc.info/?l=linux-arm-kernel&m=136662534118633&w=2
Yours,
Linus Walleij