lkml.org 
[lkml]   [2008]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] gxfb: create DC/VP/FP-specific handlers rather than using readl/writel
On Sat, 8 Mar 2008 20:48:26 -0500
Andres Salomon <dilinger@queued.net> wrote:

> +#define read_dc(reg) readl(par->dc_regs + (reg))
> +#define write_dc(reg, val) writel((val), par->dc_regs + (reg))
> +
> +#define read_vp(reg) readl(par->vid_regs + (reg))
> +#define write_vp(reg, val) writel((uint32_t) (val), \
> + par->vid_regs + (reg))
> +
> +#define read_fp(reg) readl(par->vid_regs + (reg))
> +#define write_fp(reg, val) writel((uint32_t) (val), \
> + par->vid_regs + (reg))
> +

Not very nice, sorry. They're macros, and macros rather suck. And they
implicitly rely upon the caller having some variable called "par" in scope.

It would be much nicer to do

/*
* documentation goes here
*/
static inline u32 read_dc(struct geodefb_par *par, int reg)
{
return readl(par->dc_regs, reg);
}

no?


\
 
 \ /
  Last update: 2008-03-10 22:27    [W:0.031 / U:25.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site