提交 1ca6b62f 编写于 作者: K Krzysztof Helt 提交者: Linus Torvalds

neofb: drop redundant code

Drop structure which is only set but never read.  Drop variables which are
only set and never read.  Convert one long switch into two shorter ones.

Add cpu_relax() in busy waiting loop.
Signed-off-by: NKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 7fc80b7b
...@@ -479,7 +479,8 @@ static inline int neo2200_sync(struct fb_info *info) ...@@ -479,7 +479,8 @@ static inline int neo2200_sync(struct fb_info *info)
{ {
struct neofb_par *par = info->par; struct neofb_par *par = info->par;
while (readl(&par->neo2200->bltStat) & 1); while (readl(&par->neo2200->bltStat) & 1)
cpu_relax();
return 0; return 0;
} }
...@@ -587,34 +588,14 @@ static int ...@@ -587,34 +588,14 @@ static int
neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{ {
struct neofb_par *par = info->par; struct neofb_par *par = info->par;
unsigned int pixclock = var->pixclock;
struct xtimings timings;
int memlen, vramlen; int memlen, vramlen;
int mode_ok = 0; int mode_ok = 0;
DBG("neofb_check_var"); DBG("neofb_check_var");
if (!pixclock) if (PICOS2KHZ(var->pixclock) > par->maxClock)
pixclock = 10000; /* 10ns = 100MHz */
timings.pixclock = 1000000000 / pixclock;
if (timings.pixclock < 1)
timings.pixclock = 1;
if (timings.pixclock > par->maxClock)
return -EINVAL; return -EINVAL;
timings.dblscan = var->vmode & FB_VMODE_DOUBLE;
timings.interlaced = var->vmode & FB_VMODE_INTERLACED;
timings.HDisplay = var->xres;
timings.HSyncStart = timings.HDisplay + var->right_margin;
timings.HSyncEnd = timings.HSyncStart + var->hsync_len;
timings.HTotal = timings.HSyncEnd + var->left_margin;
timings.VDisplay = var->yres;
timings.VSyncStart = timings.VDisplay + var->lower_margin;
timings.VSyncEnd = timings.VSyncStart + var->vsync_len;
timings.VTotal = timings.VSyncEnd + var->upper_margin;
timings.sync = var->sync;
/* Is the mode larger than the LCD panel? */ /* Is the mode larger than the LCD panel? */
if (par->internal_display && if (par->internal_display &&
((var->xres > par->NeoPanelWidth) || ((var->xres > par->NeoPanelWidth) ||
...@@ -1923,9 +1904,6 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -1923,9 +1904,6 @@ static int __devinit neo_init_hw(struct fb_info *info)
int maxClock = 65000; int maxClock = 65000;
int CursorMem = 1024; int CursorMem = 1024;
int CursorOff = 0x100; int CursorOff = 0x100;
int linearSize = 1024;
int maxWidth = 1024;
int maxHeight = 1024;
DBG("neo_init_hw"); DBG("neo_init_hw");
...@@ -1944,81 +1922,52 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -1944,81 +1922,52 @@ static int __devinit neo_init_hw(struct fb_info *info)
case FB_ACCEL_NEOMAGIC_NM2070: case FB_ACCEL_NEOMAGIC_NM2070:
videoRam = 896; videoRam = 896;
maxClock = 65000; maxClock = 65000;
CursorMem = 2048;
CursorOff = 0x100;
linearSize = 1024;
maxWidth = 1024;
maxHeight = 1024;
break; break;
case FB_ACCEL_NEOMAGIC_NM2090: case FB_ACCEL_NEOMAGIC_NM2090:
case FB_ACCEL_NEOMAGIC_NM2093: case FB_ACCEL_NEOMAGIC_NM2093:
videoRam = 1152;
maxClock = 80000;
CursorMem = 2048;
CursorOff = 0x100;
linearSize = 2048;
maxWidth = 1024;
maxHeight = 1024;
break;
case FB_ACCEL_NEOMAGIC_NM2097: case FB_ACCEL_NEOMAGIC_NM2097:
videoRam = 1152; videoRam = 1152;
maxClock = 80000; maxClock = 80000;
CursorMem = 1024;
CursorOff = 0x100;
linearSize = 2048;
maxWidth = 1024;
maxHeight = 1024;
break; break;
case FB_ACCEL_NEOMAGIC_NM2160: case FB_ACCEL_NEOMAGIC_NM2160:
videoRam = 2048; videoRam = 2048;
maxClock = 90000; maxClock = 90000;
CursorMem = 1024;
CursorOff = 0x100;
linearSize = 2048;
maxWidth = 1024;
maxHeight = 1024;
break; break;
case FB_ACCEL_NEOMAGIC_NM2200: case FB_ACCEL_NEOMAGIC_NM2200:
videoRam = 2560; videoRam = 2560;
maxClock = 110000; maxClock = 110000;
CursorMem = 1024;
CursorOff = 0x1000;
linearSize = 4096;
maxWidth = 1280;
maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
case FB_ACCEL_NEOMAGIC_NM2230: case FB_ACCEL_NEOMAGIC_NM2230:
videoRam = 3008; videoRam = 3008;
maxClock = 110000; maxClock = 110000;
CursorMem = 1024;
CursorOff = 0x1000;
linearSize = 4096;
maxWidth = 1280;
maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
case FB_ACCEL_NEOMAGIC_NM2360: case FB_ACCEL_NEOMAGIC_NM2360:
videoRam = 4096; videoRam = 4096;
maxClock = 110000; maxClock = 110000;
CursorMem = 1024;
CursorOff = 0x1000;
linearSize = 4096;
maxWidth = 1280;
maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
case FB_ACCEL_NEOMAGIC_NM2380: case FB_ACCEL_NEOMAGIC_NM2380:
videoRam = 6144; videoRam = 6144;
maxClock = 110000; maxClock = 110000;
break;
}
switch (info->fix.accel) {
case FB_ACCEL_NEOMAGIC_NM2070:
case FB_ACCEL_NEOMAGIC_NM2090:
case FB_ACCEL_NEOMAGIC_NM2093:
CursorMem = 2048;
CursorOff = 0x100;
break;
case FB_ACCEL_NEOMAGIC_NM2097:
case FB_ACCEL_NEOMAGIC_NM2160:
CursorMem = 1024;
CursorOff = 0x100;
break;
case FB_ACCEL_NEOMAGIC_NM2200:
case FB_ACCEL_NEOMAGIC_NM2230:
case FB_ACCEL_NEOMAGIC_NM2360:
case FB_ACCEL_NEOMAGIC_NM2380:
CursorMem = 1024; CursorMem = 1024;
CursorOff = 0x1000; CursorOff = 0x1000;
linearSize = 8192;
maxWidth = 1280;
maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase; par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
...@@ -2032,7 +1981,7 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -2032,7 +1981,7 @@ static int __devinit neo_init_hw(struct fb_info *info)
*/ */
par->maxClock = maxClock; par->maxClock = maxClock;
par->cursorOff = CursorOff; par->cursorOff = CursorOff;
return ((videoRam * 1024)); return videoRam * 1024;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册