diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-09-22 19:47:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:56 -0400 |
commit | 0728bacbba3b0267fa8ca8be69aa43d81b57ab51 (patch) | |
tree | a0dd85cb348ad481e92a0d4f45eefdc88fac6e3d | |
parent | 0fcf6ada2b8eb42d132c0846384f1299889609e3 (diff) |
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>
-rw-r--r-- | Documentation/fb/matroxfb.txt | 4 | ||||
-rw-r--r-- | drivers/video/Kconfig | 20 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.c | 23 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.h | 20 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_misc.c | 4 |
5 files changed, 1 insertions, 70 deletions
diff --git a/Documentation/fb/matroxfb.txt b/Documentation/fb/matroxfb.txt index ad7a67707d62..e5ce8a1a978b 100644 --- a/Documentation/fb/matroxfb.txt +++ b/Documentation/fb/matroxfb.txt | |||
@@ -186,9 +186,7 @@ noinverse - show true colors on screen. It is default. | |||
186 | dev:X - bind driver to device X. Driver numbers device from 0 up to N, | 186 | dev:X - bind driver to device X. Driver numbers device from 0 up to N, |
187 | where device 0 is first `known' device found, 1 second and so on. | 187 | where device 0 is first `known' device found, 1 second and so on. |
188 | lspci lists devices in this order. | 188 | lspci lists devices in this order. |
189 | Default is `every' known device for driver with multihead support | 189 | Default is `every' known device. |
190 | and first working device (usually dev:0) for driver without | ||
191 | multihead support. | ||
192 | nohwcursor - disables hardware cursor (use software cursor instead). | 190 | nohwcursor - disables hardware cursor (use software cursor instead). |
193 | hwcursor - enables hardware cursor. It is default. If you are using | 191 | hwcursor - enables hardware cursor. It is default. If you are using |
194 | non-accelerated mode (`noaccel' or `fbset -accel false'), software | 192 | non-accelerated mode (`noaccel' or `fbset -accel false'), software |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7be506262284..9bbb2855ea91 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1275,26 +1275,6 @@ config FB_MATROX_MAVEN | |||
1275 | painting procedures (the secondary head does not use acceleration | 1275 | painting procedures (the secondary head does not use acceleration |
1276 | engine). | 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 | config FB_RADEON | 1278 | config FB_RADEON |
1299 | tristate "ATI Radeon display support" | 1279 | tristate "ATI Radeon display support" |
1300 | depends on FB && PCI | 1280 | depends on FB && PCI |
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 0c1049b308bf..6ede98da4618 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -379,9 +379,7 @@ static void matroxfb_remove(WPMINFO int dummy) { | |||
379 | mga_iounmap(ACCESS_FBINFO(video.vbase)); | 379 | mga_iounmap(ACCESS_FBINFO(video.vbase)); |
380 | release_mem_region(ACCESS_FBINFO(video.base), ACCESS_FBINFO(video.len_maximum)); | 380 | release_mem_region(ACCESS_FBINFO(video.base), ACCESS_FBINFO(video.len_maximum)); |
381 | release_mem_region(ACCESS_FBINFO(mmio.base), 16384); | 381 | release_mem_region(ACCESS_FBINFO(mmio.base), 16384); |
382 | #ifdef CONFIG_FB_MATROX_MULTIHEAD | ||
383 | kfree(minfo); | 382 | kfree(minfo); |
384 | #endif | ||
385 | } | 383 | } |
386 | 384 | ||
387 | /* | 385 | /* |
@@ -644,9 +642,7 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
644 | unsigned blue, unsigned transp, | 642 | unsigned blue, unsigned transp, |
645 | struct fb_info *fb_info) | 643 | struct fb_info *fb_info) |
646 | { | 644 | { |
647 | #ifdef CONFIG_FB_MATROX_MULTIHEAD | ||
648 | struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon); | 645 | struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon); |
649 | #endif | ||
650 | 646 | ||
651 | DBG(__func__) | 647 | DBG(__func__) |
652 | 648 | ||
@@ -2011,9 +2007,6 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm | |||
2011 | struct matrox_fb_info* minfo; | 2007 | struct matrox_fb_info* minfo; |
2012 | int err; | 2008 | int err; |
2013 | u_int32_t cmd; | 2009 | u_int32_t cmd; |
2014 | #ifndef CONFIG_FB_MATROX_MULTIHEAD | ||
2015 | static int registered = 0; | ||
2016 | #endif | ||
2017 | DBG(__func__) | 2010 | DBG(__func__) |
2018 | 2011 | ||
2019 | svid = pdev->subsystem_vendor; | 2012 | svid = pdev->subsystem_vendor; |
@@ -2037,15 +2030,9 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm | |||
2037 | return -1; | 2030 | return -1; |
2038 | } | 2031 | } |
2039 | 2032 | ||
2040 | #ifdef CONFIG_FB_MATROX_MULTIHEAD | ||
2041 | minfo = kmalloc(sizeof(*minfo), GFP_KERNEL); | 2033 | minfo = kmalloc(sizeof(*minfo), GFP_KERNEL); |
2042 | if (!minfo) | 2034 | if (!minfo) |
2043 | return -1; | 2035 | return -1; |
2044 | #else | ||
2045 | if (registered) /* singlehead driver... */ | ||
2046 | return -1; | ||
2047 | minfo = &matroxfb_global_mxinfo; | ||
2048 | #endif | ||
2049 | memset(MINFO, 0, sizeof(*MINFO)); | 2036 | memset(MINFO, 0, sizeof(*MINFO)); |
2050 | 2037 | ||
2051 | ACCESS_FBINFO(pcidev) = pdev; | 2038 | ACCESS_FBINFO(pcidev) = pdev; |
@@ -2090,15 +2077,10 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm | |||
2090 | 2077 | ||
2091 | err = initMatrox2(PMINFO b); | 2078 | err = initMatrox2(PMINFO b); |
2092 | if (!err) { | 2079 | if (!err) { |
2093 | #ifndef CONFIG_FB_MATROX_MULTIHEAD | ||
2094 | registered = 1; | ||
2095 | #endif | ||
2096 | matroxfb_register_device(MINFO); | 2080 | matroxfb_register_device(MINFO); |
2097 | return 0; | 2081 | return 0; |
2098 | } | 2082 | } |
2099 | #ifdef CONFIG_FB_MATROX_MULTIHEAD | ||
2100 | kfree(minfo); | 2083 | kfree(minfo); |
2101 | #endif | ||
2102 | return -1; | 2084 | return -1; |
2103 | } | 2085 | } |
2104 | 2086 | ||
@@ -2510,13 +2492,8 @@ module_param(inv24, int, 0); | |||
2510 | MODULE_PARM_DESC(inv24, "Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity)"); | 2492 | MODULE_PARM_DESC(inv24, "Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity)"); |
2511 | module_param(inverse, int, 0); | 2493 | module_param(inverse, int, 0); |
2512 | MODULE_PARM_DESC(inverse, "Inverse (0 or 1) (default=0)"); | 2494 | MODULE_PARM_DESC(inverse, "Inverse (0 or 1) (default=0)"); |
2513 | #ifdef CONFIG_FB_MATROX_MULTIHEAD | ||
2514 | module_param(dev, int, 0); | 2495 | module_param(dev, int, 0); |
2515 | MODULE_PARM_DESC(dev, "Multihead support, attach to device ID (0..N) (default=all working)"); | 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 | module_param(vesa, int, 0); | 2497 | module_param(vesa, int, 0); |
2521 | MODULE_PARM_DESC(vesa, "Startup videomode (0x000-0x1FF) (default=0x101)"); | 2498 | MODULE_PARM_DESC(vesa, "Startup videomode (0x000-0x1FF) (default=0x101)"); |
2522 | module_param(xres, int, 0); | 2499 | module_param(xres, int, 0); |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index 95883236c0cd..ba64f5e33467 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -524,7 +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 | #ifdef CONFIG_FB_MATROX_MULTIHEAD | ||
528 | #define ACCESS_FBINFO2(info, x) (info->x) | 527 | #define ACCESS_FBINFO2(info, x) (info->x) |
529 | #define ACCESS_FBINFO(x) ACCESS_FBINFO2(minfo,x) | 528 | #define ACCESS_FBINFO(x) ACCESS_FBINFO2(minfo,x) |
530 | 529 | ||
@@ -538,25 +537,6 @@ struct matrox_fb_info { | |||
538 | #define PMINFO PMINFO2 , | 537 | #define PMINFO PMINFO2 , |
539 | 538 | ||
540 | #define MINFO_FROM(x) struct matrox_fb_info* minfo = x | 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 | #define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x)) | 541 | #define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x)) |
562 | 542 | ||
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index 5b5f072fc1a8..d5b9e789cca6 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c | |||
@@ -784,10 +784,6 @@ EXPORT_SYMBOL(matroxfb_DAC_in); | |||
784 | EXPORT_SYMBOL(matroxfb_DAC_out); | 784 | EXPORT_SYMBOL(matroxfb_DAC_out); |
785 | EXPORT_SYMBOL(matroxfb_var2my); | 785 | EXPORT_SYMBOL(matroxfb_var2my); |
786 | EXPORT_SYMBOL(matroxfb_PLL_calcclock); | 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 | EXPORT_SYMBOL(matroxfb_vgaHWinit); /* DAC1064, Ti3026 */ | 787 | EXPORT_SYMBOL(matroxfb_vgaHWinit); /* DAC1064, Ti3026 */ |
792 | EXPORT_SYMBOL(matroxfb_vgaHWrestore); /* DAC1064, Ti3026 */ | 788 | EXPORT_SYMBOL(matroxfb_vgaHWrestore); /* DAC1064, Ti3026 */ |
793 | EXPORT_SYMBOL(matroxfb_read_pins); | 789 | EXPORT_SYMBOL(matroxfb_read_pins); |