Skip to contentSkip to conversation

microblaze: Fix strict-aliasign rules for in_be32

PATCH Superseded Michal Simek 2 participants 4 messages Oct 18, 2011 – Oct 23, 2011 Microblaze architecture

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Michal Simek

author maintainer
#0 lore raw

PATCH 1/2 microblaze: Fix strict-aliasign rules for in_be32

readl should work with unsigned int instead of unsigned long.

---
 arch/microblaze/include/asm/io.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/microblaze/include/asm/io.h +1 -1
index 7e190d1..187ae73 100644
@@ -25,7 +25,7 @@
 #define readw(addr) \
   ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
 #define readl(addr) \
-  ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
+  ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
 
 #define writeb(b, addr) \
   (void)((*(volatile unsigned char *) (addr)) = (b))
Signature · 1 line
1.7.5.4
author maintainer
#1 lore raw

PATCH 1/2 microblaze: Fix strict-aliasign rules for in_be32

Quoted 6 lines · Michal Simek

readl should work with unsigned int instead of unsigned long.

---
 arch/microblaze/include/asm/io.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Reject - coding style issue - I was too fast.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
author maintainer
#2 lore raw

PATCH 2/2 serial: uartlite: Fix compilation warnings

In reply to Michal Simek

Do not setup userial_ports array as const because in uartlite_serial_putc is out_be32 which can't write to tx_fifo if is const.

Warning log:
serial_xuartlite.c: In function 'uartlite_serial_putc':
serial_xuartlite.c:60: warning: initialization discards qualifiers from pointer target type serial_xuartlite.c: In function 'uartlite_serial_getc':
serial_xuartlite.c:78: warning: initialization discards qualifiers from pointer target type serial_xuartlite.c: In function 'uartlite_serial_tstc':
serial_xuartlite.c:87: warning: initialization discards qualifiers from pointer target type

---
There are several approach how to solve it in uartlite_serial_putc.
1. add retype to out_be32 function
2. retype in assignment
3. do not define userial_ports as const - used solution

---
 drivers/serial/serial_xuartlite.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/serial_xuartlite.c +1 -1
index 2dc6bd1..3a38f9e 100644
@@ -40,7 +40,7 @@ struct uartlite {
 	unsigned int status;
 };
 
-static const struct uartlite *userial_ports[4] = {
+static struct uartlite *userial_ports[4] = {
 #ifdef XILINX_UARTLITE_BASEADDR
 	[0] = (struct uartlite *)XILINX_UARTLITE_BASEADDR,
 #endif
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 2/2 serial: uartlite: Fix compilation warnings

Dear Michal Simek,

Quoted 12 lines · In message <[email protected]> you wrote:

Do not setup userial_ports array as const because in uartlite_serial_putc is out_be32 which can't write to tx_fifo if is const.

Warning log:
serial_xuartlite.c: In function 'uartlite_serial_putc':
serial_xuartlite.c:60: warning: initialization discards qualifiers from pointer target type serial_xuartlite.c: In function 'uartlite_serial_getc':
serial_xuartlite.c:78: warning: initialization discards qualifiers from pointer target type serial_xuartlite.c: In function 'uartlite_serial_tstc':
serial_xuartlite.c:87: warning: initialization discards qualifiers from pointer target type

Quoted 7 lines

---
There are several approach how to solve it in uartlite_serial_putc.
1. add retype to out_be32 function
2. retype in assignment
3. do not define userial_ports as const - used solution

Wouldn't 1. and 2. actually be wrong? If you need to write to the struct, you must not declare it as constant?

Quoted 3 lines
---
 drivers/serial/serial_xuartlite.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
God made the integers; all else is the work of Man.       - Kronecker