Skip to contentSkip to conversation

power: fix bq27x00_battery kconfig

PATCH Applied Xiong Zhou 3 participants 6 messages May 3, 2013 – May 10, 2013 Linux-next tree

lore
Share & tools
lore

Xiong Zhou

author
#0 lore raw

PATCH 1/1 power: fix bq27x00_battery kconfig

From: Xiong Zhou <[email protected]>

This patch fixes build failure(randconfig) of next-20130501. When config I2C as m, BATTERY_BQ27x00 as y, here comes the failure. BATTERY_BQ27x00 depends on I2C according to the code.

Failure message:
drivers/built-in.o: In function `bq27x00_read_i2c':
bq27x00_battery.c:(.text+0x1082a7): undefined reference to i2c_transfer' drivers/built-in.o: In function bq27x00_battery_init':
bq27x00_battery.c:(.init.text+0x6085): undefined reference to i2c_register_driver' bq27x00_battery.c:(.init.text+0x60c7): undefined reference to i2c_del_driver' drivers/built-in.o: In function `bq27x00_battery_exit':
bq27x00_battery.c:(.exit.text+0xbf0): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

---
drivers/power/Kconfig | 1 +

1 file changed, 1 insertion(+)
drivers/power/Kconfig +1 -0
index 0d0b5d7..89e5ebd 100644
@@ -152,6 +152,7 @@ config BATTERY_SBS
 
 config BATTERY_BQ27x00
 	tristate "BQ27x00 battery driver"
+	depends on I2C
 	help
 	  Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.
 
#1 lore raw
Quoted 17 lines · Xiong Zhou

From: Xiong Zhou <[email protected]>

This patch fixes build failure(randconfig) of next-20130501. When config I2C as m, BATTERY_BQ27x00 as y, here comes the failure. BATTERY_BQ27x00 depends on I2C according to the code.

Failure message:
drivers/built-in.o: In function `bq27x00_read_i2c':
bq27x00_battery.c:(.text+0x1082a7): undefined reference to i2c_transfer' drivers/built-in.o: In function bq27x00_battery_init':
bq27x00_battery.c:(.init.text+0x6085): undefined reference to i2c_register_driver' bq27x00_battery.c:(.init.text+0x60c7): undefined reference to i2c_del_driver' drivers/built-in.o: In function `bq27x00_battery_exit':
bq27x00_battery.c:(.exit.text+0xbf0): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

Quoted 1 line

It's actually a bit more tricky. The driver can be built without I2C support, so it does not depend on I2C, but if I2C is built as a module the driver should also only be built as a module.

I think the best solution is to put the platform code and the i2c code of the bq27x00 driver each in their on module, but if you want a quick solution

depends on I2C || I2C=n

should work.

Quoted 21 lines

---
drivers/power/Kconfig | 1 +

1 file changed, 1 insertion(+)
drivers/power/Kconfig +1 -1
index 0d0b5d7..89e5ebd 100644
@@ -152,6 +152,7 @@ config BATTERY_SBS
 
 config BATTERY_BQ27x00
 	tristate "BQ27x00 battery driver"
+	depends on I2C
 	help
 	  Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw

2013/5/3 Lars-Peter Clausen <[email protected]>:

Quoted 18 lines · Xiong Zhou
Quoted 17 lines

From: Xiong Zhou <[email protected]>

This patch fixes build failure(randconfig) of next-20130501. When config I2C as m, BATTERY_BQ27x00 as y, here comes the failure. BATTERY_BQ27x00 depends on I2C according to the code.

Failure message:
drivers/built-in.o: In function `bq27x00_read_i2c':
bq27x00_battery.c:(.text+0x1082a7): undefined reference to i2c_transfer' drivers/built-in.o: In function bq27x00_battery_init':
bq27x00_battery.c:(.init.text+0x6085): undefined reference to i2c_register_driver' bq27x00_battery.c:(.init.text+0x60c7): undefined reference to i2c_del_driver' drivers/built-in.o: In function `bq27x00_battery_exit':
bq27x00_battery.c:(.exit.text+0xbf0): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

Quoted 3 lines
Quoted 1 line

It's actually a bit more tricky. The driver can be built without I2C

What about the build error ?

Quoted 2 lines

support, so it does not depend on I2C, but if I2C is built as a module the driver should also only be built as a module.

And this is what this patch trying to do.

Quoted 3 lines

I think the best solution is to put the platform code and the i2c code of the bq27x00 driver each in their on module, but if you want a quick solution

Yes, more clear.

Quoted 5 lines

depends on I2C || I2C=n

should work.

Thanks. :)

Quoted 22 lines
Quoted 21 lines

---
drivers/power/Kconfig | 1 +

1 file changed, 1 insertion(+)
drivers/power/Kconfig +1 -1
index 0d0b5d7..89e5ebd 100644
@@ -152,6 +152,7 @@ config BATTERY_SBS
 
 config BATTERY_BQ27x00
      tristate "BQ27x00 battery driver"
+     depends on I2C
      help
        Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 19 lines · zhou jencce

2013/5/3 Lars-Peter Clausen <[email protected]>:

Quoted 18 lines · Xiong Zhou
Quoted 17 lines

From: Xiong Zhou <[email protected]>

This patch fixes build failure(randconfig) of next-20130501. When config I2C as m, BATTERY_BQ27x00 as y, here comes the failure. BATTERY_BQ27x00 depends on I2C according to the code.

Failure message:
drivers/built-in.o: In function `bq27x00_read_i2c':
bq27x00_battery.c:(.text+0x1082a7): undefined reference to i2c_transfer' drivers/built-in.o: In function bq27x00_battery_init':
bq27x00_battery.c:(.init.text+0x6085): undefined reference to i2c_register_driver' bq27x00_battery.c:(.init.text+0x60c7): undefined reference to i2c_del_driver' drivers/built-in.o: In function `bq27x00_battery_exit':
bq27x00_battery.c:(.exit.text+0xbf0): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

It's actually a bit more tricky. The driver can be built without I2C

What about the build error ?

The built error only happens if the driver is built-in and I2C is built as a module. Every other combination works fine. E.g. if I2C is disabled the driver builds just fine. So the driver only depends on I2C if I2C is not disabled.

Quoted 41 lines
Quoted 2 lines

support, so it does not depend on I2C, but if I2C is built as a module the driver should also only be built as a module.

And this is what this patch trying to do.

Quoted 3 lines

I think the best solution is to put the platform code and the i2c code of the bq27x00 driver each in their on module, but if you want a quick solution

Yes, more clear.

Quoted 5 lines

depends on I2C || I2C=n

should work.

Thanks. :)

Quoted 22 lines
Quoted 21 lines

---
drivers/power/Kconfig | 1 +

1 file changed, 1 insertion(+)
drivers/power/Kconfig +1 -1
index 0d0b5d7..89e5ebd 100644
@@ -152,6 +152,7 @@ config BATTERY_SBS
 
 config BATTERY_BQ27x00
      tristate "BQ27x00 battery driver"
+     depends on I2C
      help
        Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#4 lore raw

From: Xiong Zhou <[email protected]>

This patch fixes build failure(randconfig) of next-20130501. When config I2C as m, BATTERY_BQ27x00 as y, here comes the failure. The driver depends on I2C only if I2C is not disabled, as Lars commented. Last version of this patch make the driver depend on I2C unconditionally.

Failure message:
drivers/built-in.o: In function `bq27x00_read_i2c':
bq27x00_battery.c:(.text+0x1082a7): undefined reference to i2c_transfer' drivers/built-in.o: In function bq27x00_battery_init':
bq27x00_battery.c:(.init.text+0x6085): undefined reference to i2c_register_driver' bq27x00_battery.c:(.init.text+0x60c7): undefined reference to i2c_del_driver' drivers/built-in.o: In function `bq27x00_battery_exit':
bq27x00_battery.c:(.exit.text+0xbf0): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

Cc Lars-Peter Clausen <[email protected]>

---
drivers/power/Kconfig | 1 +

1 file changed, 1 insertion(+)
drivers/power/Kconfig +1 -0
index 0d0b5d7..f11bacd 100644
@@ -152,6 +152,7 @@ config BATTERY_SBS
 
 config BATTERY_BQ27x00
 	tristate "BQ27x00 battery driver"
+	depends on I2C || I2C=n
 	help
 	  Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.
 
#5 lore raw
Quoted 18 lines · Xiong Zhou

From: Xiong Zhou <[email protected]>

This patch fixes build failure(randconfig) of next-20130501. When config I2C as m, BATTERY_BQ27x00 as y, here comes the failure. The driver depends on I2C only if I2C is not disabled, as Lars commented. Last version of this patch make the driver depend on I2C unconditionally.

Failure message:
drivers/built-in.o: In function `bq27x00_read_i2c':
bq27x00_battery.c:(.text+0x1082a7): undefined reference to i2c_transfer' drivers/built-in.o: In function bq27x00_battery_init':
bq27x00_battery.c:(.init.text+0x6085): undefined reference to i2c_register_driver' bq27x00_battery.c:(.init.text+0x60c7): undefined reference to i2c_del_driver' drivers/built-in.o: In function `bq27x00_battery_exit':
bq27x00_battery.c:(.exit.text+0xbf0): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

Quoted 3 lines
Cc Lars-Peter Clausen <[email protected]>

---

Applied, thanks!

Quoted 15 lines

drivers/power/Kconfig | 1 +

1 file changed, 1 insertion(+)
drivers/power/Kconfig +1 -0
index 0d0b5d7..f11bacd 100644
@@ -152,6 +152,7 @@ config BATTERY_SBS
 
 config BATTERY_BQ27x00
 	tristate "BQ27x00 battery driver"
+	depends on I2C || I2C=n
 	help
 	  Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips.