Re: Radeon Framebuffer Driver in 2.6.3?

From: Paul Jackson
Date: Mon Mar 01 2004 - 22:10:01 EST


> we have 2 choices

Hare-brained idea for 3rd choice - a pair of memcmp's, one on the early
part of struct fb_var_screeninfo before the activate field, the 2nd on
the remainder of that struct, after the activate field.

#include <stddef.h>

/*
* Compare two structs of type TYPE, except for structure member MEMBER.
* Return is < 0, 0 or > 0, just like memcmp().
*/

#define memcmp_all_but(s1, s2, TYPE, MEMBER) \
do { \
return _memcmp_all_but( \
s1, s2, sizeof(TYPE), \
offsetof(TYPE, MEMBER), \
sizeof((TYPE *)0)->MEMBER); \
} while (0)

/*
* Same as memcmp(s1, s2, n), except excludes the 'msz' bytes
* starting at 'moffset' bytes from the comparison. The 'm'
* in 'msz', and 'moffset' stands for Member of structure.
*/

int _memcmp_all_but(const void *s1, const void *s2, size_t n, moffset, msz)
{
int i;
i = memcmp(s1, s2, moffset);
if (i != 0)
return i;
return memcmp((char *)s1+moffset+msz, (char *)s2+moffset+msz, n-moffset-msz)
}

...

if ((var->activate & FB_ACTIVATE_FORCE) ||
memcmp_all_but(&info->var, var, struct fb_var_screeninfo, activate)) {

...

The above code is untried, untested, and probably insane.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/