matroxfb: Code cleanups
Subsystems (2)
cover matroxfb: Code cleanups
Hi Petr,
This is a 5-piece patchset cleaning up the matroxfb driver:
[PATCH 1/5] matroxfb: Make CONFIG_FB_MATROX_MULTIHEAD=y mandatory [PATCH 2/5] matroxfb: Get rid of unneeded macros ACCESS_FBINFO and MINFO [PATCH 3/5] matroxfb: Get rid of unneeded macros WPMINFO and friends [PATCH 4/5] matroxfb: Get rid of unneeded macro MINFO_FROM [PATCH 5/5] matroxfb: Get rid of CONFIG_FB_MATROX_32MB
Documentation/fb/matroxfb.txt | 4 drivers/video/Kconfig | 20 drivers/video/matrox/g450_pll.c | 209 ++++---- drivers/video/matrox/g450_pll.h | 8 drivers/video/matrox/i2c-matroxfb.c | 18 drivers/video/matrox/matroxfb_DAC1064.c | 616 +++++++++++++------------ drivers/video/matrox/matroxfb_DAC1064.h | 4 drivers/video/matrox/matroxfb_Ti3026.c | 260 +++++----- drivers/video/matrox/matroxfb_accel.c | 129 ++--- drivers/video/matrox/matroxfb_accel.h | 2 drivers/video/matrox/matroxfb_base.c | 770 +++++++++++++++----------------- drivers/video/matrox/matroxfb_base.h | 80 --- drivers/video/matrox/matroxfb_crtc2.c | 160 +++--- drivers/video/matrox/matroxfb_g450.c | 185 ++++--- drivers/video/matrox/matroxfb_g450.h | 8 drivers/video/matrox/matroxfb_maven.c | 48 + drivers/video/matrox/matroxfb_misc.c | 296 ++++++------ drivers/video/matrox/matroxfb_misc.h | 15 18 files changed, 1436 insertions(+), 1396 deletions(-)
The diffstat is impressive, but that's really only mecanical changes being applied driver-wide. There's no actual code change and there should be zero runtime difference before and after the patchset. I've tested it on my Millennium to make sure.
Signature · 7 lines
Jean Delvare ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
PATCH 1/5 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.)
--- Documentation/fb/matroxfb.txt | 4 +--- drivers/video/Kconfig | 20 -------------------- drivers/video/matrox/matroxfb_base.c | 23 ----------------------- drivers/video/matrox/matroxfb_base.h | 20 -------------------- drivers/video/matrox/matroxfb_misc.c | 4 ---- 5 files changed, 1 insertion(+), 70 deletions(-)
drivers/video/matrox/matroxfb_base.c +0 -23
@@ -379,9 +379,7 @@ static void matroxfb_remove(WPMINFO intmga_iounmap (ACCESS_FBINFO (video.vbase));release_mem_region (ACCESS_FBINFO (video.base),ACCESS_FBINFO (video.len_maximum));release_mem_region (ACCESS_FBINFO (mmio.base),16384 ); -#ifdef CONFIG_FB_MATROX_MULTIHEAD kfree (minfo); -#endif }/*
@@ -644,9 +642,7 @@ static int matroxfb_setcolreg(unsigned r unsigned blue, unsigned transp, struct fb_info *fb_info) { -#ifdef CONFIG_FB_MATROX_MULTIHEAD struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon); -#endif DBG (__func__)
@@ -2011,9 +2007,6 @@ static int matroxfb_probe(struct pci_devstruct matrox_fb_info * minfo;int err;u_int32_t cmd; -#ifndef CONFIG_FB_MATROX_MULTIHEAD -static int registered =0 ; -#endif DBG (__func__) svid = pdev->subsystem_vendor;
@@ -2037,15 +2030,9 @@ static int matroxfb_probe(struct pci_devreturn -1 ; } -#ifdef CONFIG_FB_MATROX_MULTIHEAD minfo =kmalloc (sizeof (*minfo),GFP_KERNEL );if (!minfo)return -1 ; -#else -if (registered)/* singlehead driver... */ -return -1 ; - minfo = &matroxfb_global_mxinfo; -#endif memset (MINFO ,0 ,sizeof (*MINFO ));ACCESS_FBINFO (pcidev) = pdev;
@@ -2090,15 +2077,10 @@ static int matroxfb_probe(struct pci_dev err = initMatrox2(PMINFO b);if (!err) { -#ifndef CONFIG_FB_MATROX_MULTIHEAD - registered =1 ; -#endif matroxfb_register_device (MINFO );return 0 ; } -#ifdef CONFIG_FB_MATROX_MULTIHEAD kfree (minfo); -#endif return -1 ; }
@@ -2510,13 +2492,8 @@ module_param(inv24, int, 0);MODULE_PARM_DESC (inv24,"Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity)" );module_param (inverse, int,0 );MODULE_PARM_DESC (inverse,"Inverse (0 or 1) (default=0)" ); -#ifdef CONFIG_FB_MATROX_MULTIHEAD module_param (dev, int,0 );MODULE_PARM_DESC (dev,"Multihead support, attach to device ID (0..N) (default=all working)" ); -#else -module_param (dev, int,0 ); -MODULE_PARM_DESC (dev,"Multihead support, attach to device ID (0..N) (default=first working)" ); -#endif module_param (vesa, int,0 );MODULE_PARM_DESC (vesa,"Startup videomode (0x000-0x1FF) (default=0x101)" );module_param (xres, int,0 );
drivers/video/matrox/matroxfb_base.h +0 -20
@@ -524,7 +524,6 @@ struct matrox_fb_info {#define info2minfo (info) container_of(info, struct matrox_fb_info, fbcon) -#ifdef CONFIG_FB_MATROX_MULTIHEAD #define ACCESS_FBINFO2 (info, x) (info->x)#define ACCESS_FBINFO (x) ACCESS_FBINFO2(minfo,x)
@@ -538,25 +537,6 @@ struct matrox_fb_info {#define PMINFO PMINFO2 ,#define MINFO_FROM (x) struct matrox_fb_info* minfo = x -#else - -extern struct matrox_fb_info matroxfb_global_mxinfo; - -#define ACCESS_FBINFO (x) (matroxfb_global_mxinfo.x) -#define ACCESS_FBINFO2 (info, x) (matroxfb_global_mxinfo.x) - -#define MINFO (&matroxfb_global_mxinfo) - -#define WPMINFO2 void -#define WPMINFO -#define CPMINFO2 void -#define CPMINFO -#define PMINFO2 -#define PMINFO - -#define MINFO_FROM (x) - -#endif #define MINFO_FROM_INFO (x) MINFO_FROM(info2minfo(x))
drivers/video/matrox/matroxfb_misc.c +0 -4
@@ -784,10 +784,6 @@ EXPORT_SYMBOL(matroxfb_DAC_in);EXPORT_SYMBOL (matroxfb_DAC_out);EXPORT_SYMBOL (matroxfb_var2my);EXPORT_SYMBOL (matroxfb_PLL_calcclock); -#ifndef CONFIG_FB_MATROX_MULTIHEAD -struct matrox_fb_info matroxfb_global_mxinfo; -EXPORT_SYMBOL (matroxfb_global_mxinfo); -#endif EXPORT_SYMBOL (matroxfb_vgaHWinit);/* DAC1064, Ti3026 */ EXPORT_SYMBOL (matroxfb_vgaHWrestore);/* DAC1064, Ti3026 */ EXPORT_SYMBOL (matroxfb_read_pins);
drivers/video/Kconfig +0 -20
@@ -1273,26 +1273,6 @@ config FB_MATROX_MAVEN painting procedures (the secondary head does not use acceleration engine). -config FB_MATROX_MULTIHEAD - bool "Multihead support" - depends on FB_MATROX - ---help--- - Say Y here if you have more than one (supported) Matrox device in - your computer and you want to use all of them for different monitors - ("multihead"). If you have only one device, you should say N because - the driver compiled with Y is larger and a bit slower, especially on - ia32 (ix86). - - If you said M to "Matrox unified accelerated driver" and N here, you - will still be able to use several Matrox devices simultaneously: - insert several instances of the module matroxfb into the kernel - with insmod, supplying the parameter "dev=N" where N is 0, 1, etc. - for the different Matrox devices. This method is slightly faster but - uses 40 KB of kernel memory per Matrox card. - - There is no need for enabling 'Matrox multihead support' if you have - only one Matrox card in the box. - config FB_RADEON tristate "ATI Radeon display support" depends on FB && PCI
Documentation/fb/matroxfb.txt +1 -3
@@ -186,9 +186,7 @@ noinverse - show true colors on screen. dev:X - bind driver to device X. Driver numbers device from 0 up to N, where device 0 is first `known' device found, 1 second and so on. lspci lists devices in this order. - Default is `every' known device for driver with multihead support - and first working device (usually dev:0) for driver without - multihead support. + Default is `every' known device. nohwcursor - disables hardware cursor (use software cursor instead). hwcursor - enables hardware cursor. It is default. If you are using non-accelerated mode (`noaccel' or `fbset -accel false'), software
Signature · 7 lines
Jean Delvare ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
PATCH 2/5 matroxfb: Get rid of unneeded macros ACCESS_FBINFO and MINFO
In reply to Jean DelvareWith multihead support always enabled, these macros are no longer needed and make the code harder to read.
--- drivers/video/matrox/g450_pll.c | 24 - drivers/video/matrox/i2c-matroxfb.c | 6 drivers/video/matrox/matroxfb_DAC1064.c | 378 +++++++++---------- drivers/video/matrox/matroxfb_Ti3026.c | 96 ++-- drivers/video/matrox/matroxfb_accel.c | 86 ++-- drivers/video/matrox/matroxfb_base.c | 604 +++++++++++++++---------------- drivers/video/matrox/matroxfb_base.h | 27 - drivers/video/matrox/matroxfb_crtc2.c | 130 +++--- drivers/video/matrox/matroxfb_g450.c | 80 ++-- drivers/video/matrox/matroxfb_maven.c | 38 - drivers/video/matrox/matroxfb_misc.c | 210 +++++----- drivers/video/matrox/matroxfb_misc.h | 2 12 files changed, 838 insertions(+), 843 deletions(-)
drivers/video/matrox/matroxfb_accel.c +43 -43
@@ -81,7 +81,7 @@#include "matroxfb_Ti3026.h" #include "matroxfb_misc.h" -#define curr_ydstorg (x) ACCESS_FBINFO2(x, curr.ydstorg.pixels) +#define curr_ydstorg (x) ((x)->curr.ydstorg.pixels)#define mga_ydstlen (y,l) mga_outl(M_YDSTLEN | M_EXEC, ((y) << 16) | (l))
@@ -115,59 +115,59 @@ void matrox_cfbX_init(WPMINFO2) {DBG (__func__) - mpitch =ACCESS_FBINFO (fbcon).var.xres_virtual; + mpitch = minfo->fbcon.var.xres_virtual; -ACCESS_FBINFO (fbops).fb_copyarea = cfb_copyarea; -ACCESS_FBINFO (fbops).fb_fillrect = cfb_fillrect; -ACCESS_FBINFO (fbops).fb_imageblit = cfb_imageblit; -ACCESS_FBINFO (fbops).fb_cursor =NULL ; + minfo->fbops.fb_copyarea = cfb_copyarea; + minfo->fbops.fb_fillrect = cfb_fillrect; + minfo->fbops.fb_imageblit = cfb_imageblit; + minfo->fbops.fb_cursor =NULL ; - accel = (ACCESS_FBINFO (fbcon).var.accel_flags &FB_ACCELF_TEXT ) ==FB_ACCELF_TEXT ; + accel = (minfo->fbcon.var.accel_flags &FB_ACCELF_TEXT ) ==FB_ACCELF_TEXT ; -switch (ACCESS_FBINFO (fbcon).var.bits_per_pixel) { +switch (minfo->fbcon.var.bits_per_pixel) {case 4 : maccess =0x00000000 ;/* accelerate as 8bpp video */ mpitch = (mpitch >>1 ) |0x8000 ;/* disable linearization */ mopmode =M_OPMODE_4BPP ; -matrox_cfb4_pal (ACCESS_FBINFO (cmap)); +matrox_cfb4_pal (minfo->cmap);if (accel && !(mpitch &1 )) { -ACCESS_FBINFO (fbops).fb_copyarea = matroxfb_cfb4_copyarea; -ACCESS_FBINFO (fbops).fb_fillrect = matroxfb_cfb4_fillrect; + minfo->fbops.fb_copyarea = matroxfb_cfb4_copyarea; + minfo->fbops.fb_fillrect = matroxfb_cfb4_fillrect; }break ;case 8 : maccess =0x00000000 ; mopmode =M_OPMODE_8BPP ; -matrox_cfb8_pal (ACCESS_FBINFO (cmap)); +matrox_cfb8_pal (minfo->cmap);if (accel) { -ACCESS_FBINFO (fbops).fb_copyarea = matroxfb_copyarea; -ACCESS_FBINFO (fbops).fb_fillrect = matroxfb_fillrect; -ACCESS_FBINFO (fbops).fb_imageblit = matroxfb_imageblit; + minfo->fbops.fb_copyarea = matroxfb_copyarea; + minfo->fbops.fb_fillrect = matroxfb_fillrect; + minfo->fbops.fb_imageblit = matroxfb_imageblit; }break ; -case 16 :if (ACCESS_FBINFO (fbcon).var.green.length ==5 ) +case 16 :if (minfo->fbcon.var.green.length ==5 ) maccess =0xC0000001 ;else maccess =0x40000001 ; mopmode =M_OPMODE_16BPP ;if (accel) { -ACCESS_FBINFO (fbops).fb_copyarea = matroxfb_copyarea; -ACCESS_FBINFO (fbops).fb_fillrect = matroxfb_fillrect; -ACCESS_FBINFO (fbops).fb_imageblit = matroxfb_imageblit; + minfo->fbops.fb_copyarea = matroxfb_copyarea; + minfo->fbops.fb_fillrect = matroxfb_fillrect; + minfo->fbops.fb_imageblit = matroxfb_imageblit; }break ;case 24 : maccess =0x00000003 ; mopmode =M_OPMODE_24BPP ;if (accel) { -ACCESS_FBINFO (fbops).fb_copyarea = matroxfb_copyarea; -ACCESS_FBINFO (fbops).fb_fillrect = matroxfb_fillrect; -ACCESS_FBINFO (fbops).fb_imageblit = matroxfb_imageblit; + minfo->fbops.fb_copyarea = matroxfb_copyarea; + minfo->fbops.fb_fillrect = matroxfb_fillrect; + minfo->fbops.fb_imageblit = matroxfb_imageblit; }break ;case 32 : maccess =0x00000002 ; mopmode =M_OPMODE_32BPP ;if (accel) { -ACCESS_FBINFO (fbops).fb_copyarea = matroxfb_copyarea; -ACCESS_FBINFO (fbops).fb_fillrect = matroxfb_fillrect; -ACCESS_FBINFO (fbops).fb_imageblit = matroxfb_imageblit; + minfo->fbops.fb_copyarea = matroxfb_copyarea; + minfo->fbops.fb_fillrect = matroxfb_fillrect; + minfo->fbops.fb_imageblit = matroxfb_imageblit; }break ;default : maccess =0x00000000 ;
@@ -176,10 +176,10 @@ void matrox_cfbX_init(WPMINFO2) { }mga_fifo (8 );mga_outl (M_PITCH , mpitch); -mga_outl (M_YDSTORG ,curr_ydstorg (MINFO )); -if (ACCESS_FBINFO (capable.plnwt)) +mga_outl (M_YDSTORG ,curr_ydstorg (minfo)); +if (minfo->capable.plnwt)mga_outl (M_PLNWT ,-1 ); -if (ACCESS_FBINFO (capable.srcorg)) { +if (minfo->capable.srcorg) {mga_outl (M_SRCORG ,0 );mga_outl (M_DSTORG ,0 ); }
@@ -188,9 +188,9 @@ void matrox_cfbX_init(WPMINFO2) {mga_outl (M_YTOP ,0 );mga_outl (M_YBOT ,0x01FFFFFF );mga_outl (M_MACCESS , maccess); -ACCESS_FBINFO (accel.m_dwg_rect) =M_DWG_TRAP |M_DWG_SOLID |M_DWG_ARZERO |M_DWG_SGNZERO |M_DWG_SHIFTZERO ; -if (isMilleniumII (MINFO ))ACCESS_FBINFO (accel.m_dwg_rect) |=M_DWG_TRANSC ; -ACCESS_FBINFO (accel.m_opmode) = mopmode; + minfo->accel.m_dwg_rect =M_DWG_TRAP |M_DWG_SOLID |M_DWG_ARZERO |M_DWG_SGNZERO |M_DWG_SHIFTZERO ; +if (isMilleniumII (minfo)) minfo->accel.m_dwg_rect |=M_DWG_TRANSC ; + minfo->accel.m_opmode = mopmode; }EXPORT_SYMBOL (matrox_cfbX_init);
@@ -209,7 +209,7 @@ static void matrox_accel_bmove(WPMINFO i M_DWG_BFCOL | M_DWG_REPLACE);mga_outl (M_AR5 , vxres); width--; - start = sy*vxres+sx+curr_ydstorg (MINFO ); + start = sy*vxres+sx+curr_ydstorg (minfo); end = start+width; }else {mga_fifo (3 );
@@ -217,7 +217,7 @@ static void matrox_accel_bmove(WPMINFO imga_outl (M_SGN ,5 );mga_outl (M_AR5 , -vxres); width--; - end = (sy+height-1 )*vxres+sx+curr_ydstorg (MINFO ); + end = (sy+height-1 )*vxres+sx+curr_ydstorg (minfo); start = end+width; dy += height-1 ; }
@@ -245,7 +245,7 @@ static void matrox_accel_bmove_lin(WPMIN M_DWG_BFCOL | M_DWG_REPLACE);mga_outl (M_AR5 , vxres); width--; - start = sy*vxres+sx+curr_ydstorg (MINFO ); + start = sy*vxres+sx+curr_ydstorg (minfo); end = start+width; }else {mga_fifo (3 );
@@ -253,7 +253,7 @@ static void matrox_accel_bmove_lin(WPMINmga_outl (M_SGN ,5 );mga_outl (M_AR5 , -vxres); width--; - end = (sy+height-1 )*vxres+sx+curr_ydstorg (MINFO ); + end = (sy+height-1 )*vxres+sx+curr_ydstorg (minfo); start = end+width; dy += height-1 ; }
@@ -274,13 +274,13 @@ static void matroxfb_cfb4_copyarea(strucif ((area->sx | area->dx | area->width) &1 )cfb_copyarea (info, area);else - matrox_accel_bmove_lin(PMINFO ACCESS_FBINFO(fbcon.var.xres_virtual) >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); + matrox_accel_bmove_lin(PMINFO minfo->fbcon.var.xres_virtual >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); }static void matroxfb_copyarea (struct fb_info * info,const struct fb_copyarea * area) {MINFO_FROM_INFO (info); - matrox_accel_bmove(PMINFO ACCESS_FBINFO(fbcon.var.xres_virtual), area->sy, area->sx, area->dy, area->dx, area->height, area->width); + matrox_accel_bmove(PMINFO minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width); } static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int height,
@@ -292,7 +292,7 @@ static void matroxfb_accel_clear(WPMINFOCRITBEGIN mga_fifo(5); -mga_outl (M_DWGCTL ,ACCESS_FBINFO (accel.m_dwg_rect) |M_DWG_REPLACE ); +mga_outl (M_DWGCTL , minfo->accel.m_dwg_rect |M_DWG_REPLACE );mga_outl (M_FCOL , color);mga_outl (M_FXBNDRY , ((sx + width) <<16 ) | sx);mga_ydstlen (sy, height);
@@ -333,16 +333,16 @@ static void matroxfb_cfb4_clear(WPMINFO sx >>=1 ;if (width) {mga_fifo (5 ); -mga_outl (M_DWGCTL ,ACCESS_FBINFO (accel.m_dwg_rect) |M_DWG_REPLACE2 ); +mga_outl (M_DWGCTL , minfo->accel.m_dwg_rect |M_DWG_REPLACE2 );mga_outl (M_FCOL , bgx);mga_outl (M_FXBNDRY , ((sx + width) <<16 ) | sx); -mga_outl (M_YDST , sy *ACCESS_FBINFO (fbcon).var.xres_virtual >>6 ); +mga_outl (M_YDST , sy * minfo->fbcon.var.xres_virtual >>6 );mga_outl (M_LEN |M_EXEC , height);WaitTillIdle (); }if (whattodo) { -u_int32_t step =ACCESS_FBINFO (fbcon).var.xres_virtual >>1 ; -vaddr_t vbase =ACCESS_FBINFO (video.vbase); +u_int32_t step = minfo->fbcon.var.xres_virtual >>1 ; +vaddr_t vbase = minfo->video.vbase;if (whattodo &1 ) {unsigned int uaddr = sy * step + sx -1 ;u_int32_t loop;
@@ -412,7 +412,7 @@ static void matroxfb_1bpp_imageblit(WPMImga_outl (M_FCOL , fgx);mga_outl (M_BCOL , bgx); fxbndry = ((xx + width -1 ) <<16 ) | xx; - mmio =ACCESS_FBINFO (mmio.vbase); + mmio = minfo->mmio.vbase;mga_fifo (6 );mga_writel (mmio,M_FXBNDRY , fxbndry);
drivers/video/matrox/matroxfb_base.h +11 -16
@@ -524,11 +524,6 @@ struct matrox_fb_info {#define info2minfo (info) container_of(info, struct matrox_fb_info, fbcon) -#define ACCESS_FBINFO2 (info, x) (info->x) -#define ACCESS_FBINFO (x) ACCESS_FBINFO2(minfo,x) - -#define MINFO minfo -#define WPMINFO2 struct matrox_fb_info* minfo#define WPMINFO WPMINFO2 ,#define CPMINFO2 const struct matrox_fb_info* minfo
@@ -707,11 +702,11 @@ void matroxfb_unregister_driver(struct m#endif #endif -#define mga_inb (addr) mga_readb(ACCESS_FBINFO(mmio.vbase), (addr)) -#define mga_inl (addr) mga_readl(ACCESS_FBINFO(mmio.vbase), (addr)) -#define mga_outb (addr,val) mga_writeb(ACCESS_FBINFO(mmio.vbase), (addr), (val)) -#define mga_outw (addr,val) mga_writew(ACCESS_FBINFO(mmio.vbase), (addr), (val)) -#define mga_outl (addr,val) mga_writel(ACCESS_FBINFO(mmio.vbase), (addr), (val)) +#define mga_inb (addr) mga_readb(minfo->mmio.vbase, (addr)) +#define mga_inl (addr) mga_readl(minfo->mmio.vbase, (addr)) +#define mga_outb (addr,val) mga_writeb(minfo->mmio.vbase, (addr), (val)) +#define mga_outw (addr,val) mga_writew(minfo->mmio.vbase, (addr), (val)) +#define mga_outl (addr,val) mga_writel(minfo->mmio.vbase, (addr), (val))#define mga_readr (port,idx) (mga_outb((port),(idx)), mga_inb((port)+1))#define mga_setr (addr,port,val) mga_outw(addr, ((val)<<8) | (port))
@@ -730,10 +725,10 @@ void matroxfb_unregister_driver(struct m#define isMilleniumII (x) (0)#endif -#define matroxfb_DAC_lock () spin_lock(&ACCESS_FBINFO(lock.DAC)) -#define matroxfb_DAC_unlock () spin_unlock(&ACCESS_FBINFO(lock.DAC)) -#define matroxfb_DAC_lock_irqsave (flags) spin_lock_irqsave(&ACCESS_FBINFO(lock.DAC),flags) -#define matroxfb_DAC_unlock_irqrestore (flags) spin_unlock_irqrestore(&ACCESS_FBINFO(lock.DAC),flags) +#define matroxfb_DAC_lock () spin_lock(&minfo->lock.DAC) +#define matroxfb_DAC_unlock () spin_unlock(&minfo->lock.DAC) +#define matroxfb_DAC_lock_irqsave (flags) spin_lock_irqsave(&minfo->lock.DAC, flags) +#define matroxfb_DAC_unlock_irqrestore (flags) spin_unlock_irqrestore(&minfo->lock.DAC, flags) extern void matroxfb_DAC_out(CPMINFO int reg, int val); extern int matroxfb_DAC_in(CPMINFO int reg);extern void matroxfb_var2my (struct fb_var_screeninfo * fvsi,struct my_timming * mt);
@@ -741,8 +736,8 @@ extern int matroxfb_wait_for_sync(WPMINF extern int matroxfb_enable_irq(WPMINFO int reenable);#ifdef MATROXFB_USE_SPINLOCKS -#define CRITBEGIN spin_lock_irqsave(&ACCESS_FBINFO(lock.accel), critflags); -#define CRITEND spin_unlock_irqrestore(&ACCESS_FBINFO(lock.accel), critflags); +#define CRITBEGIN spin_lock_irqsave(&minfo->lock.accel, critflags); +#define CRITEND spin_unlock_irqrestore(&minfo->lock.accel, critflags);#define CRITFLAGS unsigned long critflags;#else #define CRITBEGIN
drivers/video/matrox/g450_pll.c +12 -12
@@ -30,7 +30,7 @@ static unsigned int g450_mnp2vco(CPMINFO m = ((mnp >>16 ) &0x0FF ) +1 ; n = ((mnp >>7 ) &0x1FE ) +4 ; -return (ACCESS_FBINFO (features).pll.ref_freq * n + (m >>1 )) / m; +return (minfo->features.pll.ref_freq * n + (m >>1 )) / m; } unsigned int g450_mnp2f(CPMINFO unsigned int mnp) {
@@ -90,7 +90,7 @@ static unsigned int g450_nextpll(CPMINFO }else { m--; } - n = ((tvco * (m+1 ) +ACCESS_FBINFO (features).pll.ref_freq) / (ACCESS_FBINFO (features).pll.ref_freq *2 )) -2 ; + n = ((tvco * (m+1 ) + minfo->features.pll.ref_freq) / (minfo->features.pll.ref_freq *2 )) -2 ; }while (n <0x03 || n >0x7A );return (m <<16 ) | (n <<8 ) | p; }
@@ -333,7 +333,7 @@ static int __g450_setclk(WPMINFO unsigne matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);/* DVI PLL preferred for frequencies up to panel link max, standard PLL otherwise */ -if (fout >=MINFO ->max_pixel_clock_panellink) +if (fout >= minfo->max_pixel_clock_panellink) tmp =0 ;else tmp = M1064_XDVICLKCTRL_DVIDATAPATHSEL |
@@ -363,20 +363,20 @@ static int __g450_setclk(WPMINFO unsigne }mga_outb (M_MISC_REG , misc); } - pi = &ACCESS_FBINFO (limits.pixel); - ci = &ACCESS_FBINFO (cache.pixel); + pi = &minfo->limits.pixel; + ci = &minfo->cache.pixel;break ;case M_SYSTEM_PLL : {u_int32_t opt; -pci_read_config_dword (ACCESS_FBINFO (pcidev),PCI_OPTION_REG , &opt); +pci_read_config_dword (minfo->pcidev,PCI_OPTION_REG , &opt);if (!(opt &0x20 )) { -pci_write_config_dword (ACCESS_FBINFO (pcidev),PCI_OPTION_REG , opt |0x20 ); +pci_write_config_dword (minfo->pcidev,PCI_OPTION_REG , opt |0x20 ); } } - pi = &ACCESS_FBINFO (limits.system); - ci = &ACCESS_FBINFO (cache.system); + pi = &minfo->limits.system; + ci = &minfo->cache.system;break ;case M_VIDEO_PLL : {
@@ -395,8 +395,8 @@ static int __g450_setclk(WPMINFO unsigne pixel_vco = g450_mnp2vco(PMINFO mnp);matroxfb_DAC_unlock_irqrestore (flags); } - pi = &ACCESS_FBINFO (limits.video); - ci = &ACCESS_FBINFO (cache.video); + pi = &minfo->limits.video; + ci = &minfo->cache.video;break ;default :return -EINVAL ;
@@ -475,7 +475,7 @@ static int __g450_setclk(WPMINFO unsigne mnp = g450_findworkingpll(PMINFO pll, mnparray, mnpcount);g450_addcache (ci, mnparray[0 ], mnp); } -updatehwstate_clk (&ACCESS_FBINFO (hw), mnp, pll); +updatehwstate_clk (&minfo->hw, mnp, pll);matroxfb_DAC_unlock_irqrestore (flags);return mnp; }
drivers/video/matrox/i2c-matroxfb.c +3 -3
@@ -112,7 +112,7 @@ static int i2c_bus_reg(struct i2c_bit_adi2c_set_adapdata (&b->adapter, b); b->adapter.class = class; b->adapter.algo_data = &b->bac; - b->adapter.dev.parent = &ACCESS_FBINFO (pcidev)->dev; + b->adapter.dev.parent = &minfo->pcidev->dev; b->bac = matrox_i2c_algo_template; b->bac.data = b; err =i2c_bit_add_bus (&b->adapter);
@@ -153,7 +153,7 @@ static void* i2c_matroxfb_probe(struct m matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, 0x00);matroxfb_DAC_unlock_irqrestore (flags); -switch (ACCESS_FBINFO (chip)) { +switch (minfo->chip) {case MGA_2064 :case MGA_2164 : err = i2c_bus_reg(&m2info->ddc1, minfo,
@@ -168,7 +168,7 @@ static void* i2c_matroxfb_probe(struct m }if (err) goto fail_ddc1; -if (ACCESS_FBINFO (devflags.dualhead)) { +if (minfo->devflags.dualhead) { err =i2c_bus_reg (&m2info->ddc2, minfo,DDC2_DATA ,DDC2_CLK ,"DDC:fb%u #1" ,I2C_CLASS_DDC );
drivers/video/matrox/matroxfb_DAC1064.c +189 -189
779 lines not on this page · raw message
drivers/video/matrox/matroxfb_Ti3026.c +48 -48
221 lines not on this page · raw message
drivers/video/matrox/matroxfb_base.c +302 -302
1,188 lines not on this page · raw message
drivers/video/matrox/matroxfb_crtc2.c +65 -65
303 lines not on this page · raw message
drivers/video/matrox/matroxfb_g450.c +40 -40
127 lines not on this page · raw message
drivers/video/matrox/matroxfb_maven.c +19 -19
@@ -460,7 +460,7 @@ static void maven_init_TVdata(const stru }, MATROXFB_OUTPUT_MODE_NTSC, 525, 60 };MINFO_FROM (md->primary_head); -if (ACCESS_FBINFO (outputs[1 ]).mode ==MATROXFB_OUTPUT_MODE_PAL ) +if (minfo->outputs[1 ].mode ==MATROXFB_OUTPUT_MODE_PAL ) *data = palregs;else *data = ntscregs;
@@ -496,11 +496,11 @@ static void maven_init_TVdata(const stru/* Set saturation */ { data->regs[0x20 ] = - data->regs[0x22 ] =ACCESS_FBINFO (altout.tvo_params.saturation); + data->regs[0x22 ] = minfo->altout.tvo_params.saturation; }/* Set HUE */ - data->regs[0x25 ] =ACCESS_FBINFO (altout.tvo_params.hue); + data->regs[0x25 ] = minfo->altout.tvo_params.hue;return ; }
@@ -743,7 +743,7 @@ static inline int maven_compute_timming(unsigned int a, bv, c;MINFO_FROM (md->primary_head); - m->mode =ACCESS_FBINFO (outputs[1 ]).mode; + m->mode = minfo->outputs[1 ].mode;if (m->mode !=MATROXFB_OUTPUT_MODE_MONITOR ) {unsigned int lmargin;unsigned int umargin;
@@ -1132,7 +1132,7 @@ static int maven_get_control (struct mavstatic int maven_out_compute (void * md,struct my_timming * mt) {#define mdinfo ((struct maven_data*)md)#define minfo (mdinfo->primary_head) -return maven_compute_timming (md, mt, &ACCESS_FBINFO (hw).maven); +return maven_compute_timming (md, mt, &minfo->hw.maven);#undef minfo#undef mdinfo }
@@ -1140,7 +1140,7 @@ static int maven_out_compute(void* md, sstatic int maven_out_program (void * md) {#define mdinfo ((struct maven_data*)md)#define minfo (mdinfo->primary_head)
Lines of this file are not shown. View the raw message.
drivers/video/matrox/matroxfb_misc.c +105 -105
210 lines not on this page · raw message
drivers/video/matrox/matroxfb_misc.h +1 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
Jean Delvare ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
Part of the diff is not shown here. View the raw message.
PATCH 3/5 matroxfb: Get rid of unneeded macros WPMINFO and friends
In reply to Jean DelvareWith multihead support always enabled, these macros are no longer needed and make the code harder to read.
--- drivers/video/matrox/g450_pll.c | 185 +++++++++++++---------- drivers/video/matrox/g450_pll.h | 8 - drivers/video/matrox/i2c-matroxfb.c | 12 - drivers/video/matrox/matroxfb_DAC1064.c | 248 +++++++++++++++++-------------- drivers/video/matrox/matroxfb_DAC1064.h | 4 drivers/video/matrox/matroxfb_Ti3026.c | 172 +++++++++++---------- drivers/video/matrox/matroxfb_accel.c | 37 +++- drivers/video/matrox/matroxfb_accel.h | 2 drivers/video/matrox/matroxfb_base.c | 124 +++++++++------ drivers/video/matrox/matroxfb_base.h | 24 +-- drivers/video/matrox/matroxfb_crtc2.c | 14 + drivers/video/matrox/matroxfb_g450.c | 99 +++++++----- drivers/video/matrox/matroxfb_g450.h | 8 - drivers/video/matrox/matroxfb_misc.c | 76 ++++++--- drivers/video/matrox/matroxfb_misc.h | 13 + 15 files changed, 581 insertions(+), 445 deletions(-)
drivers/video/matrox/matroxfb_base.h +9 -15
@@ -524,22 +524,15 @@ struct matrox_fb_info {#define info2minfo (info) container_of(info, struct matrox_fb_info, fbcon) -#define WPMINFO2 struct matrox_fb_info* minfo -#define WPMINFO WPMINFO2 , -#define CPMINFO2 const struct matrox_fb_info* minfo -#define CPMINFO CPMINFO2 , -#define PMINFO2 minfo -#define PMINFO PMINFO2 , -#define MINFO_FROM (x) struct matrox_fb_info* minfo = x#define MINFO_FROM_INFO (x) MINFO_FROM(info2minfo(x))struct matrox_switch { -int (*preinit)(WPMINFO2 ); -void (*reset)(WPMINFO2 ); - int (*init)(WPMINFO struct my_timming*); -void (*restore)(WPMINFO2 ); +int (*preinit)(struct matrox_fb_info *minfo); +void (*reset)(struct matrox_fb_info *minfo); +int (*init)(struct matrox_fb_info *minfo,struct my_timming *); +void (*restore)(struct matrox_fb_info *minfo); };struct matroxfb_driver {
@@ -729,11 +722,12 @@ void matroxfb_unregister_driver(struct m#define matroxfb_DAC_unlock () spin_unlock(&minfo->lock.DAC)#define matroxfb_DAC_lock_irqsave (flags) spin_lock_irqsave(&minfo->lock.DAC, flags)#define matroxfb_DAC_unlock_irqrestore (flags) spin_unlock_irqrestore(&minfo->lock.DAC, flags) -extern void matroxfb_DAC_out(CPMINFO int reg, int val); -extern int matroxfb_DAC_in(CPMINFO int reg); +extern void matroxfb_DAC_out (const struct matrox_fb_info *minfo,int reg, +int val); +extern int matroxfb_DAC_in (const struct matrox_fb_info *minfo,int reg);extern void matroxfb_var2my (struct fb_var_screeninfo * fvsi,struct my_timming * mt); -extern int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc); -extern int matroxfb_enable_irq(WPMINFO int reenable); +extern int matroxfb_wait_for_sync (struct matrox_fb_info *minfo,u_int32_t crtc); +extern int matroxfb_enable_irq (struct matrox_fb_info *minfo,int reenable);#ifdef MATROXFB_USE_SPINLOCKS #define CRITBEGIN spin_lock_irqsave(&minfo->lock.accel, critflags);
drivers/video/matrox/g450_pll.c +107 -78
364 lines not on this page · raw message
drivers/video/matrox/g450_pll.h +5 -3
@@ -3,8 +3,10 @@#include "matroxfb_base.h" -int matroxfb_g450_setclk(WPMINFO unsigned int fout, unsigned int pll); -unsigned int g450_mnp2f(CPMINFO unsigned int mnp); -void matroxfb_g450_setpll_cond(WPMINFO unsigned int mnp, unsigned int pll); +int matroxfb_g450_setclk (struct matrox_fb_info *minfo,unsigned int fout, +unsigned int pll); +unsigned int g450_mnp2f (const struct matrox_fb_info *minfo,unsigned int mnp); +void matroxfb_g450_setpll_cond (struct matrox_fb_info *minfo,unsigned int mnp, +unsigned int pll);#endif /* __G450_PLL_H__ */
drivers/video/matrox/matroxfb_DAC1064.c +139 -109
598 lines not on this page · raw message
drivers/video/matrox/matroxfb_DAC1064.h +2 -2
@@ -11,8 +11,8 @@ extern struct matrox_switch matrox_mystiextern struct matrox_switch matrox_G100;#endif #ifdef NEED_DAC1064 -void DAC1064_global_init (WPMINFO2 ); -void DAC1064_global_restore (WPMINFO2 ); +void DAC1064_global_init (struct matrox_fb_info *minfo); +void DAC1064_global_restore (struct matrox_fb_info *minfo);#endif #define M1064_INDEX 0x00
drivers/video/matrox/matroxfb_Ti3026.c +90 -82
334 lines not on this page · raw message
drivers/video/matrox/matroxfb_accel.c +24 -13
@@ -107,7 +107,8 @@ static void matroxfb_imageblit(struct fbstatic void matroxfb_cfb4_fillrect (struct fb_info * info,const struct fb_fillrect * rect);static void matroxfb_cfb4_copyarea (struct fb_info * info,const struct fb_copyarea * area); -void matrox_cfbX_init (WPMINFO2 ) { +void matrox_cfbX_init (struct matrox_fb_info *minfo) +{u_int32_t maccess;u_int32_t mpitch;u_int32_t mopmode;
@@ -195,7 +196,9 @@ void matrox_cfbX_init(WPMINFO2) {EXPORT_SYMBOL (matrox_cfbX_init); -static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx, int height, int width) { +static void matrox_accel_bmove (struct matrox_fb_info *minfo,int vxres,int sy, +int sx,int dy,int dx,int height,int width) +{int start, end;CRITFLAGS
@@ -231,7 +234,10 @@ static void matrox_accel_bmove(WPMINFO i CRITEND } -static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, int dx, int height, int width) { +static void matrox_accel_bmove_lin (struct matrox_fb_info *minfo,int vxres, +int sy,int sx,int dy,int dx,int height, +int width) +{int start, end;CRITFLAGS
@@ -274,17 +280,18 @@ static void matroxfb_cfb4_copyarea(strucif ((area->sx | area->dx | area->width) &1 )cfb_copyarea (info, area);else - matrox_accel_bmove_lin(PMINFO minfo->fbcon.var.xres_virtual >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); +matrox_accel_bmove_lin (minfo, minfo->fbcon.var.xres_virtual >>1 , area->sy, area->sx >>1 , area->dy, area->dx >>1 , area->height, area->width >>1 ); }static void matroxfb_copyarea (struct fb_info * info,const struct fb_copyarea * area) {MINFO_FROM_INFO (info); - matrox_accel_bmove(PMINFO 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); } -static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int height, -int width) { +static void matroxfb_accel_clear (struct matrox_fb_info *minfo,u_int32_t color, +int sy,int sx,int height,int width) +{CRITFLAGS DBG (__func__ )
@@ -306,12 +313,14 @@ static void matroxfb_fillrect(struct fb_switch (rect->rop) {case ROP_COPY : -matroxfb_accel_clear (PMINFO ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); +matroxfb_accel_clear (minfo, ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width);break ; } } -static void matroxfb_cfb4_clear(WPMINFO u_int32_t bgx, int sy, int sx, int height, int width) { +static void matroxfb_cfb4_clear (struct matrox_fb_info *minfo,u_int32_t bgx, +int sy,int sx,int height,int width) +{int whattodo;CRITFLAGS
@@ -371,13 +380,15 @@ static void matroxfb_cfb4_fillrect(strucswitch (rect->rop) {case ROP_COPY : -matroxfb_cfb4_clear (PMINFO ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); +matroxfb_cfb4_clear (minfo, ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width);break ; } } -static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, -const u_int8_t * chardata,int width,int height,int yy,int xx) { +static void matroxfb_1bpp_imageblit (struct matrox_fb_info *minfo,u_int32_t fgx, +u_int32_t bgx,const u_int8_t *chardata, +int width,int height,int yy,int xx) +{u_int32_t step;u_int32_t ydstlen;u_int32_t xlen;
@@ -476,7 +487,7 @@ static void matroxfb_imageblit(struct fb fgx = ((u_int32_t *)info->pseudo_palette)[image->fg_color]; bgx = ((u_int32_t *)info->pseudo_palette)[image->bg_color]; - matroxfb_1bpp_imageblit(PMINFO fgx, bgx, image->data, image->width, image->height, image->dy, image->dx); +matroxfb_1bpp_imageblit (minfo, fgx, bgx, image->data, image->width, image->height, image->dy, image->dx); }else {/* Danger! image->depth is useless: logo painting code always passes framebuffer color depth here, although logo data are
drivers/video/matrox/matroxfb_accel.h +1 -1
@@ -3,6 +3,6 @@#include "matroxfb_base.h" -void matrox_cfbX_init (WPMINFO2 ); +void matrox_cfbX_init (struct matrox_fb_info *minfo);#endif
drivers/video/matrox/matroxfb_base.c +73 -51
391 lines not on this page · raw message
drivers/video/matrox/matroxfb_crtc2.c +8 -6
@@ -369,8 +369,8 @@ static int matroxfb_dh_set_par(struct fb }else {matroxfb_dh_disable (m2info); } -DAC1064_global_init (PMINFO2 ); -DAC1064_global_restore (PMINFO2 ); +DAC1064_global_init (minfo); +DAC1064_global_restore (minfo);down_read (&minfo->altout.lock);for (out =0 ; out <MATROXFB_MAX_OUTPUTS ; out++) { if (minfo->outputs[out].src == MATROXFB_SRC_CRTC2 &&
@@ -401,7 +401,7 @@ static int matroxfb_dh_pan_display(strucstatic int matroxfb_dh_get_vblank (const struct matroxfb_dh_fb_info * m2info,struct fb_vblank * vblank) {MINFO_FROM (m2info->primary_dev); - matroxfb_enable_irq(PMINFO 0); +matroxfb_enable_irq (minfo,0 );memset (vblank,0 ,sizeof (*vblank)); vblank->flags =FB_VBLANK_HAVE_VCOUNT |FB_VBLANK_HAVE_VBLANK ;/* mask out reserved bits + field number (odd/even) */
@@ -449,7 +449,7 @@ static int matroxfb_dh_ioctl(struct fb_iif (crt !=0 )return -ENODEV ; - return matroxfb_wait_for_sync(PMINFO 1); +return matroxfb_wait_for_sync (minfo,1 ); }case MATROXFB_SET_OUTPUT_MODE :case MATROXFB_GET_OUTPUT_MODE :
@@ -595,7 +595,9 @@ static struct fb_var_screeninfo matroxfb 0, {0,0,0,0,0} }; -static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) { +static int matroxfb_dh_regit (const struct matrox_fb_info *minfo, +struct matroxfb_dh_fb_info *m2info) +{#define minfo (m2info->primary_dev)void * oldcrtc2;
@@ -649,7 +651,7 @@ static int matroxfb_dh_regit(CPMINFO strstatic int matroxfb_dh_registerfb (struct matroxfb_dh_fb_info * m2info) {#define minfo (m2info->primary_dev) - if (matroxfb_dh_regit(PMINFO m2info)) { +if (matroxfb_dh_regit (minfo, m2info)) {printk (KERN_ERR "matroxfb_crtc2: secondary head failed to register\n" );return -1 ; }
drivers/video/matrox/matroxfb_g450.c +56 -43
239 lines not on this page · raw message
drivers/video/matrox/matroxfb_g450.h +4 -4
@@ -4,11 +4,11 @@#include "matroxfb_base.h" #ifdef CONFIG_FB_MATROX_G -void matroxfb_g450_connect (WPMINFO2 ); -void matroxfb_g450_shutdown (WPMINFO2 ); +void matroxfb_g450_connect (struct matrox_fb_info *minfo); +void matroxfb_g450_shutdown (struct matrox_fb_info *minfo);#else -static inline void matroxfb_g450_connect (WPMINFO2 ) { }; -static inline void matroxfb_g450_shutdown (WPMINFO2 ) { }; +static inline void matroxfb_g450_connect (struct matrox_fb_info *minfo) { }; +static inline void matroxfb_g450_shutdown (struct matrox_fb_info *minfo) { };#endif #endif /* __MATROXFB_G450_H__ */
drivers/video/matrox/matroxfb_misc.c +49 -27
195 lines not on this page · raw message
drivers/video/matrox/matroxfb_misc.h +8 -5
@@ -6,13 +6,16 @@/* also for modules */ int matroxfb_PLL_calcclock (const struct matrox_pll_features * pll,unsigned int freq,unsigned int fmax,unsigned int * in,unsigned int * feed,unsigned int * post); -static inline int PLL_calcclock(CPMINFO unsigned int freq, unsigned int fmax, -unsigned int * in,unsigned int * feed,unsigned int * post) { +static inline int PLL_calcclock (const struct matrox_fb_info *minfo, +unsigned int freq,unsigned int fmax, +unsigned int *in,unsigned int *feed, +unsigned int *post) +{return matroxfb_PLL_calcclock (&minfo->features.pll, freq, fmax, in, feed, post); } -int matroxfb_vgaHWinit(WPMINFO struct my_timming* m); -void matroxfb_vgaHWrestore (WPMINFO2 ); -void matroxfb_read_pins (WPMINFO2 ); +int matroxfb_vgaHWinit (struct matrox_fb_info *minfo,struct my_timming * m); +void matroxfb_vgaHWrestore (struct matrox_fb_info *minfo); +void matroxfb_read_pins (struct matrox_fb_info *minfo);#endif /* __MATROXFB_MISC_H__ */
drivers/video/matrox/i2c-matroxfb.c +6 -6
@@ -41,7 +41,7 @@ static int matroxfb_read_gpio(struct matint v;matroxfb_DAC_lock_irqsave (flags); - v = matroxfb_DAC_in(PMINFO DAC_XGENIODATA); + v =matroxfb_DAC_in (minfo,DAC_XGENIODATA );matroxfb_DAC_unlock_irqrestore (flags);return v; }
@@ -51,10 +51,10 @@ static void matroxfb_set_gpio(struct matint v;matroxfb_DAC_lock_irqsave (flags); - v = (matroxfb_DAC_in(PMINFO DAC_XGENIOCTRL) & mask) | val; - matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, v); + v = (matroxfb_DAC_in (minfo,DAC_XGENIOCTRL ) & mask) | val; +matroxfb_DAC_out (minfo,DAC_XGENIOCTRL , v);/* We must reset GENIODATA very often... XFree plays with this register */ - matroxfb_DAC_out(PMINFO DAC_XGENIODATA, 0x00); +matroxfb_DAC_out (minfo,DAC_XGENIODATA ,0x00 );matroxfb_DAC_unlock_irqrestore (flags); }
@@ -149,8 +149,8 @@ static void* i2c_matroxfb_probe(struct mreturn NULL ;matroxfb_DAC_lock_irqsave (flags); - matroxfb_DAC_out(PMINFO DAC_XGENIODATA, 0xFF); - matroxfb_DAC_out(PMINFO DAC_XGENIOCTRL, 0x00); +matroxfb_DAC_out (minfo,DAC_XGENIODATA ,0xFF ); +matroxfb_DAC_out (minfo,DAC_XGENIOCTRL ,0x00 );matroxfb_DAC_unlock_irqrestore (flags);switch (minfo->chip) {
Signature · 7 lines
Jean Delvare ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
PATCH 4/5 matroxfb: Get rid of unneeded macro MINFO_FROM
In reply to Jean DelvareWith multihead support always enabled, macros MINFO_FROM and MINFO_FROM_INFO are no longer needed and make the code harder to read.
--- drivers/video/matrox/matroxfb_accel.c | 10 +++++----- drivers/video/matrox/matroxfb_base.c | 17 ++++++++--------- drivers/video/matrox/matroxfb_base.h | 4 ---- drivers/video/matrox/matroxfb_crtc2.c | 16 ++++++++-------- drivers/video/matrox/matroxfb_g450.c | 10 +++++----- drivers/video/matrox/matroxfb_maven.c | 10 ++++++---- 6 files changed, 32 insertions(+), 35 deletions(-)
drivers/video/matrox/matroxfb_accel.c +5 -5
@@ -275,7 +275,7 @@ static void matrox_accel_bmove_lin(struc }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 )cfb_copyarea (info, area);
@@ -284,7 +284,7 @@ static void matroxfb_cfb4_copyarea(struc }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); }
@@ -309,7 +309,7 @@ static void matroxfb_accel_clear(struct }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) {case ROP_COPY :
@@ -376,7 +376,7 @@ static void matroxfb_cfb4_clear(struct m }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) {case ROP_COPY :
@@ -478,7 +478,7 @@ static void matroxfb_1bpp_imageblit(strustatic 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__);
drivers/video/matrox/matroxfb_base.c +8 -9
@@ -204,8 +204,7 @@ static irqreturn_t matrox_irq(int irq, v {u_int32_t status;int handled =0 ; - -MINFO_FROM (dev_id); +struct matrox_fb_info *minfo = dev_id; status =mga_inl (M_STATUS );
@@ -396,7 +395,7 @@ static void matroxfb_remove(struct matrostatic int matroxfb_open (struct fb_info *info,int user) { -MINFO_FROM_INFO (info); +struct matrox_fb_info *minfo =info2minfo (info);DBG_LOOP (__func__)
@@ -412,7 +411,7 @@ static int matroxfb_open(struct fb_infostatic int matroxfb_release (struct fb_info *info,int user) { -MINFO_FROM_INFO (info); +struct matrox_fb_info *minfo =info2minfo (info);DBG_LOOP (__func__)
@@ -429,7 +428,7 @@ static int matroxfb_release(struct fb_instatic int matroxfb_pan_display (struct fb_var_screeninfo *var,struct fb_info * info) { -MINFO_FROM_INFO (info); +struct matrox_fb_info *minfo =info2minfo (info);DBG (__func__)
@@ -749,7 +748,7 @@ static int matroxfb_check_var(struct fb_int visual;int cmap_len;unsigned int ydstorg; -MINFO_FROM_INFO (info); +struct matrox_fb_info *minfo =info2minfo (info);if (minfo->dead) {return -ENXIO ;
@@ -766,7 +765,7 @@ static int matroxfb_set_par(struct fb_inint cmap_len;unsigned int ydstorg;struct fb_var_screeninfo *var; -MINFO_FROM_INFO (info); +struct matrox_fb_info *minfo =info2minfo (info);DBG (__func__)
@@ -890,7 +889,7 @@ static int matroxfb_ioctl(struct fb_info unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; -MINFO_FROM_INFO (info); +struct matrox_fb_info *minfo =info2minfo (info);DBG (__func__)
@@ -1189,7 +1188,7 @@ static int matroxfb_blank(int blank, strint seq;int crtc;CRITFLAGS -MINFO_FROM_INFO (info ); + struct matrox_fb_info *minfo = info2minfo(info);DBG (__func__)
drivers/video/matrox/matroxfb_base.h +0 -4
@@ -524,10 +524,6 @@ struct matrox_fb_info {#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 {int (*preinit)(struct matrox_fb_info *minfo);void (*reset)(struct matrox_fb_info *minfo);
drivers/video/matrox/matroxfb_crtc2.c +8 -8
@@ -65,7 +65,7 @@ static void matroxfb_dh_restore(struct m unsigned int pos) {u_int32_t tmp;u_int32_t datactl; -MINFO_FROM (m2info->primary_dev); +struct matrox_fb_info *minfo = m2info->primary_dev;switch (mode) {case 15 :
@@ -157,7 +157,7 @@ static void matroxfb_dh_restore(struct m }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 */ minfo->hw.crtc2.ctl =0x00000004 ;
@@ -168,7 +168,7 @@ static void matroxfb_dh_pan_var(struct munsigned int pos;unsigned int linelen;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.yoffset = var->yoffset;
@@ -260,7 +260,7 @@ static int matroxfb_dh_decode_var(structstatic int matroxfb_dh_open (struct fb_info * info,int user) {#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) {int err;
@@ -280,7 +280,7 @@ static int matroxfb_dh_open(struct fb_instatic int matroxfb_dh_release (struct fb_info * info,int user) {#define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon))int err =0 ; -MINFO_FROM (m2info->primary_dev); +struct matrox_fb_info *minfo = m2info->primary_dev;if (minfo) { err = minfo->fbops.fb_release (&minfo->fbcon, user);
@@ -326,7 +326,7 @@ static int matroxfb_dh_set_par(struct fbint mode;int err;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 )return err;
@@ -399,7 +399,7 @@ static int matroxfb_dh_pan_display(struc }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 );memset (vblank,0 ,sizeof (*vblank));
@@ -423,7 +423,7 @@ static int matroxfb_dh_ioctl(struct fb_i unsigned long arg) {#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__)
drivers/video/matrox/matroxfb_g450.c +5 -5
@@ -161,7 +161,7 @@ static int g450_query_ctrl(void* md, strstatic int g450_set_ctrl (void * md,struct v4l2_control *p) {int i; -MINFO_FROM (md); +struct matrox_fb_info *minfo = md; i =get_ctrl_id (p->id);if (i <0 )return -EINVAL ;
@@ -215,7 +215,7 @@ static int g450_set_ctrl(void* md, strucstatic int g450_get_ctrl (void * md,struct v4l2_control *p) {int i; -MINFO_FROM (md); +struct matrox_fb_info *minfo = md; i =get_ctrl_id (p->id);if (i <0 )return -EINVAL ;
@@ -518,7 +518,7 @@ static void cve2_init_TV(struct matrox_f }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);
@@ -556,7 +556,7 @@ static int matroxfb_g450_compute(void* m }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 ) {cve2_init_TV (minfo, &minfo->hw.maven);
@@ -575,7 +575,7 @@ static int matroxfb_g450_verify_mode(voi }static int g450_dvi_compute (void * md,struct my_timming * mt) { -MINFO_FROM (md); +struct matrox_fb_info *minfo = md;if (mt->mnp <0 ) { mt->mnp =matroxfb_g450_setclk (minfo, mt->pixclock, (mt->crtc ==MATROXFB_SRC_CRTC1 ) ?M_PIXEL_PLL_C :M_VIDEO_PLL );
drivers/video/matrox/matroxfb_maven.c +6 -4
@@ -458,7 +458,7 @@ static void maven_init_TVdata(const stru 0x00, /* 3E written multiple times */ 0x00, /* never written */ }, 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 ) *data = palregs;
@@ -741,7 +741,7 @@ static inline int maven_compute_timming( struct mavenregs* m) {unsigned int tmpi;unsigned int a, bv, c; -MINFO_FROM (md->primary_head); +struct matrox_fb_info *minfo = md->primary_head; m->mode = minfo->outputs[1 ].mode;if (m->mode !=MATROXFB_OUTPUT_MODE_MONITOR ) {
@@ -1184,7 +1184,9 @@ static struct matrox_altout maven_altoutstatic int maven_init_client (struct i2c_client * 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->client = clnt;
@@ -1218,7 +1220,7 @@ static int maven_shutdown_client(structstruct maven_data * md =i2c_get_clientdata (clnt);if (md->primary_head) { -MINFO_FROM (md->primary_head); +struct matrox_fb_info *minfo = md->primary_head;down_write (&minfo->altout.lock); minfo->outputs[1 ].src =MATROXFB_SRC_NONE ;
Signature · 7 lines
Jean Delvare ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
PATCH 5/5 matroxfb: Get rid of CONFIG_FB_MATROX_32MB
In reply to Jean DelvareCONFIG_FB_MATROX_32MB is always enabled, so there is no point in having ifdefs all around. And it is bad practice to use CONFIG_* as a name for something which is not a Kconfig option.
--- drivers/video/matrox/matroxfb_DAC1064.c | 2 -- drivers/video/matrox/matroxfb_base.c | 12 ------------ drivers/video/matrox/matroxfb_base.h | 5 ----- 3 files changed, 19 deletions(-)
drivers/video/matrox/matroxfb_DAC1064.c +0 -2
@@ -1080,10 +1080,8 @@ static void MGAG100_restore(struct matroDAC1064_restore_1 (minfo);matroxfb_vgaHWrestore (minfo); -#ifdef CONFIG_FB_MATROX_32MB if (minfo->devflags.support32MB)mga_setr (M_EXTVGA_INDEX ,8 , hw->CRTCEXT[8 ]); -#endif minfo->crtc1.panpos =-1 ;for (i =0 ; i <6 ; i++)mga_setr (M_EXTVGA_INDEX , i, hw->CRTCEXT[i]);
drivers/video/matrox/matroxfb_base.c +0 -12
@@ -310,9 +310,7 @@ static void matrox_pan_var(struct matrox {unsigned int pos;unsigned short p0, p1, p2; -#ifdef CONFIG_FB_MATROX_32MB unsigned int p3; -#endif int vbl;unsigned long flags;
@@ -330,9 +328,7 @@ static void matrox_pan_var(struct matrox p0 = minfo->hw.CRTC[0x0D ] = pos &0xFF ; p1 = minfo->hw.CRTC[0x0C ] = (pos &0xFF00 ) >>8 ; p2 = minfo->hw.CRTCEXT[0 ] = (minfo->hw.CRTCEXT[0 ] &0xB0 ) | ((pos >>16 ) &0x0F ) | ((pos >>14 ) &0x40 ); -#ifdef CONFIG_FB_MATROX_32MB p3 = minfo->hw.CRTCEXT[8 ] = pos >>21 ; -#endif /* FB_ACTIVATE_VBL and we can acquire interrupts? Honor FB_ACTIVATE_VBL then... */ vbl = (var->activate &FB_ACTIVATE_VBL ) && (matroxfb_enable_irq (minfo,0 ) ==0 );
@@ -342,10 +338,8 @@ static void matrox_pan_var(struct matroxmatroxfb_DAC_lock_irqsave (flags);mga_setr (M_CRTC_INDEX ,0x0D , p0);mga_setr (M_CRTC_INDEX ,0x0C , p1); -#ifdef CONFIG_FB_MATROX_32MB if (minfo->devflags.support32MB)mga_setr (M_EXTVGA_INDEX ,0x08 , p3); -#endif if (vbl) { minfo->crtc1.panpos = p2; }else {
@@ -1360,13 +1354,9 @@ static struct video_board vbMystique =#ifdef CONFIG_FB_MATROX_G static struct video_board vbG100 = {0x0800000 ,0x0800000 ,FB_ACCEL_MATROX_MGAG100 , &matrox_G100};static struct video_board vbG200 = {0x1000000 ,0x1000000 ,FB_ACCEL_MATROX_MGAG200 , &matrox_G100}; -#ifdef CONFIG_FB_MATROX_32MB /* from doc it looks like that accelerator can draw only to low 16MB :-( Direct accesses & displaying are OK for whole 32MB */ static struct video_board vbG400 = {0x2000000 ,0x1000000 ,FB_ACCEL_MATROX_MGAG400 , &matrox_G100}; -#else -static struct video_board vbG400 = {0x2000000 ,0x1000000 ,FB_ACCEL_MATROX_MGAG400 , &matrox_G100}; -#endif #endif #define DEVF_VIDEO64BIT 0x0001
@@ -1646,9 +1636,7 @@ static int initMatrox2(struct matrox_fb_ minfo->devflags.textmode =1 ; minfo->devflags.text_type_aux =FB_AUX_TEXT_MGA_STEP8 ; } -#ifdef CONFIG_FB_MATROX_32MB minfo->devflags.support32MB = (b->flags &DEVF_SUPPORT32MB ) !=0 ; -#endif minfo->devflags.precise_width = !(b->flags &DEVF_ANY_VXRES ); minfo->devflags.crtc2 = (b->flags &DEVF_CRTC2 ) !=0 ; minfo->devflags.maven_capable = (b->flags &DEVF_MAVEN_CAPABLE ) !=0 ;
drivers/video/matrox/matroxfb_base.h +0 -5
@@ -54,9 +54,6 @@#include "../macmodes.h" #endif -/* always compile support for 32MB... It cost almost nothing */ -#define CONFIG_FB_MATROX_32MB -#ifdef MATROXFB_DEBUG #define DEBUG
@@ -464,9 +461,7 @@ struct matrox_fb_info {int nopciretry;int noinit;int sgram; -#ifdef CONFIG_FB_MATROX_32MB int support32MB; -#endif int accelerator;int text_type_aux;
Signature · 7 lines
Jean Delvare ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july