aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-24 00:31:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:41 -0400
commit1ca6b62f8ca668ccfab0da9112c0125ef82343bd (patch)
treeb649a9c2e341115ec595619d9d28648f6023a3a3
parent7fc80b7bd682b47825e806018cca8ff7dc6bb55a (diff)
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: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/neofb.c95
1 files changed, 22 insertions, 73 deletions
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index b033e5a4dc86..669b8c196bba 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -479,7 +479,8 @@ static inline int neo2200_sync(struct fb_info *info)
479{ 479{
480 struct neofb_par *par = info->par; 480 struct neofb_par *par = info->par;
481 481
482 while (readl(&par->neo2200->bltStat) & 1); 482 while (readl(&par->neo2200->bltStat) & 1)
483 cpu_relax();
483 return 0; 484 return 0;
484} 485}
485 486
@@ -587,34 +588,14 @@ static int
587neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 588neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
588{ 589{
589 struct neofb_par *par = info->par; 590 struct neofb_par *par = info->par;
590 unsigned int pixclock = var->pixclock;
591 struct xtimings timings;
592 int memlen, vramlen; 591 int memlen, vramlen;
593 int mode_ok = 0; 592 int mode_ok = 0;
594 593
595 DBG("neofb_check_var"); 594 DBG("neofb_check_var");
596 595
597 if (!pixclock) 596 if (PICOS2KHZ(var->pixclock) > par->maxClock)
598 pixclock = 10000; /* 10ns = 100MHz */
599 timings.pixclock = 1000000000 / pixclock;
600 if (timings.pixclock < 1)
601 timings.pixclock = 1;
602
603 if (timings.pixclock > par->maxClock)
604 return -EINVAL; 597 return -EINVAL;
605 598
606 timings.dblscan = var->vmode & FB_VMODE_DOUBLE;
607 timings.interlaced = var->vmode & FB_VMODE_INTERLACED;
608 timings.HDisplay = var->xres;
609 timings.HSyncStart = timings.HDisplay + var->right_margin;
610 timings.HSyncEnd = timings.HSyncStart + var->hsync_len;
611 timings.HTotal = timings.HSyncEnd + var->left_margin;
612 timings.VDisplay = var->yres;
613 timings.VSyncStart = timings.VDisplay + var->lower_margin;
614 timings.VSyncEnd = timings.VSyncStart + var->vsync_len;
615 timings.VTotal = timings.VSyncEnd + var->upper_margin;
616 timings.sync = var->sync;
617
618 /* Is the mode larger than the LCD panel? */ 599 /* Is the mode larger than the LCD panel? */
619 if (par->internal_display && 600 if (par->internal_display &&
620 ((var->xres > par->NeoPanelWidth) || 601 ((var->xres > par->NeoPanelWidth) ||
@@ -1923,9 +1904,6 @@ static int __devinit neo_init_hw(struct fb_info *info)
1923 int maxClock = 65000; 1904 int maxClock = 65000;
1924 int CursorMem = 1024; 1905 int CursorMem = 1024;
1925 int CursorOff = 0x100; 1906 int CursorOff = 0x100;
1926 int linearSize = 1024;
1927 int maxWidth = 1024;
1928 int maxHeight = 1024;
1929 1907
1930 DBG("neo_init_hw"); 1908 DBG("neo_init_hw");
1931 1909
@@ -1944,81 +1922,52 @@ static int __devinit neo_init_hw(struct fb_info *info)
1944 case FB_ACCEL_NEOMAGIC_NM2070: 1922 case FB_ACCEL_NEOMAGIC_NM2070:
1945 videoRam = 896; 1923 videoRam = 896;
1946 maxClock = 65000; 1924 maxClock = 65000;
1947 CursorMem = 2048;
1948 CursorOff = 0x100;
1949 linearSize = 1024;
1950 maxWidth = 1024;
1951 maxHeight = 1024;
1952 break; 1925 break;
1953 case FB_ACCEL_NEOMAGIC_NM2090: 1926 case FB_ACCEL_NEOMAGIC_NM2090:
1954 case FB_ACCEL_NEOMAGIC_NM2093: 1927 case FB_ACCEL_NEOMAGIC_NM2093:
1955 videoRam = 1152;
1956 maxClock = 80000;
1957 CursorMem = 2048;
1958 CursorOff = 0x100;
1959 linearSize = 2048;
1960 maxWidth = 1024;
1961 maxHeight = 1024;
1962 break;
1963 case FB_ACCEL_NEOMAGIC_NM2097: 1928 case FB_ACCEL_NEOMAGIC_NM2097:
1964 videoRam = 1152; 1929 videoRam = 1152;
1965 maxClock = 80000; 1930 maxClock = 80000;
1966 CursorMem = 1024;
1967 CursorOff = 0x100;
1968 linearSize = 2048;
1969 maxWidth = 1024;
1970 maxHeight = 1024;
1971 break; 1931 break;
1972 case FB_ACCEL_NEOMAGIC_NM2160: 1932 case FB_ACCEL_NEOMAGIC_NM2160:
1973 videoRam = 2048; 1933 videoRam = 2048;
1974 maxClock = 90000; 1934 maxClock = 90000;
1975 CursorMem = 1024;
1976 CursorOff = 0x100;
1977 linearSize = 2048;
1978 maxWidth = 1024;
1979 maxHeight = 1024;
1980 break; 1935 break;
1981 case FB_ACCEL_NEOMAGIC_NM2200: 1936 case FB_ACCEL_NEOMAGIC_NM2200:
1982 videoRam = 2560; 1937 videoRam = 2560;
1983 maxClock = 110000; 1938 maxClock = 110000;
1984 CursorMem = 1024;
1985 CursorOff = 0x1000;
1986 linearSize = 4096;
1987 maxWidth = 1280;
1988 maxHeight = 1024; /* ???? */
1989
1990 par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
1991 break; 1939 break;
1992 case FB_ACCEL_NEOMAGIC_NM2230: 1940 case FB_ACCEL_NEOMAGIC_NM2230:
1993 videoRam = 3008; 1941 videoRam = 3008;
1994 maxClock = 110000; 1942 maxClock = 110000;
1995 CursorMem = 1024;
1996 CursorOff = 0x1000;
1997 linearSize = 4096;
1998 maxWidth = 1280;
1999 maxHeight = 1024; /* ???? */
2000
2001 par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
2002 break; 1943 break;
2003 case FB_ACCEL_NEOMAGIC_NM2360: 1944 case FB_ACCEL_NEOMAGIC_NM2360:
2004 videoRam = 4096; 1945 videoRam = 4096;
2005 maxClock = 110000; 1946 maxClock = 110000;
2006 CursorMem = 1024;
2007 CursorOff = 0x1000;
2008 linearSize = 4096;
2009 maxWidth = 1280;
2010 maxHeight = 1024; /* ???? */
2011
2012 par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
2013 break; 1947 break;
2014 case FB_ACCEL_NEOMAGIC_NM2380: 1948 case FB_ACCEL_NEOMAGIC_NM2380:
2015 videoRam = 6144; 1949 videoRam = 6144;
2016 maxClock = 110000; 1950 maxClock = 110000;
1951 break;
1952 }
1953 switch (info->fix.accel) {
1954 case FB_ACCEL_NEOMAGIC_NM2070:
1955 case FB_ACCEL_NEOMAGIC_NM2090:
1956 case FB_ACCEL_NEOMAGIC_NM2093:
1957 CursorMem = 2048;
1958 CursorOff = 0x100;
1959 break;
1960 case FB_ACCEL_NEOMAGIC_NM2097:
1961 case FB_ACCEL_NEOMAGIC_NM2160:
1962 CursorMem = 1024;
1963 CursorOff = 0x100;
1964 break;
1965 case FB_ACCEL_NEOMAGIC_NM2200:
1966 case FB_ACCEL_NEOMAGIC_NM2230:
1967 case FB_ACCEL_NEOMAGIC_NM2360:
1968 case FB_ACCEL_NEOMAGIC_NM2380:
2017 CursorMem = 1024; 1969 CursorMem = 1024;
2018 CursorOff = 0x1000; 1970 CursorOff = 0x1000;
2019 linearSize = 8192;
2020 maxWidth = 1280;
2021 maxHeight = 1024; /* ???? */
2022 1971
2023 par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase; 1972 par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
2024 break; 1973 break;
@@ -2032,7 +1981,7 @@ static int __devinit neo_init_hw(struct fb_info *info)
2032*/ 1981*/
2033 par->maxClock = maxClock; 1982 par->maxClock = maxClock;
2034 par->cursorOff = CursorOff; 1983 par->cursorOff = CursorOff;
2035 return ((videoRam * 1024)); 1984 return videoRam * 1024;
2036} 1985}
2037 1986
2038 1987