Commit 863c02af authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

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] <asn:2>*
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] <asn:2>*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] <asn:2>*addr
drivers/staging/xgifb/XGI_main_26.c:2463:31:    got char *[addressable] [toplevel] [assigned] mmio_vbase
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d15cce50
...@@ -498,48 +498,38 @@ static void XGIfb_search_vesamode(unsigned int vesamode) ...@@ -498,48 +498,38 @@ static void XGIfb_search_vesamode(unsigned int vesamode)
static int XGIfb_GetXG21LVDSData(void) static int XGIfb_GetXG21LVDSData(void)
{ {
u8 tmp; u8 tmp;
unsigned char *pData; void __iomem *data = xgi_video_info.mmio_vbase + 0x20000;
int i, j, k; int i, j, k;
tmp = xgifb_reg_get(XGISR, 0x1e); tmp = xgifb_reg_get(XGISR, 0x1e);
xgifb_reg_set(XGISR, 0x1e, tmp | 4); xgifb_reg_set(XGISR, 0x1e, tmp | 4);
pData = xgi_video_info.mmio_vbase + 0x20000; if ((readb(data) == 0x55) &&
if ((pData[0x0] == 0x55) && (readb(data + 1) == 0xAA) &&
(pData[0x1] == 0xAA) && (readb(data + 0x65) & 0x1)) {
(pData[0x65] & 0x1)) { i = readw(data + 0x316);
i = pData[0x316] | (pData[0x317] << 8); j = readb(data + i - 1);
j = pData[i - 1];
if (j == 0xff) if (j == 0xff)
j = 1; j = 1;
k = 0; k = 0;
do { do {
XGI21_LCDCapList[k].LVDS_Capability = pData[i] XGI21_LCDCapList[k].LVDS_Capability = readw(data + i);
| (pData[i + 1] << 8); XGI21_LCDCapList[k].LVDSHT = readw(data + i + 2);
XGI21_LCDCapList[k].LVDSHT = pData[i + 2] | (pData[i XGI21_LCDCapList[k].LVDSVT = readw(data + i + 4);
+ 3] << 8); XGI21_LCDCapList[k].LVDSHDE = readw(data + i + 6);
XGI21_LCDCapList[k].LVDSVT = pData[i + 4] | (pData[i XGI21_LCDCapList[k].LVDSVDE = readw(data + i + 8);
+ 5] << 8); XGI21_LCDCapList[k].LVDSHFP = readw(data + i + 10);
XGI21_LCDCapList[k].LVDSHDE = pData[i + 6] | (pData[i XGI21_LCDCapList[k].LVDSVFP = readw(data + i + 12);
+ 7] << 8); XGI21_LCDCapList[k].LVDSHSYNC = readw(data + i + 14);
XGI21_LCDCapList[k].LVDSVDE = pData[i + 8] | (pData[i XGI21_LCDCapList[k].LVDSVSYNC = readw(data + i + 16);
+ 9] << 8); XGI21_LCDCapList[k].VCLKData1 = readb(data + i + 18);
XGI21_LCDCapList[k].LVDSHFP = pData[i + 10] | (pData[i XGI21_LCDCapList[k].VCLKData2 = readb(data + i + 19);
+ 11] << 8); XGI21_LCDCapList[k].PSC_S1 = readb(data + i + 20);
XGI21_LCDCapList[k].LVDSVFP = pData[i + 12] | (pData[i XGI21_LCDCapList[k].PSC_S2 = readb(data + i + 21);
+ 13] << 8); XGI21_LCDCapList[k].PSC_S3 = readb(data + i + 22);
XGI21_LCDCapList[k].LVDSHSYNC = pData[i + 14] XGI21_LCDCapList[k].PSC_S4 = readb(data + i + 23);
| (pData[i + 15] << 8); XGI21_LCDCapList[k].PSC_S5 = readb(data + i + 24);
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];
i += 25; i += 25;
j--; j--;
k++; k++;
......
...@@ -59,7 +59,7 @@ struct video_info { ...@@ -59,7 +59,7 @@ struct video_info {
char *video_vbase; char *video_vbase;
unsigned long mmio_base; unsigned long mmio_base;
unsigned long mmio_size; unsigned long mmio_size;
char *mmio_vbase; void __iomem *mmio_vbase;
unsigned long vga_base; unsigned long vga_base;
unsigned long mtrr; unsigned long mtrr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment