From 9ec9f6f0ea9148eed5bfc7a406cbb31797845883 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Sat, 15 Mar 2008 23:55:51 -0300 Subject: [PATCH] Compile warning fixes. Ansify functions in AsmMacros.h. These are used only in this driver so there should not exist any problems, but the functions receive char/short arguments. Declare as static some functions from the utility programs to avoid warning about missing prototypes. Include for usleep prototype. Don't declare some unused variables, or move them to the appropriate ifdef. --- src/ct_cursor.c | 2 + src/ct_driver.c | 9 +++- src/ct_regs.c | 2 +- util/AsmMacros.h | 111 ++++++++++++++++-------------------------------------- util/dRegs.c | 1 + util/mRegs.c | 1 + util/modClock.c | 7 ++- 7 files changed, 48 insertions(+), 85 deletions(-) diff --git a/src/ct_cursor.c b/src/ct_cursor.c index 34019e2..97ab6f3 100644 --- a/src/ct_cursor.c +++ b/src/ct_cursor.c @@ -48,6 +48,8 @@ /* Driver specific headers */ #include "ct_driver.h" +#include + /* Sync function, maybe this should check infoRec->NeedToSync before syncing */ #define CURSOR_SYNC(pScrn) \ if (IS_HiQV(cPtr)) { \ diff --git a/src/ct_driver.c b/src/ct_driver.c index c05798f..cbf1d0a 100644 --- a/src/ct_driver.c +++ b/src/ct_driver.c @@ -138,6 +138,8 @@ /* Driver specific headers */ #include "ct_driver.h" +#include + /* Mandatory functions */ static const OptionInfoRec * CHIPSAvailableOptions(int chipid, int busid); static void CHIPSIdentify(int flags); @@ -146,6 +148,7 @@ static Bool CHIPSPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev, intptr_t match_data); #else static Bool CHIPSProbe(DriverPtr drv, int flags); +static int chipsFindIsaDevice(GDevPtr dev); #endif static Bool CHIPSPreInit(ScrnInfoPtr pScrn, int flags); static Bool CHIPSScreenInit(int Index, ScreenPtr pScreen, int argc, @@ -159,7 +162,6 @@ static ModeStatus CHIPSValidMode(int scrnIndex, DisplayModePtr mode, static Bool CHIPSSaveScreen(ScreenPtr pScreen, int mode); /* Internally used functions */ -static int chipsFindIsaDevice(GDevPtr dev); static Bool chipsClockSelect(ScrnInfoPtr pScrn, int no); Bool chipsModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void chipsSave(ScrnInfoPtr pScrn, vgaRegPtr VgaSave, @@ -559,6 +561,7 @@ static PciChipsets CHIPSPCIchipsets[] = { { -1, -1, RES_UNDEFINED} }; +#ifndef XSERVER_LIBPCIACCESS static IsaChipsets CHIPSISAchipsets[] = { { CHIPS_CT65520, RES_EXCLUSIVE_VGA }, { CHIPS_CT65525, RES_EXCLUSIVE_VGA }, @@ -578,6 +581,7 @@ static IsaChipsets CHIPSISAchipsets[] = { { CHIPS_CT64300, RES_EXCLUSIVE_VGA }, { -1, RES_UNDEFINED } }; +#endif /* The options supported by the Chips and Technologies Driver */ typedef enum { @@ -904,7 +908,6 @@ CHIPSPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev, { ScrnInfoPtr pScrn = NULL; EntityInfoPtr pEnt; - CHIPSPtr cPtr; /* Allocate a ScrnInfoRec and claim the slot */ pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, CHIPSPCIchipsets, NULL, @@ -1079,7 +1082,6 @@ CHIPSProbe(DriverPtr drv, int flags) xfree(devSections); return foundScreen; } -#endif static int chipsFindIsaDevice(GDevPtr dev) @@ -1164,6 +1166,7 @@ chipsFindIsaDevice(GDevPtr dev) } return found; } +#endif /* Mandatory */ Bool diff --git a/src/ct_regs.c b/src/ct_regs.c index 5a88a1c..daa0dcd 100644 --- a/src/ct_regs.c +++ b/src/ct_regs.c @@ -116,7 +116,7 @@ /* * PIO Access to the C&T extension registers */ -void +static void chipsStdWriteXR(CHIPSPtr cPtr, CARD8 index, CARD8 value) { outb(cPtr->PIOBase + CHIPS_XR_INDEX, index); diff --git a/util/AsmMacros.h b/util/AsmMacros.h index 98e0b04..b35c8a0 100644 --- a/util/AsmMacros.h +++ b/util/AsmMacros.h @@ -80,32 +80,25 @@ #endif static __inline__ void -outb(port, val) -unsigned long port; -char val; +outb(unsigned long port, char val) { __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); } static __inline__ void -outw(port, val) -unsigned long port; -char val; +outw(unsigned long port, char val) { __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); } static __inline__ void -outl(port, val) -unsigned long port; -char val; +outl(unsigned long port, char val) { __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); } static __inline__ unsigned int -inb(port) -unsigned long port; +inb(unsigned long port) { unsigned char ret; __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); @@ -113,8 +106,7 @@ unsigned long port; } static __inline__ unsigned int -inw(port) -unsigned long port; +inw(unsigned long port) { unsigned char ret; __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); @@ -122,8 +114,7 @@ unsigned long port; } static __inline__ unsigned int -inl(port) -unsigned long port; +inl(unsigned long port) { unsigned char ret; __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); @@ -134,9 +125,7 @@ unsigned long port; unsigned int IOPortBase; /* Memory mapped I/O port area */ static __inline__ void -outb(port, val) - short port; - char val; +outb(short port, char val) { if ((unsigned short)port >= 0x400) return; @@ -144,9 +133,7 @@ outb(port, val) } static __inline__ void -outw(port, val) - short port; - short val; +outw(short port, short val) { if ((unsigned short)port >= 0x400) return; @@ -154,9 +141,7 @@ outw(port, val) } static __inline__ void -outl(port, val) - short port; - int val; +outl(short port, int val) { if ((unsigned short)port >= 0x400) return; @@ -164,8 +149,7 @@ outl(port, val) } static __inline__ unsigned int -inb(port) - short port; +inb(short port) { if ((unsigned short)port >= 0x400) return((unsigned int)-1); @@ -173,8 +157,7 @@ inb(port) } static __inline__ unsigned int -inw(port) - short port; +inw(short port) { if ((unsigned short)port >= 0x400) return((unsigned int)-1); @@ -182,8 +165,7 @@ inw(port) } static __inline__ unsigned int -inl(port) - short port; +inl(short port) { if ((unsigned short)port >= 0x400) return((unsigned int)-1); @@ -194,38 +176,31 @@ inl(port) extern unsigned char *ioBase; static volatile void -eieio() +eieio(void) { __asm__ __volatile__ ("eieio"); } static void -outb(port, value) -short port; -unsigned char value; +outb(short port, unsigned char value) { *(uchar *)(ioBase + port) = value; eieio(); } static void -outw(port, value) -short port; -unsigned short value; +outw(short port, unsigned short value) { *(unsigned short *)(ioBase + port) = value; eieio(); } static void -outl(port, value) -short port; -unsigned long value; +outl(short port, unsigned long value) { *(unsigned long *)(ioBase + port) = value; eieio(); } static unsigned char -inb(port) -short port; +inb(short port) { unsigned char val; @@ -234,8 +209,7 @@ short port; } static unsigned short -inw(port) -short port; +inw(short port) { unsigned short val; @@ -244,8 +218,7 @@ short port; } static unsigned long -inl(port) -short port; +inl(short port) { unsigned long val; @@ -268,32 +241,25 @@ extern u_int32_t inl(u_int32_t port); #else #ifdef GCCUSESGAS static __inline__ void -outb(port, val) -short port; -char val; +outb(short port, char val) { __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); } static __inline__ void -outw(port, val) -short port; -short val; +outw(short port, short val) { __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); } static __inline__ void -outl(port, val) -short port; -unsigned int val; +outl(short port, unsigned int val) { __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); } static __inline__ unsigned int -inb(port) -short port; +inb(short port) { unsigned char ret; __asm__ __volatile__("inb %1,%0" : @@ -303,8 +269,7 @@ short port; } static __inline__ unsigned int -inw(port) -short port; +inw(short port) { unsigned short ret; __asm__ __volatile__("inw %1,%0" : @@ -314,8 +279,7 @@ short port; } static __inline__ unsigned int -inl(port) -short port; +inl(short port) { unsigned int ret; __asm__ __volatile__("inl %1,%0" : @@ -327,32 +291,25 @@ short port; #else /* GCCUSESGAS */ static __inline__ void -outb(port, val) - short port; - char val; +outb(short port, char val) { __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port)); } static __inline__ void -outw(port, val) - short port; - short val; +outw(short port, short val) { __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port)); } static __inline__ void -outl(port, val) - short port; - unsigned int val; +outl(short port, unsigned int val) { __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port)); } static __inline__ unsigned int -inb(port) - short port; +inb(short port) { unsigned int ret; __asm__ __volatile__("in%B0 (%1)" : @@ -362,8 +319,7 @@ inb(port) } static __inline__ unsigned int -inw(port) - short port; +inw(short port) { unsigned int ret; __asm__ __volatile__("in%W0 (%1)" : @@ -373,8 +329,7 @@ inw(port) } static __inline__ unsigned int -inl(port) - short port; +inl(short port) { unsigned int ret; __asm__ __volatile__("in%L0 (%1)" : @@ -398,13 +353,13 @@ inl(port) #else static __inline__ void -intr_disable() +intr_disable(void) { __asm__ __volatile__("cli"); } static __inline__ void -intr_enable() +intr_enable(void) { __asm__ __volatile__("sti"); } diff --git a/util/dRegs.c b/util/dRegs.c index 0c8ee62..8f137b7 100644 --- a/util/dRegs.c +++ b/util/dRegs.c @@ -52,6 +52,7 @@ # endif # else # ifdef linux +extern int iopl(int); # define SET_IOPL() iopl(3) # define RESET_IOPL() iopl(0) # else diff --git a/util/mRegs.c b/util/mRegs.c index 4d8da11..21621f6 100644 --- a/util/mRegs.c +++ b/util/mRegs.c @@ -52,6 +52,7 @@ # endif # else # ifdef linux +extern int iopl(int); # define SET_IOPL() iopl(3) # define RESET_IOPL() iopl(0) # else diff --git a/util/modClock.c b/util/modClock.c index cce4f84..ec4558e 100644 --- a/util/modClock.c +++ b/util/modClock.c @@ -49,6 +49,7 @@ # endif # else # ifdef linux +extern int iopl(int); # define SET_IOPL() iopl(3) # define RESET_IOPL() iopl(0) # else @@ -87,7 +88,7 @@ #define MemClk 1 #define IS_MemClk(X) X&0x1 -int compute_clock ( +static int compute_clock ( unsigned int ChipType, double target, double Fref, @@ -211,7 +212,7 @@ int compute_clock ( return 1; } -int set_clock( +static int set_clock( unsigned int ChipType, unsigned int ClockType, unsigned int ProgClock, @@ -280,7 +281,7 @@ int set_clock( return 0; } -unsigned int probe_chip(void) { +static unsigned int probe_chip(void) { unsigned int ChipType, temp; -- 1.5.3.2