Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 296539 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/video/modedb.c (-7 / +12 lines)
Lines 29-34 Link Here
29
#define DPRINTK(fmt, args...)
29
#define DPRINTK(fmt, args...)
30
#endif
30
#endif
31
31
32
#define absint(x) ({				\
33
		int __x = (x);			\
34
		(__x < 0) ? -__x : __x;		\
35
	})
36
32
const char *fb_mode_option;
37
const char *fb_mode_option;
33
EXPORT_SYMBOL_GPL(fb_mode_option);
38
EXPORT_SYMBOL_GPL(fb_mode_option);
34
39
Lines 636-643 done: Link Here
636
			if (refresh_specified && db[i].refresh == refresh) {
641
			if (refresh_specified && db[i].refresh == refresh) {
637
				return 1;
642
				return 1;
638
			} else {
643
			} else {
639
				if (abs(db[i].refresh - refresh) < diff) {
644
				if (absint(db[i].refresh - refresh) < diff) {
640
					diff = abs(db[i].refresh - refresh);
645
					diff = absint(db[i].refresh - refresh);
641
					best = i;
646
					best = i;
642
				}
647
				}
643
			}
648
			}
Lines 654-661 done: Link Here
654
	for (i = 0; i < dbsize; i++) {
659
	for (i = 0; i < dbsize; i++) {
655
		DPRINTK("Trying %ix%i\n", db[i].xres, db[i].yres);
660
		DPRINTK("Trying %ix%i\n", db[i].xres, db[i].yres);
656
		if (!fb_try_mode(var, info, &db[i], bpp)) {
661
		if (!fb_try_mode(var, info, &db[i], bpp)) {
657
			tdiff = abs(db[i].xres - xres) +
662
			tdiff = absint(db[i].xres - xres) +
658
				abs(db[i].yres - yres);
663
				absint(db[i].yres - yres);
659
664
660
			/*
665
			/*
661
			 * Penalize modes with resolutions smaller
666
			 * Penalize modes with resolutions smaller
Lines 851-863 const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode, Link Here
851
		modelist = list_entry(pos, struct fb_modelist, list);
856
		modelist = list_entry(pos, struct fb_modelist, list);
852
		cmode = &modelist->mode;
857
		cmode = &modelist->mode;
853
858
854
		d = abs(cmode->xres - mode->xres) +
859
		d = absint(cmode->xres - mode->xres) +
855
			abs(cmode->yres - mode->yres);
860
			absint(cmode->yres - mode->yres);
856
		if (diff > d) {
861
		if (diff > d) {
857
			diff = d;
862
			diff = d;
858
			best = cmode;
863
			best = cmode;
859
		} else if (diff == d) {
864
		} else if (diff == d) {
860
			d = abs(cmode->refresh - mode->refresh);
865
			d = absint(cmode->refresh - mode->refresh);
861
			if (diff_refresh > d) {
866
			if (diff_refresh > d) {
862
				diff_refresh = d;
867
				diff_refresh = d;
863
				best = cmode;
868
				best = cmode;
(-)a/drivers/video/uvesafb.c (-4 / +9 lines)
Lines 29-34 Link Here
29
#endif
29
#endif
30
#include "edid.h"
30
#include "edid.h"
31
31
32
#define absint(x) ({				\
33
		int __x = (x);			\
34
		(__x < 0) ? -__x : __x;		\
35
	})
36
32
static struct cb_id uvesafb_cn_id = {
37
static struct cb_id uvesafb_cn_id = {
33
	.idx = CN_IDX_V86D,
38
	.idx = CN_IDX_V86D,
34
	.val = CN_VAL_V86D_UVESAFB
39
	.val = CN_VAL_V86D_UVESAFB
Lines 320-328 static int uvesafb_vbe_find_mode(struct uvesafb_par *par, Link Here
320
	int i, match = -1, h = 0, d = 0x7fffffff;
325
	int i, match = -1, h = 0, d = 0x7fffffff;
321
326
322
	for (i = 0; i < par->vbe_modes_cnt; i++) {
327
	for (i = 0; i < par->vbe_modes_cnt; i++) {
323
		h = abs(par->vbe_modes[i].x_res - xres) +
328
		h = absint(par->vbe_modes[i].x_res - xres) +
324
		    abs(par->vbe_modes[i].y_res - yres) +
329
		    absint(par->vbe_modes[i].y_res - yres) +
325
		    abs(depth - par->vbe_modes[i].depth);
330
		    absint(depth - par->vbe_modes[i].depth);
326
331
327
		/*
332
		/*
328
		 * We have an exact match in terms of resolution
333
		 * We have an exact match in terms of resolution
Lines 1375-1381 static int uvesafb_check_var(struct fb_var_screeninfo *var, Link Here
1375
	 * which is theoretically incorrect, but which we'll try to handle
1380
	 * which is theoretically incorrect, but which we'll try to handle
1376
	 * here.
1381
	 * here.
1377
	 */
1382
	 */
1378
	if (depth == 0 || abs(depth - var->bits_per_pixel) >= 8)
1383
	if (depth == 0 || absint(depth - var->bits_per_pixel) >= 8)
1379
		depth = var->bits_per_pixel;
1384
		depth = var->bits_per_pixel;
1380
1385
1381
	match = uvesafb_vbe_find_mode(par, var->xres, var->yres, depth,
1386
	match = uvesafb_vbe_find_mode(par, var->xres, var->yres, depth,

Return to bug 296539