matroxfb: get rid of unneeded macro MINFO_FROM
With multihead support always enabled, macros MINFO_FROM and MINFO_FROM_INFO are no longer needed and make the code harder to read. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Petr Vandrovec <vandrove@vc.cvut.cz> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
316b4d644c
commit
ee5a274979
6 changed files with 32 additions and 35 deletions
|
@ -275,7 +275,7 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
|
static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
if ((area->sx | area->dx | area->width) & 1)
|
if ((area->sx | area->dx | area->width) & 1)
|
||||||
cfb_copyarea(info, area);
|
cfb_copyarea(info, area);
|
||||||
|
@ -284,7 +284,7 @@ static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyare
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
|
static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
matrox_accel_bmove(minfo, minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width);
|
matrox_accel_bmove(minfo, minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
|
static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
switch (rect->rop) {
|
switch (rect->rop) {
|
||||||
case ROP_COPY:
|
case ROP_COPY:
|
||||||
|
@ -376,7 +376,7 @@ static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
|
static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
switch (rect->rop) {
|
switch (rect->rop) {
|
||||||
case ROP_COPY:
|
case ROP_COPY:
|
||||||
|
@ -478,7 +478,7 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx,
|
||||||
|
|
||||||
|
|
||||||
static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) {
|
static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) {
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG_HEAVY(__func__);
|
DBG_HEAVY(__func__);
|
||||||
|
|
||||||
|
|
|
@ -204,8 +204,7 @@ static irqreturn_t matrox_irq(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
u_int32_t status;
|
u_int32_t status;
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
struct matrox_fb_info *minfo = dev_id;
|
||||||
MINFO_FROM(dev_id);
|
|
||||||
|
|
||||||
status = mga_inl(M_STATUS);
|
status = mga_inl(M_STATUS);
|
||||||
|
|
||||||
|
@ -396,7 +395,7 @@ static void matroxfb_remove(struct matrox_fb_info *minfo, int dummy)
|
||||||
|
|
||||||
static int matroxfb_open(struct fb_info *info, int user)
|
static int matroxfb_open(struct fb_info *info, int user)
|
||||||
{
|
{
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG_LOOP(__func__)
|
DBG_LOOP(__func__)
|
||||||
|
|
||||||
|
@ -412,7 +411,7 @@ static int matroxfb_open(struct fb_info *info, int user)
|
||||||
|
|
||||||
static int matroxfb_release(struct fb_info *info, int user)
|
static int matroxfb_release(struct fb_info *info, int user)
|
||||||
{
|
{
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG_LOOP(__func__)
|
DBG_LOOP(__func__)
|
||||||
|
|
||||||
|
@ -429,7 +428,7 @@ static int matroxfb_release(struct fb_info *info, int user)
|
||||||
|
|
||||||
static int matroxfb_pan_display(struct fb_var_screeninfo *var,
|
static int matroxfb_pan_display(struct fb_var_screeninfo *var,
|
||||||
struct fb_info* info) {
|
struct fb_info* info) {
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG(__func__)
|
DBG(__func__)
|
||||||
|
|
||||||
|
@ -749,7 +748,7 @@ static int matroxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *inf
|
||||||
int visual;
|
int visual;
|
||||||
int cmap_len;
|
int cmap_len;
|
||||||
unsigned int ydstorg;
|
unsigned int ydstorg;
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
if (minfo->dead) {
|
if (minfo->dead) {
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
@ -766,7 +765,7 @@ static int matroxfb_set_par(struct fb_info *info)
|
||||||
int cmap_len;
|
int cmap_len;
|
||||||
unsigned int ydstorg;
|
unsigned int ydstorg;
|
||||||
struct fb_var_screeninfo *var;
|
struct fb_var_screeninfo *var;
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG(__func__)
|
DBG(__func__)
|
||||||
|
|
||||||
|
@ -890,7 +889,7 @@ static int matroxfb_ioctl(struct fb_info *info,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG(__func__)
|
DBG(__func__)
|
||||||
|
|
||||||
|
@ -1189,7 +1188,7 @@ static int matroxfb_blank(int blank, struct fb_info *info)
|
||||||
int seq;
|
int seq;
|
||||||
int crtc;
|
int crtc;
|
||||||
CRITFLAGS
|
CRITFLAGS
|
||||||
MINFO_FROM_INFO(info);
|
struct matrox_fb_info *minfo = info2minfo(info);
|
||||||
|
|
||||||
DBG(__func__)
|
DBG(__func__)
|
||||||
|
|
||||||
|
|
|
@ -524,10 +524,6 @@ struct matrox_fb_info {
|
||||||
|
|
||||||
#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
|
#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
|
||||||
|
|
||||||
#define MINFO_FROM(x) struct matrox_fb_info* minfo = x
|
|
||||||
|
|
||||||
#define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x))
|
|
||||||
|
|
||||||
struct matrox_switch {
|
struct matrox_switch {
|
||||||
int (*preinit)(struct matrox_fb_info *minfo);
|
int (*preinit)(struct matrox_fb_info *minfo);
|
||||||
void (*reset)(struct matrox_fb_info *minfo);
|
void (*reset)(struct matrox_fb_info *minfo);
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void matroxfb_dh_restore(struct matroxfb_dh_fb_info* m2info,
|
||||||
unsigned int pos) {
|
unsigned int pos) {
|
||||||
u_int32_t tmp;
|
u_int32_t tmp;
|
||||||
u_int32_t datactl;
|
u_int32_t datactl;
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 15:
|
case 15:
|
||||||
|
@ -157,7 +157,7 @@ static void matroxfb_dh_restore(struct matroxfb_dh_fb_info* m2info,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matroxfb_dh_disable(struct matroxfb_dh_fb_info* m2info) {
|
static void matroxfb_dh_disable(struct matroxfb_dh_fb_info* m2info) {
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
mga_outl(0x3C10, 0x00000004); /* disable CRTC2, CRTC1->DAC1, PLL as clock source */
|
mga_outl(0x3C10, 0x00000004); /* disable CRTC2, CRTC1->DAC1, PLL as clock source */
|
||||||
minfo->hw.crtc2.ctl = 0x00000004;
|
minfo->hw.crtc2.ctl = 0x00000004;
|
||||||
|
@ -168,7 +168,7 @@ static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info,
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
unsigned int linelen;
|
unsigned int linelen;
|
||||||
unsigned int pixelsize;
|
unsigned int pixelsize;
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
m2info->fbcon.var.xoffset = var->xoffset;
|
m2info->fbcon.var.xoffset = var->xoffset;
|
||||||
m2info->fbcon.var.yoffset = var->yoffset;
|
m2info->fbcon.var.yoffset = var->yoffset;
|
||||||
|
@ -260,7 +260,7 @@ static int matroxfb_dh_decode_var(struct matroxfb_dh_fb_info* m2info,
|
||||||
|
|
||||||
static int matroxfb_dh_open(struct fb_info* info, int user) {
|
static int matroxfb_dh_open(struct fb_info* info, int user) {
|
||||||
#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
|
#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
if (minfo) {
|
if (minfo) {
|
||||||
int err;
|
int err;
|
||||||
|
@ -280,7 +280,7 @@ static int matroxfb_dh_open(struct fb_info* info, int user) {
|
||||||
static int matroxfb_dh_release(struct fb_info* info, int user) {
|
static int matroxfb_dh_release(struct fb_info* info, int user) {
|
||||||
#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
|
#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
|
||||||
int err = 0;
|
int err = 0;
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
if (minfo) {
|
if (minfo) {
|
||||||
err = minfo->fbops.fb_release(&minfo->fbcon, user);
|
err = minfo->fbops.fb_release(&minfo->fbcon, user);
|
||||||
|
@ -326,7 +326,7 @@ static int matroxfb_dh_set_par(struct fb_info* info) {
|
||||||
int mode;
|
int mode;
|
||||||
int err;
|
int err;
|
||||||
struct fb_var_screeninfo* var = &info->var;
|
struct fb_var_screeninfo* var = &info->var;
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
if ((err = matroxfb_dh_decode_var(m2info, var, &visual, &cmap_len, &mode)) != 0)
|
if ((err = matroxfb_dh_decode_var(m2info, var, &visual, &cmap_len, &mode)) != 0)
|
||||||
return err;
|
return err;
|
||||||
|
@ -399,7 +399,7 @@ static int matroxfb_dh_pan_display(struct fb_var_screeninfo* var, struct fb_info
|
||||||
}
|
}
|
||||||
|
|
||||||
static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, struct fb_vblank* vblank) {
|
static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, struct fb_vblank* vblank) {
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
matroxfb_enable_irq(minfo, 0);
|
matroxfb_enable_irq(minfo, 0);
|
||||||
memset(vblank, 0, sizeof(*vblank));
|
memset(vblank, 0, sizeof(*vblank));
|
||||||
|
@ -423,7 +423,7 @@ static int matroxfb_dh_ioctl(struct fb_info *info,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
|
#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
|
||||||
MINFO_FROM(m2info->primary_dev);
|
struct matrox_fb_info *minfo = m2info->primary_dev;
|
||||||
|
|
||||||
DBG(__func__)
|
DBG(__func__)
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ static int g450_query_ctrl(void* md, struct v4l2_queryctrl *p) {
|
||||||
|
|
||||||
static int g450_set_ctrl(void* md, struct v4l2_control *p) {
|
static int g450_set_ctrl(void* md, struct v4l2_control *p) {
|
||||||
int i;
|
int i;
|
||||||
MINFO_FROM(md);
|
struct matrox_fb_info *minfo = md;
|
||||||
|
|
||||||
i = get_ctrl_id(p->id);
|
i = get_ctrl_id(p->id);
|
||||||
if (i < 0) return -EINVAL;
|
if (i < 0) return -EINVAL;
|
||||||
|
@ -215,7 +215,7 @@ static int g450_set_ctrl(void* md, struct v4l2_control *p) {
|
||||||
|
|
||||||
static int g450_get_ctrl(void* md, struct v4l2_control *p) {
|
static int g450_get_ctrl(void* md, struct v4l2_control *p) {
|
||||||
int i;
|
int i;
|
||||||
MINFO_FROM(md);
|
struct matrox_fb_info *minfo = md;
|
||||||
|
|
||||||
i = get_ctrl_id(p->id);
|
i = get_ctrl_id(p->id);
|
||||||
if (i < 0) return -EINVAL;
|
if (i < 0) return -EINVAL;
|
||||||
|
@ -518,7 +518,7 @@ static void cve2_init_TV(struct matrox_fb_info *minfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
|
static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
|
||||||
MINFO_FROM(md);
|
struct matrox_fb_info *minfo = md;
|
||||||
|
|
||||||
dprintk(KERN_DEBUG "Computing, mode=%u\n", minfo->outputs[1].mode);
|
dprintk(KERN_DEBUG "Computing, mode=%u\n", minfo->outputs[1].mode);
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int matroxfb_g450_program(void* md) {
|
static int matroxfb_g450_program(void* md) {
|
||||||
MINFO_FROM(md);
|
struct matrox_fb_info *minfo = md;
|
||||||
|
|
||||||
if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
|
if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
|
||||||
cve2_init_TV(minfo, &minfo->hw.maven);
|
cve2_init_TV(minfo, &minfo->hw.maven);
|
||||||
|
@ -575,7 +575,7 @@ static int matroxfb_g450_verify_mode(void* md, u_int32_t arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int g450_dvi_compute(void* md, struct my_timming* mt) {
|
static int g450_dvi_compute(void* md, struct my_timming* mt) {
|
||||||
MINFO_FROM(md);
|
struct matrox_fb_info *minfo = md;
|
||||||
|
|
||||||
if (mt->mnp < 0) {
|
if (mt->mnp < 0) {
|
||||||
mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL);
|
mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL);
|
||||||
|
|
|
@ -458,7 +458,7 @@ static void maven_init_TVdata(const struct maven_data* md, struct mavenregs* dat
|
||||||
0x00, /* 3E written multiple times */
|
0x00, /* 3E written multiple times */
|
||||||
0x00, /* never written */
|
0x00, /* never written */
|
||||||
}, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 };
|
}, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 };
|
||||||
MINFO_FROM(md->primary_head);
|
struct matrox_fb_info *minfo = md->primary_head;
|
||||||
|
|
||||||
if (minfo->outputs[1].mode == MATROXFB_OUTPUT_MODE_PAL)
|
if (minfo->outputs[1].mode == MATROXFB_OUTPUT_MODE_PAL)
|
||||||
*data = palregs;
|
*data = palregs;
|
||||||
|
@ -741,7 +741,7 @@ static inline int maven_compute_timming(struct maven_data* md,
|
||||||
struct mavenregs* m) {
|
struct mavenregs* m) {
|
||||||
unsigned int tmpi;
|
unsigned int tmpi;
|
||||||
unsigned int a, bv, c;
|
unsigned int a, bv, c;
|
||||||
MINFO_FROM(md->primary_head);
|
struct matrox_fb_info *minfo = md->primary_head;
|
||||||
|
|
||||||
m->mode = minfo->outputs[1].mode;
|
m->mode = minfo->outputs[1].mode;
|
||||||
if (m->mode != MATROXFB_OUTPUT_MODE_MONITOR) {
|
if (m->mode != MATROXFB_OUTPUT_MODE_MONITOR) {
|
||||||
|
@ -1184,7 +1184,9 @@ static struct matrox_altout maven_altout = {
|
||||||
|
|
||||||
static int maven_init_client(struct i2c_client* clnt) {
|
static int maven_init_client(struct i2c_client* clnt) {
|
||||||
struct maven_data* md = i2c_get_clientdata(clnt);
|
struct maven_data* md = i2c_get_clientdata(clnt);
|
||||||
MINFO_FROM(container_of(clnt->adapter, struct i2c_bit_adapter, adapter)->minfo);
|
struct matrox_fb_info *minfo = container_of(clnt->adapter,
|
||||||
|
struct i2c_bit_adapter,
|
||||||
|
adapter)->minfo;
|
||||||
|
|
||||||
md->primary_head = minfo;
|
md->primary_head = minfo;
|
||||||
md->client = clnt;
|
md->client = clnt;
|
||||||
|
@ -1218,7 +1220,7 @@ static int maven_shutdown_client(struct i2c_client* clnt) {
|
||||||
struct maven_data* md = i2c_get_clientdata(clnt);
|
struct maven_data* md = i2c_get_clientdata(clnt);
|
||||||
|
|
||||||
if (md->primary_head) {
|
if (md->primary_head) {
|
||||||
MINFO_FROM(md->primary_head);
|
struct matrox_fb_info *minfo = md->primary_head;
|
||||||
|
|
||||||
down_write(&minfo->altout.lock);
|
down_write(&minfo->altout.lock);
|
||||||
minfo->outputs[1].src = MATROXFB_SRC_NONE;
|
minfo->outputs[1].src = MATROXFB_SRC_NONE;
|
||||||
|
|
Loading…
Reference in a new issue