Re: [PATCH:xf86-video-mga 2/2] Use correct type in function call.

2015-07-28 Thread Thomas Klausner
On Tue, Feb 24, 2015 at 07:47:09AM +0100, Mark Kettenis wrote:
   On Mon, Feb 23, 2015 at 4:28 AM, Thomas Klausner w...@netbsd.org wrote:
   Fixes
   passing argument 2 of 'pci_device_cfg_read_u32' from incompatible
   pointer type
   pciaccess.h:153:5: note: expected '__uint32_t *' but argument is of type
   'CARD32 *'
  
   Signed-off-by: Thomas Klausner w...@netbsd.org
   ---
src/mga_dac3026.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
  
   diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c
   index 97c2c7a..e825702 100644
   --- a/src/mga_dac3026.c
   +++ b/src/mga_dac3026.c
   @@ -852,8 +852,12 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg,
   MGARegPtr mgaReg,
   mgaReg-DacRegs[i]   = inTi3026(MGADACregs[i]);
  
#ifdef XSERVER_LIBPCIACCESS
   -   pci_device_cfg_read_u32(pMga-PciInfo,  mgaReg-Option,
   +{
   +   uint32_t Option;
   +   pci_device_cfg_read_u32(pMga-PciInfo,  Option,
   PCI_OPTION_REG);
   +mgaReg-Option = Option;
 
   I don't understand why the previous code generated that warning (isn't
   __uint32_t* implicitly castable to CARD32*?)
 
 On 32-bit systems, CARD32 is unsigned long, whereas uint32_t is usually
 unsigned int.  And since int and long might differ in size on other
 systems, the compiler (rightfully) complains.
 
   but even so, why isn't a cast the appropriate solution?
 
 Because casts almost never are the appropriate solution if they can be
 avoided?

Anything I can do to make progress with this patch?
 Thomas
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH:xf86-video-mga 2/2] Use correct type in function call.

2015-02-23 Thread Thomas Klausner
Fixes
passing argument 2 of 'pci_device_cfg_read_u32' from incompatible pointer type
pciaccess.h:153:5: note: expected '__uint32_t *' but argument is of type 
'CARD32 *'

Signed-off-by: Thomas Klausner w...@netbsd.org
---
 src/mga_dac3026.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c
index 97c2c7a..e825702 100644
--- a/src/mga_dac3026.c
+++ b/src/mga_dac3026.c
@@ -852,8 +852,12 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr 
mgaReg,
mgaReg-DacRegs[i]   = inTi3026(MGADACregs[i]);

 #ifdef XSERVER_LIBPCIACCESS
-   pci_device_cfg_read_u32(pMga-PciInfo,  mgaReg-Option, 
+{
+   uint32_t Option;
+   pci_device_cfg_read_u32(pMga-PciInfo,  Option, 
PCI_OPTION_REG);
+mgaReg-Option = Option;
+}
 #else
mgaReg-Option = pciReadLong(pMga-PciTag, PCI_OPTION_REG);
 #endif
-- 
2.3.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH:xf86-video-mga 2/2] Use correct type in function call.

2015-02-23 Thread Matt Turner
On Mon, Feb 23, 2015 at 4:28 AM, Thomas Klausner w...@netbsd.org wrote:
 Fixes
 passing argument 2 of 'pci_device_cfg_read_u32' from incompatible pointer type
 pciaccess.h:153:5: note: expected '__uint32_t *' but argument is of type 
 'CARD32 *'

 Signed-off-by: Thomas Klausner w...@netbsd.org
 ---
  src/mga_dac3026.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

 diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c
 index 97c2c7a..e825702 100644
 --- a/src/mga_dac3026.c
 +++ b/src/mga_dac3026.c
 @@ -852,8 +852,12 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, 
 MGARegPtr mgaReg,
 mgaReg-DacRegs[i]   = inTi3026(MGADACregs[i]);

  #ifdef XSERVER_LIBPCIACCESS
 -   pci_device_cfg_read_u32(pMga-PciInfo,  mgaReg-Option,
 +{
 +   uint32_t Option;
 +   pci_device_cfg_read_u32(pMga-PciInfo,  Option,
 PCI_OPTION_REG);
 +mgaReg-Option = Option;

I don't understand why the previous code generated that warning (isn't
__uint32_t* implicitly castable to CARD32*?) but even so, why isn't a
cast the appropriate solution?
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel