Skip to content

Commit

Permalink
staging: xgifb: vb_init: use readl()/writel() to access iomapped memory
Browse files Browse the repository at this point in the history
Use readl() and writel() in FB memory test instead of direct pointer
access, and also add iomem annotations for the FB memory.

The patch eliminates the following sparse warnings:

drivers/staging/xgifb/XGI_main_26.c:2113:69: warning: incorrect type in assignment (different address spaces)
drivers/staging/xgifb/XGI_main_26.c:2113:69:    expected unsigned char *static [addressable] [toplevel] [assigned] pjVideoMemoryAddress
drivers/staging/xgifb/XGI_main_26.c:2113:69:    got void [noderef] <asn:2>*
drivers/staging/xgifb/XGI_main_26.c:2399:30: warning: incorrect type in assignment (different address spaces)
drivers/staging/xgifb/XGI_main_26.c:2399:30:    expected char [noderef] <asn:2>*screen_base
drivers/staging/xgifb/XGI_main_26.c:2399:30:    got char *[addressable] [toplevel] [assigned] video_vbase
drivers/staging/xgifb/XGI_main_26.c:2430:31: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/xgifb/XGI_main_26.c:2430:31:    expected void volatile [noderef] <asn:2>*addr
drivers/staging/xgifb/XGI_main_26.c:2430:31:    got char *[addressable] [toplevel] [assigned] video_vbase
drivers/staging/xgifb/XGI_main_26.c:2454:31: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/xgifb/XGI_main_26.c:2454:31:    expected void volatile [noderef] <asn:2>*addr
drivers/staging/xgifb/XGI_main_26.c:2454:31:    got char *[addressable] [toplev

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Aaro Koskinen authored and Greg Kroah-Hartman committed Sep 16, 2011
1 parent 4b49546 commit c44fa62
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/xgifb/XGIfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct video_info {
int chip_id;
unsigned int video_size;
unsigned long video_base;
char *video_vbase;
void __iomem *video_vbase;
unsigned long mmio_base;
unsigned long mmio_size;
void __iomem *mmio_vbase;
Expand Down
10 changes: 5 additions & 5 deletions drivers/staging/xgifb/vb_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,26 +678,26 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr,
{
int i;
unsigned long Position = 0;
void __iomem *fbaddr = pVBInfo->FBAddr;

*((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
writel(Position, fbaddr + Position);

for (i = StartAddr; i <= StopAddr; i++) {
Position = 1 << i;
*((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
writel(Position, fbaddr + Position);
}

udelay(500); /* [Vicent] 2004/04/16.
Fix #1759 Memory Size error in Multi-Adapter. */

Position = 0;

if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) != Position)
if (readl(fbaddr + Position) != Position)
return 0;

for (i = StartAddr; i <= StopAddr; i++) {
Position = 1 << i;
if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) !=
Position)
if (readl(fbaddr + Position) != Position)
return 0;
}
return 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/xgifb/vb_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ struct vb_device_info {
unsigned short SelectCRT2Rate;

unsigned char *ROMAddr;
unsigned char *FBAddr;
void __iomem *FBAddr;
unsigned long BaseAddr;
unsigned long RelIO;

Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/xgifb/vgatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct xgi_hw_device_info {

unsigned char *pjVirtualRomBase; /* ROM image */

unsigned char *pjVideoMemoryAddress;/* base virtual memory address */
void __iomem *pjVideoMemoryAddress;/* base virtual memory address */
/* of Linear VGA memory */

unsigned long ulVideoMemorySize; /* size, in bytes, of the
Expand Down

0 comments on commit c44fa62

Please sign in to comment.