Re: [U-Boot] [PATCH] board/linkstation/ide.c: Fix compile warning
On Fri, Sep 11, 2009 at 02:00:06PM +0200, Wolfgang Denk wrote: > In message you wrote: > > On Fri, 11 Sep 2009, Wolfgang Denk wrote: > > > Fix warning: ide.c:60: warning: dereferencing type-punned pointer will > > > break strict-aliasing rules > > > > > > Signed-off-by: Wolfgang Denk > > > Cc: Guennadi Liakhovetski > > > --- > > > board/linkstation/ide.c |4 +++- > > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > > > diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c > > > index 2c89d62..5dd1d0e 100644 > > > --- a/board/linkstation/ide.c > > > +++ b/board/linkstation/ide.c > > > @@ -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? > > 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] board/linkstation/ide.c: Fix compile warning
On Fri, 11 Sep 2009, Wolfgang Denk wrote: > Dear Guennadi Liakhovetski, > > In message you wrote: > > Hi Wolfgang > > > > On Fri, 11 Sep 2009, Wolfgang Denk wrote: > > > > > Fix warning: ide.c:60: warning: dereferencing type-punned pointer will > > > break strict-aliasing rules > > > > > > Signed-off-by: Wolfgang Denk > > > Cc: Guennadi Liakhovetski > > > --- > > > board/linkstation/ide.c |4 +++- > > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > > > diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c > > > index 2c89d62..5dd1d0e 100644 > > > --- a/board/linkstation/ide.c > > > +++ b/board/linkstation/ide.c > > > @@ -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? > > 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. Acked-by: Guennadi Liakhovetski > > 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] board/linkstation/ide.c: Fix compile warning
Dear Guennadi Liakhovetski, In message you wrote: > Hi Wolfgang > > On Fri, 11 Sep 2009, Wolfgang Denk wrote: > > > Fix warning: ide.c:60: warning: dereferencing type-punned pointer will > > break strict-aliasing rules > > > > Signed-off-by: Wolfgang Denk > > Cc: Guennadi Liakhovetski > > --- > > board/linkstation/ide.c |4 +++- > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c > > index 2c89d62..5dd1d0e 100644 > > --- a/board/linkstation/ide.c > > +++ b/board/linkstation/ide.c > > @@ -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? 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 -- 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: w...@denx.de If I had to live my life again, I'd make the same mistakes, only sooner. -- Tallulah Bankhead ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] board/linkstation/ide.c: Fix compile warning
Hi Wolfgang On Fri, 11 Sep 2009, Wolfgang Denk wrote: > Fix warning: ide.c:60: warning: dereferencing type-punned pointer will > break strict-aliasing rules > > Signed-off-by: Wolfgang Denk > Cc: Guennadi Liakhovetski > --- > board/linkstation/ide.c |4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c > index 2c89d62..5dd1d0e 100644 > --- a/board/linkstation/ide.c > +++ b/board/linkstation/ide.c > @@ -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? > ide_bus_offset[0] &= 0xfffe; > ide_bus_offset[0] = pci_hose_bus_to_phys(&hose, >ide_bus_offset[0] & > 0xfffe, > -- > 1.6.0.6 Thanks Guennadi --- Guennadi Liakhovetski ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] board/linkstation/ide.c: Fix compile warning
Fix warning: ide.c:60: warning: dereferencing type-punned pointer will break strict-aliasing rules Signed-off-by: Wolfgang Denk Cc: Guennadi Liakhovetski --- board/linkstation/ide.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c index 2c89d62..5dd1d0e 100644 --- a/board/linkstation/ide.c +++ b/board/linkstation/ide.c @@ -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] &= 0xfffe; ide_bus_offset[0] = pci_hose_bus_to_phys(&hose, ide_bus_offset[0] & 0xfffe, -- 1.6.0.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot