Skip to contentSkip to conversation

serial: CONFIG_ARM_DCC_MULTI failures

U-Boot New Michal Simek 5 participants 9 messages Jan 23, 2013 – Feb 4, 2013

lore
Share & tools
lore
#0 lore raw

Hi Marek and others,

I have found that in uboot is arm-dcc driver (drivers/serial/arm_dcc.c) which is
1. not compiled by any configuration
2. when it is enabled is causing compilation failures because of SERIAL_MULTI removal

The problem is with this code.

#ifndef CONFIG_ARM_DCC_MULTI
#define arm_dcc_init serial_init
void serial_setbrg(void) {}
#define arm_dcc_getc serial_getc
#define arm_dcc_putc serial_putc
#define arm_dcc_puts serial_puts
#define arm_dcc_tstc serial_tstc
#endif

It means that CONFIG_ARM_DCC_MULTI should be always enabled and we can remove this option entirely.

Then there is missing default_serial_console() if there is no another serial driver.

Also I am sending the second patch which fix compilation warning.

Thanks,
Michal

#1 lore raw

PATCH 1/2 serial: arm_dcc: Remove CONFIG_ARM_DCC_MULTI option

CONFIG_ARM_DCC_MULTI should be also removed in the patch "serial: Remove CONFIG_SERIAL_MULTI from serial drivers" (sha1: a3827250606895ec2dd4b8d867342b7cabf3692f)
Because the driver defines serial_* functions
which cause conflict with serial.c (multiple definition of serial_*)

Removing CONFIG_SERIAL_MULTI function also require to define default_serial_console for cases where another serial driver is not available in the system.

---
Error log:
serial.o: In function `serial_init':
/mnt/projects/u-boot/drivers/serial/serial.c:402: multiple definition of serial_init' arm_dcc.o:/mnt/projects/u-boot/drivers/serial/arm_dcc.c:104: first defined here serial.o: In function serial_setbrg':
/mnt/projects/u-boot/drivers/serial/serial.c:417: multiple definition of serial_setbrg' arm_dcc.o:/mnt/projects/u-boot/drivers/serial/arm_dcc.c:94: first defined here serial.o: In function serial_getc':
/mnt/projects/u-boot/drivers/serial/serial.c:433: multiple definition of serial_getc' arm_dcc.o:/mnt/projects/u-boot/drivers/serial/arm_dcc.c:112: first defined here serial.o: In function serial_tstc':
/mnt/projects/u-boot/drivers/serial/serial.c:448: multiple definition of serial_tstc' arm_dcc.o:/mnt/projects/u-boot/drivers/serial/arm_dcc.c:145: first defined here serial.o: In function serial_putc':
/mnt/projects/u-boot/drivers/serial/serial.c:464: multiple definition of serial_putc' arm_dcc.o:/mnt/projects/u-boot/drivers/serial/arm_dcc.c:124: first defined here serial.o: In function serial_puts':
/mnt/projects/u-boot/drivers/serial/serial.c:482: multiple definition of `serial_puts' arm_dcc.o:/mnt/projects/u-boot/drivers/serial/arm_dcc.c:136: first defined here

The second error log:
/mnt/projects/u-boot/drivers/serial/serial.c:374: undefined reference to default_serial_console' drivers/serial/libserial.o: In function serial_initialize':

---
 common/stdio.c           |    2 +-
 drivers/serial/arm_dcc.c |   16 +++++-----------
 include/stdio_dev.h      |    2 +-
 3 files changed, 7 insertions(+), 13 deletions(-)
common/stdio.c +1 -1
index 97ff9cf..5d5117c 100644
@@ -207,7 +207,7 @@ int stdio_init (void)
 	/* Initialize the list */
 	INIT_LIST_HEAD(&(devs.list));
 
-#ifdef CONFIG_ARM_DCC_MULTI
+#ifdef CONFIG_ARM_DCC
 	drv_arm_dcc_init ();
 #endif
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
drivers/serial/arm_dcc.c +5 -11
index 7b5ecb5..812dcf0 100644
@@ -89,15 +89,6 @@
 
 #define TIMEOUT_COUNT 0x4000000
 
-#ifndef CONFIG_ARM_DCC_MULTI
-#define arm_dcc_init serial_init
-void serial_setbrg(void) {}
-#define arm_dcc_getc serial_getc
-#define arm_dcc_putc serial_putc
-#define arm_dcc_puts serial_puts
-#define arm_dcc_tstc serial_tstc
-#endif
-
 int arm_dcc_init(void)
 {
 	return 0;
@@ -147,7 +138,6 @@ int arm_dcc_tstc(void)
 	return reg;
 }
 
-#ifdef CONFIG_ARM_DCC_MULTI
 static struct stdio_dev arm_dcc_dev;
 
 int drv_arm_dcc_init(void)
@@ -167,4 +157,8 @@ int drv_arm_dcc_init(void)
 
 	return stdio_register(&arm_dcc_dev);
 }
-#endif
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return NULL;
+}
include/stdio_dev.h +1 -1
index 932d093..9451740 100644
@@ -99,7 +99,7 @@ struct list_head* stdio_get_list(void);
 struct stdio_dev* stdio_get_by_name(const char* name);
 struct stdio_dev* stdio_clone(struct stdio_dev *dev);
 
-#ifdef CONFIG_ARM_DCC_MULTI
+#ifdef CONFIG_ARM_DCC
 int drv_arm_dcc_init(void);
 #endif
 #ifdef CONFIG_LCD
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/2 serial: arm_dcc: Remove CONFIG_ARM_DCC_MULTI option

Dear Michal Simek,

Quoted 9 lines · In message <[email protected]> you…

CONFIG_ARM_DCC_MULTI should be also removed in the patch "serial: Remove CONFIG_SERIAL_MULTI from serial drivers" (sha1: a3827250606895ec2dd4b8d867342b7cabf3692f)
Because the driver defines serial_* functions
which cause conflict with serial.c (multiple definition of serial_*)

Removing CONFIG_SERIAL_MULTI function also require to define default_serial_console for cases where another serial driver is not available in the system.

As you pointed out in the cover letter, CONFIG_ARM_DCC and CONFIG_ARM_DCC_MULTI are nowhere defined in any mainline U-Boot code. Instead of fixing and keeping the dead code, we should rather remove the drivers/serial/arm_dcc.c driver and all references to CONFIG_ARM_DCC*

If you want, I can prepare a cleanup patch.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q:  Do you know what the death rate around here is?
A:  One per person.
#3 lore raw

PATCH 1/2 serial: arm_dcc: Remove CONFIG_ARM_DCC_MULTI option

Dear Wolfgang Denk,

2013/1/23 Wolfgang Denk <[email protected]>:

Quoted 13 lines

Dear Michal Simek,

Quoted 9 lines · In message <[email protected]> you…

CONFIG_ARM_DCC_MULTI should be also removed in the patch "serial: Remove CONFIG_SERIAL_MULTI from serial drivers" (sha1: a3827250606895ec2dd4b8d867342b7cabf3692f)
Because the driver defines serial_* functions
which cause conflict with serial.c (multiple definition of serial_*)

Removing CONFIG_SERIAL_MULTI function also require to define default_serial_console for cases where another serial driver is not available in the system.

Quoted 7 lines

As you pointed out in the cover letter, CONFIG_ARM_DCC and CONFIG_ARM_DCC_MULTI are nowhere defined in any mainline U-Boot code. Instead of fixing and keeping the dead code, we should rather remove the drivers/serial/arm_dcc.c driver and all references to CONFIG_ARM_DCC*

If you want, I can prepare a cleanup patch.

I have found that we are using this driver for one board. That's why I prefer to keep this driver in the mainline and enabling it for arm zynq.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian
#4 lore raw

PATCH 1/2 serial: arm_dcc: Remove CONFIG_ARM_DCC_MULTI option

In reply to Michal Simek

Dear Michal Simek,

Quoted 11 lines

CONFIG_ARM_DCC_MULTI should be also removed in the patch "serial: Remove CONFIG_SERIAL_MULTI from serial drivers" (sha1: a3827250606895ec2dd4b8d867342b7cabf3692f)
Because the driver defines serial_* functions
which cause conflict with serial.c (multiple definition of serial_*)

Removing CONFIG_SERIAL_MULTI function also require to define default_serial_console for cases where another serial driver is not available in the system.

I think it looks good.

btw. did I by any chance became serial subsystem custodian without knowing about it recently? ;-)

Best regards,
Marek Vasut

#5 lore raw

PATCH 1/2 serial: arm_dcc: Remove CONFIG_ARM_DCC_MULTI option

2013/1/26 Marek Vasut <[email protected]>:

Quoted 12 lines

Dear Michal Simek,

Quoted 10 lines

CONFIG_ARM_DCC_MULTI should be also removed in the patch "serial: Remove CONFIG_SERIAL_MULTI from serial drivers" (sha1: a3827250606895ec2dd4b8d867342b7cabf3692f)
Because the driver defines serial_* functions
which cause conflict with serial.c (multiple definition of serial_*)

Removing CONFIG_SERIAL_MULTI function also require to define default_serial_console for cases where another serial driver is not available in the system.

Quoted 5 lines
Quoted 1 line

I think it looks good.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#6 lore raw

PATCH 1/2 serial: arm_dcc: Remove CONFIG_ARM_DCC_MULTI option

In reply to Michal Simek
Quoted 6 lines · Michal Simek

CONFIG_ARM_DCC_MULTI should be also removed in the patch "serial: Remove CONFIG_SERIAL_MULTI from serial drivers" (sha1: a3827250606895ec2dd4b8d867342b7cabf3692f)
Because the driver defines serial_* functions
which cause conflict with serial.c (multiple definition of serial_*)

Quoted 6 lines

Removing CONFIG_SERIAL_MULTI function also require to define default_serial_console for cases where another serial driver is not available in the system.

Applied to u-boot/master (along with 2/2), thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130204/8c36ee2b/attachment.pgp>
#7 lore raw

PATCH 2/2 serial: arm_dcc: Fix compilation warning and remove unneeded initialization

In reply to Michal Simek

- arm_dcc_dev is already initialized.
- Remove unused rc variable
Warning log:
arm_dcc.c: In function 'drv_arm_dcc_init':
arm_dcc.c:145:6: warning: unused variable 'rc' [-Wunused-variable]

---
 drivers/serial/arm_dcc.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/serial/arm_dcc.c +0 -5
index 812dcf0..c217c88 100644
@@ -142,11 +142,6 @@ static struct stdio_dev arm_dcc_dev;
 
 int drv_arm_dcc_init(void)
 {
-	int rc;
-
-	/* Device initialization */
-	memset(&arm_dcc_dev, 0, sizeof(arm_dcc_dev));
-
 	strcpy(arm_dcc_dev.name, "dcc");
 	arm_dcc_dev.ext = 0;	/* No extensions */
 	arm_dcc_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_OUTPUT;
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH 2/2 serial: arm_dcc: Fix compilation warning and remove unneeded initialization

Dear Michal Simek,

Quoted 7 lines

- arm_dcc_dev is already initialized.
- Remove unused rc variable
Warning log:
arm_dcc.c: In function 'drv_arm_dcc_init':
arm_dcc.c:145:6: warning: unused variable 'rc' [-Wunused-variable]

Best regards,
Marek Vasut