# HG changeset patch # User reimar # Date 1304797766 0 # Node ID 8773e8565983c4db6064af4180b9931976c41010 # Parent d4af28753ec874b3fdf89f8973acd7ff58d84aef Simplify macros and get rid of incorrect casts from pointers to uint32_t. Fixes also a huge amount of compiler warnings. diff -r d4af28753ec8 -r 8773e8565983 vidix/mga_vid.c --- a/vidix/mga_vid.c Sat May 07 19:44:05 2011 +0000 +++ b/vidix/mga_vid.c Sat May 07 19:49:26 2011 +0000 @@ -67,14 +67,13 @@ #define ENOTSUP EOPNOTSUPP #endif -/* from radeon_vid */ -#define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ)))) -#define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL +#define GETREG(TYPE,PTR) (*(volatile TYPE*)(PTR)) +#define SETREG(TYPE,PTR,VAL) (*(volatile TYPE*)(PTR))=VAL -#define readb(addr) GETREG(uint8_t,(uint32_t)(addr),0) -#define writeb(val,addr) SETREG(uint8_t,(uint32_t)(addr),0,val) -#define readl(addr) GETREG(uint32_t,(uint32_t)(addr),0) -#define writel(val,addr) SETREG(uint32_t,(uint32_t)(addr),0,val) +#define readb(addr) GETREG(uint8_t,addr) +#define writeb(val,addr) SETREG(uint8_t,addr,val) +#define readl(addr) GETREG(uint32_t,addr) +#define writel(val,addr) SETREG(uint32_t,addr,val) static int mga_verbose = 0;