[U-Boot] U-Boot, dm, ubi: struct device is declared twice

Heiko Schocher hs at denx.de
Fri May 2 07:19:01 CEST 2014


Hello Simon, Marek,

just updating to current mainline code and defining
CONFIG_SYS_GENERIC_BOARD pops up the following error:

  CC      common/board_r.o
In file included from include/linux/mtd/flashchip.h:21:0,
                  from include/linux/mtd/nand.h:31,
                  from include/nand.h:39,
                  from common/board_r.c:40:
include/ubi_uboot.h:202:8: error: redefinition of 'struct device'
  struct device {
         ^
In file included from include/dm.h:10:0,
                  from common/board_r.c:21:
include/dm/device.h:56:8: note: originally defined here
  struct device {
         ^
make[1]: *** [common/board_r.o] Fehler 1
make: *** [common] Fehler 2
pollux:u-boot hs [20140502] $

for a not yet mainlined imx6 board using UBI/UBIFS on nand. I am
currently sync current Linux MTD/UBI and UBIFS code to U-Boot, but
I think this error should pop up for all boards using DM and UBI ...

How to solve this double named struct? I do not want to change this
in Linux code as "struct device" is very much used, and this would
be a maintaining nightmare for future syncs with linux code.

Should we rename the DM "struct device" in include/dm/device.h ?

diff --git a/include/dm/device.h b/include/dm/device.h
index 4cd38ed..ba9f128 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -24,7 +24,7 @@ struct driver_info;
  #define DM_FLAG_ALLOC_PDATA    (2 << 0)

  /**
- * struct device - An instance of a driver
+ * struct dm_device - An instance of a driver
   *
   * This holds information about a device, which is a driver bound to a
   * particular port or peripheral (essentially a driver instance).
@@ -53,12 +53,12 @@ struct driver_info;
   * @sibling_node: Next device in list of all devices
   * @flags: Flags for this device DM_FLAG_...
   */
-struct device {
+struct dm_device {

What do you think?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list