From: Aaro Koskinen Date: Tue, 13 Sep 2011 19:49:31 +0000 (+0300) Subject: staging: xgifb: main: use readb()/readw() to access iomapped memory X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=863c02af581e0d1b0cf57e9f3b785572bcfcd980;p=openwrt%2Fstaging%2Fblogic.git staging: xgifb: main: use readb()/readw() to access iomapped memory Use readb()/readw() instead of direct pointer access to read I/O mapped memory and also add __iomem annotation. The patch eliminates the following sparse warnings: drivers/staging/xgifb/XGI_main_26.c:2125:35: warning: incorrect type in assignment (different address spaces) drivers/staging/xgifb/XGI_main_26.c:2125:35: expected char *[addressable] [toplevel] [assigned] mmio_vbase drivers/staging/xgifb/XGI_main_26.c:2125:35: got void [noderef] * drivers/staging/xgifb/XGI_main_26.c:2439:31: warning: incorrect type in argument 1 (different address spaces) drivers/staging/xgifb/XGI_main_26.c:2439:31: expected void volatile [noderef] *addr drivers/staging/xgifb/XGI_main_26.c:2439:31: got char *[addressable] [toplevel] [assigned] mmio_vbase drivers/staging/xgifb/XGI_main_26.c:2463:31: warning: incorrect type in argument 1 (different address spaces) drivers/staging/xgifb/XGI_main_26.c:2463:31: expected void volatile [noderef] *addr drivers/staging/xgifb/XGI_main_26.c:2463:31: got char *[addressable] [toplevel] [assigned] mmio_vbase Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 8c5a6e8a695e..e6156f15f0bb 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -498,48 +498,38 @@ invalid: static int XGIfb_GetXG21LVDSData(void) { u8 tmp; - unsigned char *pData; + void __iomem *data = xgi_video_info.mmio_vbase + 0x20000; int i, j, k; tmp = xgifb_reg_get(XGISR, 0x1e); xgifb_reg_set(XGISR, 0x1e, tmp | 4); - pData = xgi_video_info.mmio_vbase + 0x20000; - if ((pData[0x0] == 0x55) && - (pData[0x1] == 0xAA) && - (pData[0x65] & 0x1)) { - i = pData[0x316] | (pData[0x317] << 8); - j = pData[i - 1]; + if ((readb(data) == 0x55) && + (readb(data + 1) == 0xAA) && + (readb(data + 0x65) & 0x1)) { + i = readw(data + 0x316); + j = readb(data + i - 1); if (j == 0xff) j = 1; k = 0; do { - XGI21_LCDCapList[k].LVDS_Capability = pData[i] - | (pData[i + 1] << 8); - XGI21_LCDCapList[k].LVDSHT = pData[i + 2] | (pData[i - + 3] << 8); - XGI21_LCDCapList[k].LVDSVT = pData[i + 4] | (pData[i - + 5] << 8); - XGI21_LCDCapList[k].LVDSHDE = pData[i + 6] | (pData[i - + 7] << 8); - XGI21_LCDCapList[k].LVDSVDE = pData[i + 8] | (pData[i - + 9] << 8); - XGI21_LCDCapList[k].LVDSHFP = pData[i + 10] | (pData[i - + 11] << 8); - XGI21_LCDCapList[k].LVDSVFP = pData[i + 12] | (pData[i - + 13] << 8); - XGI21_LCDCapList[k].LVDSHSYNC = pData[i + 14] - | (pData[i + 15] << 8); - XGI21_LCDCapList[k].LVDSVSYNC = pData[i + 16] - | (pData[i + 17] << 8); - XGI21_LCDCapList[k].VCLKData1 = pData[i + 18]; - XGI21_LCDCapList[k].VCLKData2 = pData[i + 19]; - XGI21_LCDCapList[k].PSC_S1 = pData[i + 20]; - XGI21_LCDCapList[k].PSC_S2 = pData[i + 21]; - XGI21_LCDCapList[k].PSC_S3 = pData[i + 22]; - XGI21_LCDCapList[k].PSC_S4 = pData[i + 23]; - XGI21_LCDCapList[k].PSC_S5 = pData[i + 24]; + XGI21_LCDCapList[k].LVDS_Capability = readw(data + i); + XGI21_LCDCapList[k].LVDSHT = readw(data + i + 2); + XGI21_LCDCapList[k].LVDSVT = readw(data + i + 4); + XGI21_LCDCapList[k].LVDSHDE = readw(data + i + 6); + XGI21_LCDCapList[k].LVDSVDE = readw(data + i + 8); + XGI21_LCDCapList[k].LVDSHFP = readw(data + i + 10); + XGI21_LCDCapList[k].LVDSVFP = readw(data + i + 12); + XGI21_LCDCapList[k].LVDSHSYNC = readw(data + i + 14); + XGI21_LCDCapList[k].LVDSVSYNC = readw(data + i + 16); + XGI21_LCDCapList[k].VCLKData1 = readb(data + i + 18); + XGI21_LCDCapList[k].VCLKData2 = readb(data + i + 19); + XGI21_LCDCapList[k].PSC_S1 = readb(data + i + 20); + XGI21_LCDCapList[k].PSC_S2 = readb(data + i + 21); + XGI21_LCDCapList[k].PSC_S3 = readb(data + i + 22); + XGI21_LCDCapList[k].PSC_S4 = readb(data + i + 23); + XGI21_LCDCapList[k].PSC_S5 = readb(data + i + 24); i += 25; j--; k++; diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h index 5d81cb69e63c..12e1a3e330b7 100644 --- a/drivers/staging/xgifb/XGIfb.h +++ b/drivers/staging/xgifb/XGIfb.h @@ -59,7 +59,7 @@ struct video_info { char *video_vbase; unsigned long mmio_base; unsigned long mmio_size; - char *mmio_vbase; + void __iomem *mmio_vbase; unsigned long vga_base; unsigned long mtrr;