diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2009-09-22 19:47:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:51 -0400 |
commit | 81228a36a5d05181fff990c852a9abdf03c75593 (patch) | |
tree | 9c741b06e6a6ea7548545906b6bc16c5a45dfe38 /drivers/video/via/viafbdev.c | |
parent | 3915a927aaed8d158cba5ad6466e237ae0d84aab (diff) |
viafb: merge viafb_update_viafb_par in viafb_update_fix
Shrink and merge viafb_update_viafb_par. This removes a lot of duplicated
data in viafb_par. Use the relevant data of fb_info instead. On the way
it removes an inconsistency in handling a second framebuffer which only
worked because viafbinfo1->par is modified to point to the same viafb_par
as viafbinfo->par.
Code cleanup only, no runtime change expected.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Scott Fang <ScottFang@viatech.com.cn>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Harald Welte <laforge@gnumonks.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r-- | drivers/video/via/viafbdev.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 72833f3334b5..6612ddc2dcd9 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -100,21 +100,17 @@ static const struct viafb_modeinfo viafb_modentry[] = { | |||
100 | 100 | ||
101 | static struct fb_ops viafb_ops; | 101 | static struct fb_ops viafb_ops; |
102 | 102 | ||
103 | static int viafb_update_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | ||
104 | { | ||
105 | struct viafb_par *ppar; | ||
106 | ppar = info->par; | ||
107 | |||
108 | DEBUG_MSG(KERN_INFO "viafb_update_fix!\n"); | ||
109 | 103 | ||
110 | fix->visual = | 104 | static void viafb_update_fix(struct fb_info *info) |
111 | ppar->bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | 105 | { |
112 | fix->line_length = ppar->linelength; | 106 | u32 bpp = info->var.bits_per_pixel; |
113 | 107 | ||
114 | return 0; | 108 | info->fix.visual = |
109 | bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | ||
110 | info->fix.line_length = | ||
111 | ((info->var.xres_virtual + 7) & ~7) * bpp / 8; | ||
115 | } | 112 | } |
116 | 113 | ||
117 | |||
118 | static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, | 114 | static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, |
119 | struct viafb_par *viaparinfo) | 115 | struct viafb_par *viaparinfo) |
120 | { | 116 | { |
@@ -147,19 +143,6 @@ static int viafb_release(struct fb_info *info, int user) | |||
147 | return 0; | 143 | return 0; |
148 | } | 144 | } |
149 | 145 | ||
150 | static void viafb_update_viafb_par(struct fb_info *info) | ||
151 | { | ||
152 | struct viafb_par *ppar; | ||
153 | |||
154 | ppar = info->par; | ||
155 | ppar->bpp = info->var.bits_per_pixel; | ||
156 | ppar->linelength = ((info->var.xres_virtual + 7) & ~7) * ppar->bpp / 8; | ||
157 | ppar->hres = info->var.xres; | ||
158 | ppar->vres = info->var.yres; | ||
159 | ppar->xoffset = info->var.xoffset; | ||
160 | ppar->yoffset = info->var.yoffset; | ||
161 | } | ||
162 | |||
163 | static int viafb_check_var(struct fb_var_screeninfo *var, | 146 | static int viafb_check_var(struct fb_var_screeninfo *var, |
164 | struct fb_info *info) | 147 | struct fb_info *info) |
165 | { | 148 | { |
@@ -255,12 +238,7 @@ static int viafb_set_par(struct fb_info *info) | |||
255 | /*We should set memory offset according virtual_x */ | 238 | /*We should set memory offset according virtual_x */ |
256 | /*Fix me:put this function into viafb_setmode */ | 239 | /*Fix me:put this function into viafb_setmode */ |
257 | viafb_memory_pitch_patch(info); | 240 | viafb_memory_pitch_patch(info); |
258 | 241 | viafb_update_fix(info); | |
259 | /* Update ***fb_par information */ | ||
260 | viafb_update_viafb_par(info); | ||
261 | |||
262 | /* Update other fixed information */ | ||
263 | viafb_update_fix(&info->fix, info); | ||
264 | viafb_bpp = info->var.bits_per_pixel; | 242 | viafb_bpp = info->var.bits_per_pixel; |
265 | /* Update viafb_accel, it is necessary to our 2D accelerate */ | 243 | /* Update viafb_accel, it is necessary to our 2D accelerate */ |
266 | viafb_accel = info->var.accel_flags; | 244 | viafb_accel = info->var.accel_flags; |
@@ -2323,15 +2301,13 @@ static int __devinit via_pci_probe(void) | |||
2323 | viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); | 2301 | viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); |
2324 | viafb_check_var(&default_var, viafbinfo1); | 2302 | viafb_check_var(&default_var, viafbinfo1); |
2325 | viafbinfo1->var = default_var; | 2303 | viafbinfo1->var = default_var; |
2326 | viafb_update_viafb_par(viafbinfo); | 2304 | viafb_update_fix(viafbinfo1); |
2327 | viafb_update_fix(&viafbinfo1->fix, viafbinfo1); | ||
2328 | } | 2305 | } |
2329 | 2306 | ||
2330 | viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); | 2307 | viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); |
2331 | viafb_check_var(&default_var, viafbinfo); | 2308 | viafb_check_var(&default_var, viafbinfo); |
2332 | viafbinfo->var = default_var; | 2309 | viafbinfo->var = default_var; |
2333 | viafb_update_viafb_par(viafbinfo); | 2310 | viafb_update_fix(viafbinfo); |
2334 | viafb_update_fix(&viafbinfo->fix, viafbinfo); | ||
2335 | default_var.activate = FB_ACTIVATE_NOW; | 2311 | default_var.activate = FB_ACTIVATE_NOW; |
2336 | fb_alloc_cmap(&viafbinfo->cmap, 256, 0); | 2312 | fb_alloc_cmap(&viafbinfo->cmap, 256, 0); |
2337 | 2313 | ||