From 97c801e49251ffedf0eebd0563c737318433f114 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 13 Feb 2018 01:42:41 +0100 Subject: mga_drv: fix warning Fix warnings in the MGA driver. There's no functional change. Reviewed-by: Matt Turner Signed-off-by: Mikulas Patocka --- src/mga.h | 8 ++++---- src/mga_dac3026.c | 8 ++++---- src/mga_dacG.c | 12 ++++++------ src/mga_driver.c | 30 ++++++++++++++++++------------ src/mga_g450pll.c | 10 +++++----- src/mga_merge.c | 14 +++++++------- src/mga_video.c | 4 ++++ 7 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/mga.h b/src/mga.h index 081472a..bfb43b8 100644 --- a/src/mga.h +++ b/src/mga.h @@ -218,9 +218,9 @@ typedef struct { unsigned char * DacRegs; unsigned long crtc2[0x58]; unsigned char dac2[0x21]; - CARD32 Option; - CARD32 Option2; - CARD32 Option3; + uint32_t Option; + uint32_t Option2; + uint32_t Option3; long Clock; unsigned char Pan_Ctl; Bool PIXPLLCSaved; @@ -521,7 +521,7 @@ typedef struct { MessageType BiosFrom; #endif unsigned long FbAddress; - unsigned char * IOBase; + void * IOBase; unsigned char * FbBase; unsigned char * ILOADBase; unsigned char * FbStart; diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c index bf4e668..09fb548 100644 --- a/src/mga_dac3026.c +++ b/src/mga_dac3026.c @@ -694,8 +694,8 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode) MGA_NOT_HAL(MGATi3026SetMCLK(pScrn, MGAdac->MemoryClock)); #ifdef DEBUG - ErrorF("%6ld: %02X %02X %02X %02X %02X %02X %08lX\n", mode->Clock, - pReg->DacClk[0], pReg->DacClk[1], pReg->DacClk[2], pReg->DacClk[3], pReg->DacClk[4], pReg->DacClk[5], pReg->Option); + ErrorF("%6d: %02X %02X %02X %02X %02X %02X %08X\n", mode->Clock, + pReg->DacClk[0], pReg->DacClk[1], pReg->DacClk[2], pReg->DacClk[3], pReg->DacClk[4], pReg->DacClk[5], (unsigned)pReg->Option); for (i=0; iDacRegs[i]); for (i=0; i<6; i++) ErrorF(" %02X", pReg->ExtVga[i]); ErrorF("\n"); @@ -863,8 +863,8 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, #endif #ifdef DEBUG - ErrorF("read: %02X %02X %02X %02X %02X %02X %08lX\n", - mgaReg->DacClk[0], mgaReg->DacClk[1], mgaReg->DacClk[2], mgaReg->DacClk[3], mgaReg->DacClk[4], mgaReg->DacClk[5], mgaReg->Option); + ErrorF("read: %02X %02X %02X %02X %02X %02X %08X\n", + mgaReg->DacClk[0], mgaReg->DacClk[1], mgaReg->DacClk[2], mgaReg->DacClk[3], mgaReg->DacClk[4], mgaReg->DacClk[5], (unsigned)mgaReg->Option); for (i=0; iDacRegs[i]); for (i=0; i<6; i++) ErrorF(" %02X", mgaReg->ExtVga[i]); ErrorF("\n"); diff --git a/src/mga_dacG.c b/src/mga_dacG.c index 861ef25..3b0d93e 100644 --- a/src/mga_dacG.c +++ b/src/mga_dacG.c @@ -1810,8 +1810,8 @@ MGA_NOT_HAL( ErrorF("0x%02X, ", mgaReg->DacRegs[i]); #endif } - ErrorF("\nOPTION = %08lX\n", mgaReg->Option); - ErrorF("OPTION2 = %08lX\n", mgaReg->Option2); + ErrorF("\nOPTION = %08X\n", (unsigned)mgaReg->Option); + ErrorF("OPTION2 = %08X\n", (unsigned)mgaReg->Option2); ErrorF("CRTCEXT:"); for (i=0; i<6; i++) ErrorF(" %02X", mgaReg->ExtVga[i]); ErrorF("\n"); @@ -1955,8 +1955,8 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, ErrorF("0x%02X, ", mgaReg->DacRegs[i]); #endif } - ErrorF("\nOPTION = %08lX\n:", mgaReg->Option); - ErrorF("OPTION2 = %08lX\nCRTCEXT:", mgaReg->Option2); + ErrorF("\nOPTION = %08X\n:", (unsigned)mgaReg->Option); + ErrorF("OPTION2 = %08X\nCRTCEXT:", (unsigned)mgaReg->Option2); for (i=0; i<6; i++) ErrorF(" %02X", mgaReg->ExtVga[i]); ErrorF("\n"); #endif @@ -2173,7 +2173,7 @@ MGAG_I2CPutBits(I2CBusPtr b, int clock, int data) static I2CBusPtr -mgag_create_i2c_bus(const char *name, unsigned bus_index, unsigned scrn_index) +mgag_create_i2c_bus(char *name, unsigned bus_index, unsigned scrn_index) { I2CBusPtr I2CPtr = xf86CreateI2CBusRec(); @@ -2183,7 +2183,7 @@ mgag_create_i2c_bus(const char *name, unsigned bus_index, unsigned scrn_index) I2CPtr->I2CPutBits = MGAG_I2CPutBits; I2CPtr->I2CGetBits = MGAG_I2CGetBits; I2CPtr->AcknTimeout = 5; - I2CPtr->DriverPrivate.ptr = & i2c_priv[bus_index]; + I2CPtr->DriverPrivate.ptr = (void *) &i2c_priv[bus_index]; if (!xf86I2CBusInit(I2CPtr)) { xf86DestroyI2CBusRec(I2CPtr, TRUE, TRUE); diff --git a/src/mga_driver.c b/src/mga_driver.c index ab93c71..0699ac1 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -1024,7 +1024,9 @@ MGASoftReset(ScrnInfoPtr pScrn) MGAPtr pMga = MGAPTR(pScrn); pMga->FbMapSize = 8192 * 1024; - MGAMapMem(pScrn); + if (!MGAMapMem(pScrn)) { + return; + } /* set soft reset bit */ OUTREG(MGAREG_Reset, 1); @@ -1145,7 +1147,9 @@ MGACountRam(ScrnInfoPtr pScrn) ProbeSize = 16384; ProbeSizeOffset = 0x10000; pMga->FbMapSize = ProbeSize * 1024; - MGAMapMem(pScrn); + if (!MGAMapMem(pScrn)) { + return 0; + } base = pMga->FbBase; } @@ -1160,7 +1164,7 @@ MGACountRam(ScrnInfoPtr pScrn) } if (pMga->is_G200WB) { - CARD32 Option, MaxMapSize; + uint32_t Option, MaxMapSize; #ifdef XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pMga->PciInfo, &Option, @@ -1185,7 +1189,9 @@ MGACountRam(ScrnInfoPtr pScrn) else { MGAUnmapMem(pScrn); pMga->FbMapSize = ProbeSize * 1024; - MGAMapMem(pScrn); + if (!MGAMapMem(pScrn)) { + return 0; + } base = pMga->FbBase; } } @@ -1960,7 +1966,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } else { int from = X_DEFAULT; #ifdef USE_EXA - char *s = xf86GetOptValString(pMga->Options, OPTION_ACCELMETHOD); + const char *s = xf86GetOptValString(pMga->Options, OPTION_ACCELMETHOD); #endif pMga->NoAccel = FALSE; pMga->Exa = FALSE; @@ -2667,7 +2673,7 @@ MGAMapMem(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MAPPED Framebuffer %08llX %llx to %08llX.\n", (long long)fbaddr, (long long)fbsize, - (long long)pMga->FbBase); + (long long)(uintptr_t)pMga->FbBase); if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) { region = &dev->regions[pMga->io_bar]; @@ -2803,7 +2809,7 @@ MGAUnmapMem(ScrnInfoPtr pScrn) pMga->entityPrivate->mappedIOBase = NULL; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)pMga->FbBase, (long long)pMga->FbMapSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)(uintptr_t)pMga->FbBase, (long long)pMga->FbMapSize); pci_device_unmap_range(dev, pMga->FbBase, pMga->FbMapSize); #else @@ -2989,9 +2995,9 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) OUTREG8(0x1FDE, 0x06); OUTREG8(0x1FDF, ucHiPriLvl); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %d\n", ulMemoryBandwidth); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %u\n", mode->Clock); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %u\n", pScrn->bitsPerPixel); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %u\n", (unsigned)ulMemoryBandwidth); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == %02X\n", ucHiPriLvl); } else @@ -3170,7 +3176,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL) int width, height, displayWidth; MGAEntPtr pMgaEnt = NULL; int f; - CARD32 VRTemp, FBTemp; + CARD32 VRTemp = 0, FBTemp = 0; #ifdef MGADRI MessageType driFrom = X_DEFAULT; #endif @@ -3750,7 +3756,7 @@ MGACloseScreen(CLOSE_SCREEN_ARGS_DECL) vgaHWPtr hwp = VGAHWPTR(pScrn); MGAPtr pMga = MGAPTR(pScrn); MGAEntPtr pMgaEnt = NULL; - CARD32 VRTemp, FBTemp; + CARD32 VRTemp = 0, FBTemp = 0; if (pMga->MergedFB) MGACloseScreenMerged(pScreen); diff --git a/src/mga_g450pll.c b/src/mga_g450pll.c index 293178c..ae6e1a1 100644 --- a/src/mga_g450pll.c +++ b/src/mga_g450pll.c @@ -134,7 +134,7 @@ static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, *pulPLLMNP |= (CARD32)ucP; #ifdef DEBUG - ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", ulVCO, (ULONG)ucS, *pulPLLMNP); + ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", (unsigned)ulVCO, (unsigned)ucS, (unsigned)*pulPLLMNP); #endif } @@ -315,7 +315,7 @@ double MGAG450SetPLLFreq(ScrnInfoPtr pScrn, long f_out) MGAPtr pMga = MGAPTR(pScrn); #ifdef DEBUG - xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Restoring PLLClk = %d\n",f_out); + xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Restoring PLLClk = %ld\n", f_out); #endif G450FindFirstPLLParam(pScrn, f_out, &ulMNP); ulMNPTable[0] = ulMNP; @@ -489,7 +489,7 @@ MGAG450SavePLLFreq(ScrnInfoPtr pScrn) G450ApplyPFactor(pScrn, ucP, &freq); #ifdef DEBUG - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Saved PLLClk = %d\n",freq); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Saved PLLClk = %u\n", (unsigned)freq); #endif return freq; } @@ -506,7 +506,7 @@ MGAG450PrintPLL(ScrnInfoPtr pScrn) ucP = (CARD8)(ulMNP & 0x03); G450ApplyPFactor(pScrn, ucP, &freq); - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"MGAGClock = %d -- MNP = 0x%x\n", - freq,ulMNP); + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"MGAGClock = %u -- MNP = 0x%x\n", + (unsigned)freq, (unsigned)ulMNP); } #endif diff --git a/src/mga_merge.c b/src/mga_merge.c index fee6290..64c85b4 100644 --- a/src/mga_merge.c +++ b/src/mga_merge.c @@ -18,12 +18,12 @@ #include "fbdevhw.h" static int -StrToRanges(range* r, char* s) { +StrToRanges(range* r, const char* s) { float num=0.0; int rangenum=0; Bool gotdash = FALSE; Bool nextdash = FALSE; - char* strnum=NULL; + const char* strnum=NULL; do { switch(*s) { case '0': case '1': case '2': case '3': case '4': case '5': @@ -117,7 +117,7 @@ CopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest, DisplayModePtr i, DisplayM } static DisplayModePtr -GetModeFromName(char* str, DisplayModePtr i) +GetModeFromName(const char* str, DisplayModePtr i) { DisplayModePtr c = i; if(!i) return NULL; @@ -130,9 +130,9 @@ GetModeFromName(char* str, DisplayModePtr i) /* takes a config file string of MetaModes and generates a MetaModeList */ static DisplayModePtr -GenerateModeList(ScrnInfoPtr pScrn, char* str, +GenerateModeList(ScrnInfoPtr pScrn, const char* str, DisplayModePtr i, DisplayModePtr j, MgaScrn2Rel srel) { - char* strmode = str; + const char* strmode = str; char modename[256]; Bool gotdash = FALSE; MgaScrn2Rel sr; @@ -165,7 +165,7 @@ GenerateModeList(ScrnInfoPtr pScrn, char* str, } else { mode1 = GetModeFromName(modename,i); if(!mode1) { - char* tmps = str; + const char* tmps = str; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Mode: \"%s\" is not a supported mode for monitor 1\n",modename); /* find if a monitor2 mode follows */ @@ -232,7 +232,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) MGAPtr pMga1; MessageType from; int i; - char* s; + const char* s; ClockRangePtr clockRanges; MgaScrn2Rel Monitor2Pos; diff --git a/src/mga_video.c b/src/mga_video.c index 535e329..cb6b9c9 100644 --- a/src/mga_video.c +++ b/src/mga_video.c @@ -1374,6 +1374,7 @@ static void CopyMungedScanline_AXP(CARD32 *fb_ptr, short src_w, } } +#if 0 static void CopyMungedScanline_AXP2(CARD32 *fb_ptr, short src_w, CARD32 *tsp, CARD32 *tpu, CARD32 *tpv) { @@ -1393,6 +1394,7 @@ static void CopyMungedScanline_AXP2(CARD32 *fb_ptr, short src_w, fb_ptr+=4; } } +#endif static void CopyMungedScanlineFilter_AXP(CARD32 *fb_ptr, short src_w, @@ -1466,6 +1468,7 @@ static void CopyMungedScanlineFilter_AXP(CARD32 *fb_ptr, short src_w, } } +#if 0 static void CopyMungedScanlineFilterDown_AXP(CARD32 *fb_ptr, short src_w, CARD32 *tsp1, CARD32 *tpu1, CARD32 *tpv1, CARD32 *tsp2, CARD32 *tpu2, CARD32 *tpv2, @@ -1504,6 +1507,7 @@ static void CopyMungedScanlineFilterDown_AXP(CARD32 *fb_ptr, short src_w, fb_ptr+=4; } } +#endif static void MGACopyScaledILOAD( ScrnInfoPtr pScrn, -- cgit v1.2.3