Skip to contentSkip to conversation

board/dave/common/flash.c: fix compile warning

PATCH New Wolfgang Denk 4 participants 26 messages Sep 11, 2009 – Sep 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/dave/common/flash.c: fix compile warning

Fix warning: ../common/flash.c:668: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/dave/common/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
board/dave/common/flash.c +2 -1
index b6af63b..29caf47 100644
@@ -663,9 +663,10 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
  */
 static int write_word (flash_info_t *info, ulong dest, ulong data)
 {
+	ulong *data_ptr = &data;
 	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
 	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)&data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int flag;
 	int i;
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 board/amcc/common/flash.c: Fix compile warning

Fix warning: ../common/flash.c:917: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/amcc/common/flash.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
board/amcc/common/flash.c +4 -3
index 9943c74..9aaf256 100644
@@ -912,9 +912,10 @@ static int flash_erase_2(flash_info_t * info, int s_first, int s_last)
 
 static int write_word_2(flash_info_t * info, ulong dest, ulong data)
 {
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *) & data;
+	ulong *data_ptr = &data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int i;
 
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 1/1 board/amcc/common/flash.c: Fix compile warning

Quoted 5 lines · On Friday 11 September 2009 11:49:19 Wolfgang Denk wrote:

Fix warning: ../common/flash.c:917: warning: dereferencing type-punned pointer will break strict-aliasing rules

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

author Applied
#3 lore raw

PATCH 1/1 board/amcc/common/flash.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:

Fix warning: ../common/flash.c:917: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/amcc/common/flash.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Applied.

Wolfgang Denk

Signature · 6 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
In the beginning there was nothing.
And the Lord said "Let There Be Light!"
And still there was nothing, but at least now you could see it.
#4 lore raw

PATCH 1/1 board/etin/debris/phantom.c: Fix compile error

In reply to Wolfgang Denk

Fix build problem caused by commit e84aba13: "Replace BCD2BIN and BIN2BCD macros with inline functions"

phantom.c:163: error: redefinition of 'bcd2bin' /home/wd/git/u-boot/work/include/bcd.h:16: error: previous definition of 'bcd2bin' was here phantom.c:168: error: redefinition of 'bin2bcd' /home/wd/git/u-boot/work/include/bcd.h:21: error: previous definition of 'bin2bcd' was here

---
 board/etin/debris/phantom.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
board/etin/debris/phantom.c +0 -10
index fcb4c40..63feb7c 100644
@@ -159,16 +159,6 @@ void rtc_reset(void)
 	}
 }
 
-inline unsigned bcd2bin (uchar n)
-{
-	return ((((n >> 4) & 0x0F) * 10) + (n & 0x0F));
-}
-
-inline unsigned char bin2bcd (unsigned int n)
-{
-	return (((n / 10) << 4) | (n % 10));
-}
-
 static int get_century_flag(void)
 {
 	int flag = 0;
Signature · 1 line
1.6.0.6
author Applied
#5 lore raw

PATCH 1/1 board/etin/debris/phantom.c: Fix compile error

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

Fix build problem caused by commit e84aba13: "Replace BCD2BIN and BIN2BCD macros with inline functions"

phantom.c:163: error: redefinition of 'bcd2bin' /home/wd/git/u-boot/work/include/bcd.h:16: error: previous definition of 'bcd2bin' was here phantom.c:168: error: redefinition of 'bin2bcd' /home/wd/git/u-boot/work/include/bcd.h:21: error: previous definition of 'bin2bcd' was here

Quoted 5 lines
---
 board/etin/debris/phantom.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

Applied.

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
"Plan to throw one away.  You will anyway."
                              - Fred Brooks, "The Mythical Man Month"
#6 lore raw

PATCH 1/1 board/linkstation/ide.c: Fix compile warning

In reply to Wolfgang Denk

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>
---
 board/linkstation/ide.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
board/linkstation/ide.c +3 -1
index 2c89d62..5dd1d0e 100644
@@ -54,10 +54,12 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		ulong *ide_bus_offset_ptr = &ide_bus_offset[0];
+
 		status = 0;
 
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
+							   (u32 *)ide_bus_offset_ptr);
 		ide_bus_offset[0] &= 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
 							 ide_bus_offset[0] & 0xfffffffe,
Signature · 1 line
1.6.0.6
#7 lore raw

PATCH 1/1 board/linkstation/ide.c: Fix compile warning

Hi Wolfgang

Quoted 14 lines · Wolfgang Denk

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>
---
 board/linkstation/ide.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
board/linkstation/ide.c +0 -0
index 2c89d62..5dd1d0e 100644

board/linkstation/ide.c int ide_preinit (void) · line 62

Quoted 10 lines
board/linkstation/ide.c +3 -1
@@ -54,10 +54,12 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		ulong *ide_bus_offset_ptr = &ide_bus_offset[0];
+
 		status = 0;
 
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
+							   (u32 *)ide_bus_offset_ptr);

Can we also use this occasion to get rid of this typecast?

Quoted 5 lines
board/linkstation/ide.c +0 -0
 		ide_bus_offset[0] &= 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
 							 ide_bus_offset[0] & 0xfffffffe,
Signature · 1 line
1.6.0.6

Thanks
Guennadi
---
Guennadi Liakhovetski

#8 lore raw

PATCH 1/1 board/linkstation/ide.c: Fix compile warning

Dear Guennadi Liakhovetski,

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

Hi Wolfgang

Quoted 21 lines · Wolfgang Denk

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>
---
 board/linkstation/ide.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
board/linkstation/ide.c +2 -0
index 2c89d62..5dd1d0e 100644
@@ -54,10 +54,12 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		ulong *ide_bus_offset_ptr = &ide_bus_offset[0];
+
 		status = 0;
 
Quoted 5 lines

board/linkstation/ide.c int ide_preinit (void) · line 62

Quoted 3 lines
board/linkstation/ide.c +1 -1
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
+							   (u32 *)ide_bus_offset_ptr);

Can we also use this occasion to get rid of this typecast?

No, as this would result in

ide.c:62: warning: passing argument 3 of 'pci_read_config_dword' from incompatible pointer type

OK, we can declare ide_bus_offset_ptr as u32 8, but then we need the cast there to avoid a "initialization from incompatible pointer type" warning - so this isn't exactly an improvement.

I suggest we leave it as is, as this is the minimal-invasive change.

If you want to submit a more general cleanup patch (unifying data types) you are welcome (but that would be a separate action in any case).

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
If I had to live my life again,  I'd  make  the  same  mistakes, only
sooner.                                          -- Tallulah Bankhead
#9 lore raw

PATCH 1/1 board/linkstation/ide.c: Fix compile warning

Quoted 34 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

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

Hi Wolfgang

Quoted 21 lines · Wolfgang Denk

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>
---
 board/linkstation/ide.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
board/linkstation/ide.c +2 -0
index 2c89d62..5dd1d0e 100644
@@ -54,10 +54,12 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		ulong *ide_bus_offset_ptr = &ide_bus_offset[0];
+
 		status = 0;
 
Quoted 5 lines

board/linkstation/ide.c int ide_preinit (void) · line 62

Quoted 3 lines
board/linkstation/ide.c +1 -1
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
+							   (u32 *)ide_bus_offset_ptr);

Can we also use this occasion to get rid of this typecast?

Quoted 8 lines

No, as this would result in

ide.c:62: warning: passing argument 3 of 'pci_read_config_dword' from incompatible pointer type

OK, we can declare ide_bus_offset_ptr as u32 8, but then we need the cast there to avoid a "initialization from incompatible pointer type" warning - so this isn't exactly an improvement.

Ok, understand.

Quoted 10 lines

I suggest we leave it as is, as this is the minimal-invasive change.

If you want to submit a more general cleanup patch (unifying data types) you are welcome (but that would be a separate action in any case).

Best regards,

Wolfgang Denk

Thanks
Guennadi
---
Guennadi Liakhovetski

#10 lore raw

PATCH 1/1 board/linkstation/ide.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 29 lines · Wolfgang Denk
Quoted 22 lines · In message <[email protected]> you wrote:
Quoted 21 lines · Wolfgang Denk

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>
---
 board/linkstation/ide.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
board/linkstation/ide.c +2 -0
index 2c89d62..5dd1d0e 100644
@@ -54,10 +54,12 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		ulong *ide_bus_offset_ptr = &ide_bus_offset[0];
+
 		status = 0;
 
Quoted 5 lines

board/linkstation/ide.c int ide_preinit (void) · line 62

Quoted 3 lines
board/linkstation/ide.c +1 -1
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
+							   (u32 *)ide_bus_offset_ptr);

Can we also use this occasion to get rid of this typecast?

Quoted 4 lines

No, as this would result in

ide.c:62: warning: passing argument 3 of 'pci_read_config_dword' from incompatible pointer type

What about something like:

u32 ide_bus_offset32;
pci_read_config_dword(..., &ide_bus_offset32);
ide_bus_offset[0] = ide_bus_offset32;

-Scott

#11 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>

---
v2: Better implementation as suggested by Scott Wood in

    http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/67840/focus=67891
 board/linkstation/ide.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
board/linkstation/ide.c +4 -2
index 2c89d62..568fdf5 100644
@@ -54,11 +54,13 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		u32 ide_bus_offset32;
+
 		status = 0;
 
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
-		ide_bus_offset[0] &= 0xfffffffe;
+							   &ide_bus_offset32);
+		ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
 							 ide_bus_offset[0] & 0xfffffffe,
 							 PCI_REGION_IO);
Signature · 1 line
1.6.0.6
#12 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Quoted 23 lines · Wolfgang Denk

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>

---
v2: Better implementation as suggested by Scott Wood in

    http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/67840/focus=67891
 board/linkstation/ide.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
board/linkstation/ide.c +2 -0
index 2c89d62..568fdf5 100644
@@ -54,11 +54,13 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		u32 ide_bus_offset32;
+

board/linkstation/ide.c int ide_preinit (void) · line 66

Quoted 10 lines
board/linkstation/ide.c +2 -2
 		status = 0;
 
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
-		ide_bus_offset[0] &= 0xfffffffe;
+							   &ide_bus_offset32);
+		ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
 							 ide_bus_offset[0] & 0xfffffffe,
 							 PCI_REGION_IO);

Ok, yes, this looks much better now without casts, but - the double " & 0xfffffffe" above seems completely redundant to me. I understand, that that's not the problem you're fixing with this patch, and I will perfectly understand if you refuse to mix these two fixes, but... Another thing - why doesn't the compiler complain about exactly identical cast (ok, almost) a couple of lines down for ide_bus_offset[1]? So, how about this diff instead (only compile-tested) (not for submission yet, so, no Sob's, no patch header):

board/linkstation/ide.c +14 -11
index 2c89d62..f96af74 100644
@@ -54,20 +54,23 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 		devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
 	if (devbusfn != -1) {
+		u32 ide_bus_offset32;
+
 		status = 0;
 
-		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
-		ide_bus_offset[0] &= 0xfffffffe;
+		pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0,
+				      &ide_bus_offset32);
+		ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
-							 ide_bus_offset[0] & 0xfffffffe,
-							 PCI_REGION_IO);
-		pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2,
-				      (u32 *) &ide_bus_offset[1]);
-		ide_bus_offset[1] &= 0xfffffffe;
-		ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
-							 ide_bus_offset[1] & 0xfffffffe,
-							 PCI_REGION_IO);
+					ide_bus_offset[0], PCI_REGION_IO);
+
+		if (CONFIG_SYS_IDE_MAXBUS > 1) {
+			pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2,
+					      &ide_bus_offset32);
+			ide_bus_offset[1] = ide_bus_offset32 & 0xfffffffe;
+			ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
+					ide_bus_offset[1], PCI_REGION_IO);
+		}
 	}
 
 	if (pci_find_device (PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8212, 0) != -1) {

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#13 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Dear Guennadi Liakhovetski,

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

board/linkstation/ide.c int ide_preinit (void)

Quoted 9 lines
board/linkstation/ide.c +2 -2
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
-		ide_bus_offset[0] &= 0xfffffffe;
+							   &ide_bus_offset32);
+		ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
 							 ide_bus_offset[0] & 0xfffffffe,
 							 PCI_REGION_IO);

Ok, yes, this looks much better now without casts, but - the double " & 0xfffffffe" above seems completely redundant to me. I understand, that that's not the problem you're fixing with this patch, and I will perfectly understand if you refuse to mix these two fixes, but... Another thing -

Ah, I see. Sorry I missed that. It's easy to fix.

Quoted 2 lines

why doesn't the compiler complain about exactly identical cast (ok, almost) a couple of lines down for ide_bus_offset[1]? So, how about this

Good question. Please post it on a gcc mailing ist and report back the results you get.

Quoted 2 lines

diff instead (only compile-tested) (not for submission yet, so, no Sob's, no patch header):

Hm, this is much more intrusive - do you have a way to test in on real hardware?

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
If God wanted me to touch my toes, he'd have put them on my knees.
#14 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Quoted 23 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

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

board/linkstation/ide.c int ide_preinit (void)

Quoted 9 lines
board/linkstation/ide.c +2 -2
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-							   (u32 *) &ide_bus_offset[0]);
-		ide_bus_offset[0] &= 0xfffffffe;
+							   &ide_bus_offset32);
+		ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
 		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
 							 ide_bus_offset[0] & 0xfffffffe,
 							 PCI_REGION_IO);

Ok, yes, this looks much better now without casts, but - the double " & 0xfffffffe" above seems completely redundant to me. I understand, that that's not the problem you're fixing with this patch, and I will perfectly understand if you refuse to mix these two fixes, but... Another thing -

Ah, I see. Sorry I missed that. It's easy to fix.

Quoted 2 lines

why doesn't the compiler complain about exactly identical cast (ok, almost) a couple of lines down for ide_bus_offset[1]? So, how about this

Quoted 8 lines

Good question. Please post it on a gcc mailing ist and report back the results you get.

Quoted 2 lines

diff instead (only compile-tested) (not for submission yet, so, no Sob's, no patch header):

Hm, this is much more intrusive - do you have a way to test in on real hardware?

I have the hardware, yes, and I even have something, that should be a Jtag cable for it... But I don't have near 100% certainty, that if I brick it I will be able in reasonable time to recover it... But, hey, that's what I have that hardware for... So, yes, I would be able to test, just not immediately.

Thanks
Guennadi
---
Guennadi Liakhovetski

#15 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Dear Guennadi Liakhovetski,

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

I have the hardware, yes, and I even have something, that should be a Jtag cable for it... But I don't have near 100% certainty, that if I brick it I will be able in reasonable time to recover it... But, hey, that's what I have that hardware for... So, yes, I would be able to test, just not immediately.

Do you think you can submit this patch before the end of the current merge window? Otherwise I'd check in my previous clean up patch now, and then wait for your rework in the next (?) version.

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
A modem is a baudy house.
#16 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Quoted 10 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

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

I have the hardware, yes, and I even have something, that should be a Jtag cable for it... But I don't have near 100% certainty, that if I brick it I will be able in reasonable time to recover it... But, hey, that's what I have that hardware for... So, yes, I would be able to test, just not immediately.

Quoted 3 lines

Do you think you can submit this patch before the end of the current merge window? Otherwise I'd check in my previous clean up patch now, and then wait for your rework in the next (?) version.

don't think so, very unlikely I'll have time for this in the next month.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#17 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

Dear Guennadi Liakhovetski,

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

Dear Guennadi Liakhovetski,

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

I have the hardware, yes, and I even have something, that should be a Jtag cable for it... But I don't have near 100% certainty, that if I brick it I will be able in reasonable time to recover it... But, hey, that's what I have that hardware for... So, yes, I would be able to test, just not immediately.

Quoted 5 lines
Quoted 3 lines

Do you think you can submit this patch before the end of the current merge window? Otherwise I'd check in my previous clean up patch now, and then wait for your rework in the next (?) version.

don't think so, very unlikely I'll have time for this in the next month.

OK, so please submit an incremental patch whenever you find time.

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
"An open mind has but one disadvantage: it collects dirt."
                                                    - a saying at RPI
author Applied
#18 lore raw

PATCH v2 1/1 board/linkstation/ide.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 6 lines · In message <[email protected]> you wrote:

Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Guennadi Liakhovetski <[email protected]>
Quoted 6 lines

---
v2: Better implementation as suggested by Scott Wood in

    http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/67840/focus=67891
 board/linkstation/ide.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Applied.

Best regards,

Wolfgang Denk

Signature · 6 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
...computer hardware progress is so fast. No other  technology  since
civilization  began  has seen six orders of magnitude in performance-
price gain in 30 years.                             - Fred Brooks, Jr.
#19 lore raw

PATCH 1/1 board/amcc/taihu/flash.c: Fix compile warning

In reply to Wolfgang Denk

Fix warnings:
flash.c: In function 'write_word_1':
flash.c:696: warning: dereferencing type-punned pointer will break strict-aliasing rules flash.c: In function 'write_word_2':
flash.c:1044: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/amcc/taihu/flash.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
board/amcc/taihu/flash.c +8 -6
index 110cbe5..497fdb9 100644
@@ -691,9 +691,10 @@ static int write_word_1(flash_info_t * info, ulong dest, ulong data)
 static int write_word(flash_info_t * info, ulong dest, ulong data)
 #endif
 {
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *) & data;
+	ulong *data_ptr = &data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int i;
 
@@ -1039,9 +1040,10 @@ static int flash_erase_2(flash_info_t * info, int s_first, int s_last)
 
 static int write_word_2(flash_info_t * info, ulong dest, ulong data)
 {
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *) & data;
+	ulong *data_ptr = &data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int i;
 
Signature · 1 line
1.6.0.6
#20 lore raw

PATCH 1/1 board/amcc/taihu/flash.c: Fix compile warning

Quoted 9 lines · On Friday 11 September 2009 11:49:22 Wolfgang Denk wrote:

Fix warnings:
flash.c: In function 'write_word_1':
flash.c:696: warning: dereferencing type-punned pointer will break
strict-aliasing rules flash.c: In function 'write_word_2':
flash.c:1044: warning: dereferencing type-punned pointer will break
strict-aliasing rules

Thanks.
Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

author Applied
#21 lore raw

PATCH 1/1 board/amcc/taihu/flash.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 11 lines · In message <[email protected]> you wrote:

Fix warnings:
flash.c: In function 'write_word_1':
flash.c:696: warning: dereferencing type-punned pointer will break strict-aliasing rules flash.c: In function 'write_word_2':
flash.c:1044: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/amcc/taihu/flash.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

Applied.

Wolfgang Denk

Signature · 7 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
Alan Turing thought about criteria to settle the question of  whether
machines  can think, a question of which we now know that it is about
as relevant as the question of whether submarines can swim.
                                                   -- Edsger Dijkstra
#22 lore raw

PATCH 1/1 board/amcc/yucca/flash.c: Fix compile warning

In reply to Wolfgang Denk

Fix warning: flash.c:919: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/amcc/yucca/flash.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
board/amcc/yucca/flash.c +4 -3
index eda49eb..d8c3b32 100644
@@ -914,9 +914,10 @@ static int flash_erase_2(flash_info_t * info, int s_first, int s_last)
 
 static int write_word_2(flash_info_t * info, ulong dest, ulong data)
 {
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *) & data;
+	ulong *data_ptr = &data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int i;
 
Signature · 1 line
1.6.0.6
#23 lore raw

PATCH 1/1 board/amcc/yucca/flash.c: Fix compile warning

Quoted 5 lines · On Friday 11 September 2009 11:49:23 Wolfgang Denk wrote:

Fix warning: flash.c:919: warning: dereferencing type-punned pointer will break strict-aliasing rules

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

author Applied
#24 lore raw

PATCH 1/1 board/amcc/yucca/flash.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:

Fix warning: flash.c:919: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/amcc/yucca/flash.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Applied.

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
Do not underestimate the value of print statements for debugging.
author Applied
#25 lore raw

PATCH 1/1 board/dave/common/flash.c: fix compile warning

In reply to Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:

Fix warning: ../common/flash.c:668: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/dave/common/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Applied.

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
Veni, Vidi, VISA:
        I came, I saw, I did a little shopping.