Commit 0728bacbba3b0267fa8ca8be69aa43d81b57ab51

Authored by Jean Delvare
Committed by Linus Torvalds
1 parent 0fcf6ada2b

matroxfb: make CONFIG_FB_MATROX_MULTIHEAD=y mandatory

I would like to get rid of option CONFIG_FB_MATROX_MULTIHEAD and just
always enable it.  There are many reasons for doing this:

* CONFIG_FB_MATROX_MULTIHEAD=y is what all x86 distributions do, so it
  definitely works or we would know by now.

* Building the matroxfb driver with CONFIG_FB_MATROX_MULTIHEAD not set
  results in the following build warning:

drivers/video/matrox/matroxfb_crtc2.c: In function 'matroxfb_dh_open':
drivers/video/matrox/matroxfb_crtc2.c:265: warning: the address of 'matroxfb_global_mxinfo' will always evaluate as 'true'
drivers/video/matrox/matroxfb_crtc2.c: In function 'matroxfb_dh_release':
drivers/video/matrox/matroxfb_crtc2.c:285: warning: the address of 'matroxfb_global_mxinfo' will always evaluate as 'true'

This is nothing to be worried about, the driver will work fine, but build
warnings are still annoying.

* The trick to get multihead support without CONFIG_FB_MATROX_MULTIHEAD,
  which is described in the config help text, no longer works: you can't
  load the same kernel module more than once.

* I fail to see how CONFIG_FB_MATROX_MULTIHEAD=y would make the code
  significantly slower, contrary to what the help text says.  A few extra
  parameters on the stack here and there can't really slow things down in
  comaprison to the rest of the code, and register access.

* The driver built without CONFIG_FB_MATROX_MULTIHEAD is larger than the
  driver build with CONFIG_FB_MATROX_MULTIHEAD=y by 8%.

* One less configuration option makes things simpler.  We add options
  all the time, being able to remove one for once is nice.  It improves
  testing coverage.  And I don't think the Matrox adapters are still
  popular enough to warrant overdetailed configuration settings.

* We should be able to unobfuscate the driver code quite a bit after
  this change (patches follow.)

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>

Showing 5 changed files with 1 additions and 70 deletions Side-by-side Diff

Documentation/fb/matroxfb.txt
... ... @@ -186,9 +186,7 @@
186 186 dev:X - bind driver to device X. Driver numbers device from 0 up to N,
187 187 where device 0 is first `known' device found, 1 second and so on.
188 188 lspci lists devices in this order.
189   - Default is `every' known device for driver with multihead support
190   - and first working device (usually dev:0) for driver without
191   - multihead support.
  189 + Default is `every' known device.
192 190 nohwcursor - disables hardware cursor (use software cursor instead).
193 191 hwcursor - enables hardware cursor. It is default. If you are using
194 192 non-accelerated mode (`noaccel' or `fbset -accel false'), software
drivers/video/Kconfig
... ... @@ -1275,26 +1275,6 @@
1275 1275 painting procedures (the secondary head does not use acceleration
1276 1276 engine).
1277 1277  
1278   -config FB_MATROX_MULTIHEAD
1279   - bool "Multihead support"
1280   - depends on FB_MATROX
1281   - ---help---
1282   - Say Y here if you have more than one (supported) Matrox device in
1283   - your computer and you want to use all of them for different monitors
1284   - ("multihead"). If you have only one device, you should say N because
1285   - the driver compiled with Y is larger and a bit slower, especially on
1286   - ia32 (ix86).
1287   -
1288   - If you said M to "Matrox unified accelerated driver" and N here, you
1289   - will still be able to use several Matrox devices simultaneously:
1290   - insert several instances of the module matroxfb into the kernel
1291   - with insmod, supplying the parameter "dev=N" where N is 0, 1, etc.
1292   - for the different Matrox devices. This method is slightly faster but
1293   - uses 40 KB of kernel memory per Matrox card.
1294   -
1295   - There is no need for enabling 'Matrox multihead support' if you have
1296   - only one Matrox card in the box.
1297   -
1298 1278 config FB_RADEON
1299 1279 tristate "ATI Radeon display support"
1300 1280 depends on FB && PCI
drivers/video/matrox/matroxfb_base.c
... ... @@ -379,9 +379,7 @@
379 379 mga_iounmap(ACCESS_FBINFO(video.vbase));
380 380 release_mem_region(ACCESS_FBINFO(video.base), ACCESS_FBINFO(video.len_maximum));
381 381 release_mem_region(ACCESS_FBINFO(mmio.base), 16384);
382   -#ifdef CONFIG_FB_MATROX_MULTIHEAD
383 382 kfree(minfo);
384   -#endif
385 383 }
386 384  
387 385 /*
388 386  
... ... @@ -644,9 +642,7 @@
644 642 unsigned blue, unsigned transp,
645 643 struct fb_info *fb_info)
646 644 {
647   -#ifdef CONFIG_FB_MATROX_MULTIHEAD
648 645 struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon);
649   -#endif
650 646  
651 647 DBG(__func__)
652 648  
... ... @@ -2011,9 +2007,6 @@
2011 2007 struct matrox_fb_info* minfo;
2012 2008 int err;
2013 2009 u_int32_t cmd;
2014   -#ifndef CONFIG_FB_MATROX_MULTIHEAD
2015   - static int registered = 0;
2016   -#endif
2017 2010 DBG(__func__)
2018 2011  
2019 2012 svid = pdev->subsystem_vendor;
2020 2013  
... ... @@ -2037,15 +2030,9 @@
2037 2030 return -1;
2038 2031 }
2039 2032  
2040   -#ifdef CONFIG_FB_MATROX_MULTIHEAD
2041 2033 minfo = kmalloc(sizeof(*minfo), GFP_KERNEL);
2042 2034 if (!minfo)
2043 2035 return -1;
2044   -#else
2045   - if (registered) /* singlehead driver... */
2046   - return -1;
2047   - minfo = &matroxfb_global_mxinfo;
2048   -#endif
2049 2036 memset(MINFO, 0, sizeof(*MINFO));
2050 2037  
2051 2038 ACCESS_FBINFO(pcidev) = pdev;
2052 2039  
2053 2040  
... ... @@ -2090,15 +2077,10 @@
2090 2077  
2091 2078 err = initMatrox2(PMINFO b);
2092 2079 if (!err) {
2093   -#ifndef CONFIG_FB_MATROX_MULTIHEAD
2094   - registered = 1;
2095   -#endif
2096 2080 matroxfb_register_device(MINFO);
2097 2081 return 0;
2098 2082 }
2099   -#ifdef CONFIG_FB_MATROX_MULTIHEAD
2100 2083 kfree(minfo);
2101   -#endif
2102 2084 return -1;
2103 2085 }
2104 2086  
2105 2087  
... ... @@ -2510,13 +2492,8 @@
2510 2492 MODULE_PARM_DESC(inv24, "Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity)");
2511 2493 module_param(inverse, int, 0);
2512 2494 MODULE_PARM_DESC(inverse, "Inverse (0 or 1) (default=0)");
2513   -#ifdef CONFIG_FB_MATROX_MULTIHEAD
2514 2495 module_param(dev, int, 0);
2515 2496 MODULE_PARM_DESC(dev, "Multihead support, attach to device ID (0..N) (default=all working)");
2516   -#else
2517   -module_param(dev, int, 0);
2518   -MODULE_PARM_DESC(dev, "Multihead support, attach to device ID (0..N) (default=first working)");
2519   -#endif
2520 2497 module_param(vesa, int, 0);
2521 2498 MODULE_PARM_DESC(vesa, "Startup videomode (0x000-0x1FF) (default=0x101)");
2522 2499 module_param(xres, int, 0);
drivers/video/matrox/matroxfb_base.h
... ... @@ -524,7 +524,6 @@
524 524  
525 525 #define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
526 526  
527   -#ifdef CONFIG_FB_MATROX_MULTIHEAD
528 527 #define ACCESS_FBINFO2(info, x) (info->x)
529 528 #define ACCESS_FBINFO(x) ACCESS_FBINFO2(minfo,x)
530 529  
... ... @@ -538,25 +537,6 @@
538 537 #define PMINFO PMINFO2 ,
539 538  
540 539 #define MINFO_FROM(x) struct matrox_fb_info* minfo = x
541   -#else
542   -
543   -extern struct matrox_fb_info matroxfb_global_mxinfo;
544   -
545   -#define ACCESS_FBINFO(x) (matroxfb_global_mxinfo.x)
546   -#define ACCESS_FBINFO2(info, x) (matroxfb_global_mxinfo.x)
547   -
548   -#define MINFO (&matroxfb_global_mxinfo)
549   -
550   -#define WPMINFO2 void
551   -#define WPMINFO
552   -#define CPMINFO2 void
553   -#define CPMINFO
554   -#define PMINFO2
555   -#define PMINFO
556   -
557   -#define MINFO_FROM(x)
558   -
559   -#endif
560 540  
561 541 #define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x))
562 542  
drivers/video/matrox/matroxfb_misc.c
... ... @@ -784,10 +784,6 @@
784 784 EXPORT_SYMBOL(matroxfb_DAC_out);
785 785 EXPORT_SYMBOL(matroxfb_var2my);
786 786 EXPORT_SYMBOL(matroxfb_PLL_calcclock);
787   -#ifndef CONFIG_FB_MATROX_MULTIHEAD
788   -struct matrox_fb_info matroxfb_global_mxinfo;
789   -EXPORT_SYMBOL(matroxfb_global_mxinfo);
790   -#endif
791 787 EXPORT_SYMBOL(matroxfb_vgaHWinit); /* DAC1064, Ti3026 */
792 788 EXPORT_SYMBOL(matroxfb_vgaHWrestore); /* DAC1064, Ti3026 */
793 789 EXPORT_SYMBOL(matroxfb_read_pins);