aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-09-22 19:47:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:57 -0400
commitee5a27497957e55a520788f88536401e7b12bf41 (patch)
tree6625415aa5b2b3ceb2beff30798d5c5141dd463c /drivers
parent316b4d644caceb2cf7432d8a27e45b88f57ef2a0 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/matrox/matroxfb_accel.c10
-rw-r--r--drivers/video/matrox/matroxfb_base.c17
-rw-r--r--drivers/video/matrox/matroxfb_base.h4
-rw-r--r--drivers/video/matrox/matroxfb_crtc2.c16
-rw-r--r--drivers/video/matrox/matroxfb_g450.c10
-rw-r--r--drivers/video/matrox/matroxfb_maven.c10
6 files changed, 32 insertions, 35 deletions
diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c
index 3577ec144f86..8335a6fe303e 100644
--- a/drivers/video/matrox/matroxfb_accel.c
+++ b/drivers/video/matrox/matroxfb_accel.c
@@ -275,7 +275,7 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres,
275} 275}
276 276
277static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area) { 277static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
278 MINFO_FROM_INFO(info); 278 struct matrox_fb_info *minfo = info2minfo(info);
279 279
280 if ((area->sx | area->dx | area->width) & 1) 280 if ((area->sx | area->dx | area->width) & 1)
281 cfb_copyarea(info, area); 281 cfb_copyarea(info, area);
@@ -284,7 +284,7 @@ static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyare
284} 284}
285 285
286static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) { 286static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
287 MINFO_FROM_INFO(info); 287 struct matrox_fb_info *minfo = info2minfo(info);
288 288
289 matrox_accel_bmove(minfo, minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width); 289 matrox_accel_bmove(minfo, minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width);
290} 290}
@@ -309,7 +309,7 @@ static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color,
309} 309}
310 310
311static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect) { 311static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
312 MINFO_FROM_INFO(info); 312 struct matrox_fb_info *minfo = info2minfo(info);
313 313
314 switch (rect->rop) { 314 switch (rect->rop) {
315 case ROP_COPY: 315 case ROP_COPY:
@@ -376,7 +376,7 @@ static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx,
376} 376}
377 377
378static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect) { 378static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
379 MINFO_FROM_INFO(info); 379 struct matrox_fb_info *minfo = info2minfo(info);
380 380
381 switch (rect->rop) { 381 switch (rect->rop) {
382 case ROP_COPY: 382 case ROP_COPY:
@@ -478,7 +478,7 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx,
478 478
479 479
480static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) { 480static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) {
481 MINFO_FROM_INFO(info); 481 struct matrox_fb_info *minfo = info2minfo(info);
482 482
483 DBG_HEAVY(__func__); 483 DBG_HEAVY(__func__);
484 484
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index 73ad59822ea1..c6b122cfb300 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -204,8 +204,7 @@ static irqreturn_t matrox_irq(int irq, void *dev_id)
204{ 204{
205 u_int32_t status; 205 u_int32_t status;
206 int handled = 0; 206 int handled = 0;
207 207 struct matrox_fb_info *minfo = dev_id;
208 MINFO_FROM(dev_id);
209 208
210 status = mga_inl(M_STATUS); 209 status = mga_inl(M_STATUS);
211 210
@@ -396,7 +395,7 @@ static void matroxfb_remove(struct matrox_fb_info *minfo, int dummy)
396 395
397static int matroxfb_open(struct fb_info *info, int user) 396static int matroxfb_open(struct fb_info *info, int user)
398{ 397{
399 MINFO_FROM_INFO(info); 398 struct matrox_fb_info *minfo = info2minfo(info);
400 399
401 DBG_LOOP(__func__) 400 DBG_LOOP(__func__)
402 401
@@ -412,7 +411,7 @@ static int matroxfb_open(struct fb_info *info, int user)
412 411
413static int matroxfb_release(struct fb_info *info, int user) 412static int matroxfb_release(struct fb_info *info, int user)
414{ 413{
415 MINFO_FROM_INFO(info); 414 struct matrox_fb_info *minfo = info2minfo(info);
416 415
417 DBG_LOOP(__func__) 416 DBG_LOOP(__func__)
418 417
@@ -429,7 +428,7 @@ static int matroxfb_release(struct fb_info *info, int user)
429 428
430static int matroxfb_pan_display(struct fb_var_screeninfo *var, 429static int matroxfb_pan_display(struct fb_var_screeninfo *var,
431 struct fb_info* info) { 430 struct fb_info* info) {
432 MINFO_FROM_INFO(info); 431 struct matrox_fb_info *minfo = info2minfo(info);
433 432
434 DBG(__func__) 433 DBG(__func__)
435 434
@@ -749,7 +748,7 @@ static int matroxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *inf
749 int visual; 748 int visual;
750 int cmap_len; 749 int cmap_len;
751 unsigned int ydstorg; 750 unsigned int ydstorg;
752 MINFO_FROM_INFO(info); 751 struct matrox_fb_info *minfo = info2minfo(info);
753 752
754 if (minfo->dead) { 753 if (minfo->dead) {
755 return -ENXIO; 754 return -ENXIO;
@@ -766,7 +765,7 @@ static int matroxfb_set_par(struct fb_info *info)
766 int cmap_len; 765 int cmap_len;
767 unsigned int ydstorg; 766 unsigned int ydstorg;
768 struct fb_var_screeninfo *var; 767 struct fb_var_screeninfo *var;
769 MINFO_FROM_INFO(info); 768 struct matrox_fb_info *minfo = info2minfo(info);
770 769
771 DBG(__func__) 770 DBG(__func__)
772 771
@@ -890,7 +889,7 @@ static int matroxfb_ioctl(struct fb_info *info,
890 unsigned int cmd, unsigned long arg) 889 unsigned int cmd, unsigned long arg)
891{ 890{
892 void __user *argp = (void __user *)arg; 891 void __user *argp = (void __user *)arg;
893 MINFO_FROM_INFO(info); 892 struct matrox_fb_info *minfo = info2minfo(info);
894 893
895 DBG(__func__) 894 DBG(__func__)
896 895
@@ -1189,7 +1188,7 @@ static int matroxfb_blank(int blank, struct fb_info *info)
1189 int seq; 1188 int seq;
1190 int crtc; 1189 int crtc;
1191 CRITFLAGS 1190 CRITFLAGS
1192 MINFO_FROM_INFO(info); 1191 struct matrox_fb_info *minfo = info2minfo(info);
1193 1192
1194 DBG(__func__) 1193 DBG(__func__)
1195 1194
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index cd90cd2058d5..06158ab68cc4 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -524,10 +524,6 @@ struct matrox_fb_info {
524 524
525#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon) 525#define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
526 526
527#define MINFO_FROM(x) struct matrox_fb_info* minfo = x
528
529#define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x))
530
531struct matrox_switch { 527struct matrox_switch {
532 int (*preinit)(struct matrox_fb_info *minfo); 528 int (*preinit)(struct matrox_fb_info *minfo);
533 void (*reset)(struct matrox_fb_info *minfo); 529 void (*reset)(struct matrox_fb_info *minfo);
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c
index f41d4b4f8e75..78414baa5a54 100644
--- a/drivers/video/matrox/matroxfb_crtc2.c
+++ b/drivers/video/matrox/matroxfb_crtc2.c
@@ -65,7 +65,7 @@ static void matroxfb_dh_restore(struct matroxfb_dh_fb_info* m2info,
65 unsigned int pos) { 65 unsigned int pos) {
66 u_int32_t tmp; 66 u_int32_t tmp;
67 u_int32_t datactl; 67 u_int32_t datactl;
68 MINFO_FROM(m2info->primary_dev); 68 struct matrox_fb_info *minfo = m2info->primary_dev;
69 69
70 switch (mode) { 70 switch (mode) {
71 case 15: 71 case 15:
@@ -157,7 +157,7 @@ static void matroxfb_dh_restore(struct matroxfb_dh_fb_info* m2info,
157} 157}
158 158
159static void matroxfb_dh_disable(struct matroxfb_dh_fb_info* m2info) { 159static void matroxfb_dh_disable(struct matroxfb_dh_fb_info* m2info) {
160 MINFO_FROM(m2info->primary_dev); 160 struct matrox_fb_info *minfo = m2info->primary_dev;
161 161
162 mga_outl(0x3C10, 0x00000004); /* disable CRTC2, CRTC1->DAC1, PLL as clock source */ 162 mga_outl(0x3C10, 0x00000004); /* disable CRTC2, CRTC1->DAC1, PLL as clock source */
163 minfo->hw.crtc2.ctl = 0x00000004; 163 minfo->hw.crtc2.ctl = 0x00000004;
@@ -168,7 +168,7 @@ static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info,
168 unsigned int pos; 168 unsigned int pos;
169 unsigned int linelen; 169 unsigned int linelen;
170 unsigned int pixelsize; 170 unsigned int pixelsize;
171 MINFO_FROM(m2info->primary_dev); 171 struct matrox_fb_info *minfo = m2info->primary_dev;
172 172
173 m2info->fbcon.var.xoffset = var->xoffset; 173 m2info->fbcon.var.xoffset = var->xoffset;
174 m2info->fbcon.var.yoffset = var->yoffset; 174 m2info->fbcon.var.yoffset = var->yoffset;
@@ -260,7 +260,7 @@ static int matroxfb_dh_decode_var(struct matroxfb_dh_fb_info* m2info,
260 260
261static int matroxfb_dh_open(struct fb_info* info, int user) { 261static int matroxfb_dh_open(struct fb_info* info, int user) {
262#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) 262#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
263 MINFO_FROM(m2info->primary_dev); 263 struct matrox_fb_info *minfo = m2info->primary_dev;
264 264
265 if (minfo) { 265 if (minfo) {
266 int err; 266 int err;
@@ -280,7 +280,7 @@ static int matroxfb_dh_open(struct fb_info* info, int user) {
280static int matroxfb_dh_release(struct fb_info* info, int user) { 280static int matroxfb_dh_release(struct fb_info* info, int user) {
281#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) 281#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
282 int err = 0; 282 int err = 0;
283 MINFO_FROM(m2info->primary_dev); 283 struct matrox_fb_info *minfo = m2info->primary_dev;
284 284
285 if (minfo) { 285 if (minfo) {
286 err = minfo->fbops.fb_release(&minfo->fbcon, user); 286 err = minfo->fbops.fb_release(&minfo->fbcon, user);
@@ -326,7 +326,7 @@ static int matroxfb_dh_set_par(struct fb_info* info) {
326 int mode; 326 int mode;
327 int err; 327 int err;
328 struct fb_var_screeninfo* var = &info->var; 328 struct fb_var_screeninfo* var = &info->var;
329 MINFO_FROM(m2info->primary_dev); 329 struct matrox_fb_info *minfo = m2info->primary_dev;
330 330
331 if ((err = matroxfb_dh_decode_var(m2info, var, &visual, &cmap_len, &mode)) != 0) 331 if ((err = matroxfb_dh_decode_var(m2info, var, &visual, &cmap_len, &mode)) != 0)
332 return err; 332 return err;
@@ -399,7 +399,7 @@ static int matroxfb_dh_pan_display(struct fb_var_screeninfo* var, struct fb_info
399} 399}
400 400
401static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, struct fb_vblank* vblank) { 401static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, struct fb_vblank* vblank) {
402 MINFO_FROM(m2info->primary_dev); 402 struct matrox_fb_info *minfo = m2info->primary_dev;
403 403
404 matroxfb_enable_irq(minfo, 0); 404 matroxfb_enable_irq(minfo, 0);
405 memset(vblank, 0, sizeof(*vblank)); 405 memset(vblank, 0, sizeof(*vblank));
@@ -423,7 +423,7 @@ static int matroxfb_dh_ioctl(struct fb_info *info,
423 unsigned long arg) 423 unsigned long arg)
424{ 424{
425#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) 425#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))
426 MINFO_FROM(m2info->primary_dev); 426 struct matrox_fb_info *minfo = m2info->primary_dev;
427 427
428 DBG(__func__) 428 DBG(__func__)
429 429
diff --git a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/matrox/matroxfb_g450.c
index f7f1343cd345..cff0546ea6fd 100644
--- a/drivers/video/matrox/matroxfb_g450.c
+++ b/drivers/video/matrox/matroxfb_g450.c
@@ -161,7 +161,7 @@ static int g450_query_ctrl(void* md, struct v4l2_queryctrl *p) {
161 161
162static int g450_set_ctrl(void* md, struct v4l2_control *p) { 162static int g450_set_ctrl(void* md, struct v4l2_control *p) {
163 int i; 163 int i;
164 MINFO_FROM(md); 164 struct matrox_fb_info *minfo = md;
165 165
166 i = get_ctrl_id(p->id); 166 i = get_ctrl_id(p->id);
167 if (i < 0) return -EINVAL; 167 if (i < 0) return -EINVAL;
@@ -215,7 +215,7 @@ static int g450_set_ctrl(void* md, struct v4l2_control *p) {
215 215
216static int g450_get_ctrl(void* md, struct v4l2_control *p) { 216static int g450_get_ctrl(void* md, struct v4l2_control *p) {
217 int i; 217 int i;
218 MINFO_FROM(md); 218 struct matrox_fb_info *minfo = md;
219 219
220 i = get_ctrl_id(p->id); 220 i = get_ctrl_id(p->id);
221 if (i < 0) return -EINVAL; 221 if (i < 0) return -EINVAL;
@@ -518,7 +518,7 @@ static void cve2_init_TV(struct matrox_fb_info *minfo,
518} 518}
519 519
520static int matroxfb_g450_compute(void* md, struct my_timming* mt) { 520static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
521 MINFO_FROM(md); 521 struct matrox_fb_info *minfo = md;
522 522
523 dprintk(KERN_DEBUG "Computing, mode=%u\n", minfo->outputs[1].mode); 523 dprintk(KERN_DEBUG "Computing, mode=%u\n", minfo->outputs[1].mode);
524 524
@@ -556,7 +556,7 @@ static int matroxfb_g450_compute(void* md, struct my_timming* mt) {
556} 556}
557 557
558static int matroxfb_g450_program(void* md) { 558static int matroxfb_g450_program(void* md) {
559 MINFO_FROM(md); 559 struct matrox_fb_info *minfo = md;
560 560
561 if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) { 561 if (minfo->outputs[1].mode != MATROXFB_OUTPUT_MODE_MONITOR) {
562 cve2_init_TV(minfo, &minfo->hw.maven); 562 cve2_init_TV(minfo, &minfo->hw.maven);
@@ -575,7 +575,7 @@ static int matroxfb_g450_verify_mode(void* md, u_int32_t arg) {
575} 575}
576 576
577static int g450_dvi_compute(void* md, struct my_timming* mt) { 577static int g450_dvi_compute(void* md, struct my_timming* mt) {
578 MINFO_FROM(md); 578 struct matrox_fb_info *minfo = md;
579 579
580 if (mt->mnp < 0) { 580 if (mt->mnp < 0) {
581 mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL); 581 mt->mnp = matroxfb_g450_setclk(minfo, mt->pixclock, (mt->crtc == MATROXFB_SRC_CRTC1) ? M_PIXEL_PLL_C : M_VIDEO_PLL);
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c
index 4fbb386b2eff..91af9159111f 100644
--- a/drivers/video/matrox/matroxfb_maven.c
+++ b/drivers/video/matrox/matroxfb_maven.c
@@ -458,7 +458,7 @@ static void maven_init_TVdata(const struct maven_data* md, struct mavenregs* dat
458 0x00, /* 3E written multiple times */ 458 0x00, /* 3E written multiple times */
459 0x00, /* never written */ 459 0x00, /* never written */
460 }, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 }; 460 }, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 };
461 MINFO_FROM(md->primary_head); 461 struct matrox_fb_info *minfo = md->primary_head;
462 462
463 if (minfo->outputs[1].mode == MATROXFB_OUTPUT_MODE_PAL) 463 if (minfo->outputs[1].mode == MATROXFB_OUTPUT_MODE_PAL)
464 *data = palregs; 464 *data = palregs;
@@ -741,7 +741,7 @@ static inline int maven_compute_timming(struct maven_data* md,
741 struct mavenregs* m) { 741 struct mavenregs* m) {
742 unsigned int tmpi; 742 unsigned int tmpi;
743 unsigned int a, bv, c; 743 unsigned int a, bv, c;
744 MINFO_FROM(md->primary_head); 744 struct matrox_fb_info *minfo = md->primary_head;
745 745
746 m->mode = minfo->outputs[1].mode; 746 m->mode = minfo->outputs[1].mode;
747 if (m->mode != MATROXFB_OUTPUT_MODE_MONITOR) { 747 if (m->mode != MATROXFB_OUTPUT_MODE_MONITOR) {
@@ -1184,7 +1184,9 @@ static struct matrox_altout maven_altout = {
1184 1184
1185static int maven_init_client(struct i2c_client* clnt) { 1185static int maven_init_client(struct i2c_client* clnt) {
1186 struct maven_data* md = i2c_get_clientdata(clnt); 1186 struct maven_data* md = i2c_get_clientdata(clnt);
1187 MINFO_FROM(container_of(clnt->adapter, struct i2c_bit_adapter, adapter)->minfo); 1187 struct matrox_fb_info *minfo = container_of(clnt->adapter,
1188 struct i2c_bit_adapter,
1189 adapter)->minfo;
1188 1190
1189 md->primary_head = minfo; 1191 md->primary_head = minfo;
1190 md->client = clnt; 1192 md->client = clnt;
@@ -1218,7 +1220,7 @@ static int maven_shutdown_client(struct i2c_client* clnt) {
1218 struct maven_data* md = i2c_get_clientdata(clnt); 1220 struct maven_data* md = i2c_get_clientdata(clnt);
1219 1221
1220 if (md->primary_head) { 1222 if (md->primary_head) {
1221 MINFO_FROM(md->primary_head); 1223 struct matrox_fb_info *minfo = md->primary_head;
1222 1224
1223 down_write(&minfo->altout.lock); 1225 down_write(&minfo->altout.lock);
1224 minfo->outputs[1].src = MATROXFB_SRC_NONE; 1226 minfo->outputs[1].src = MATROXFB_SRC_NONE;