mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: jsimmons@infradead.org, arief_m_utama@telkomsel.co.id,
	linux-kernel@vger.kernel.org
Subject: Re: Radeon Framebuffer Driver in 2.6.3?
Date: Mon, 1 Mar 2004 19:08:16 -0800	[thread overview]
Message-ID: <20040301190816.5ed4e241.pj@sgi.com> (raw)
In-Reply-To: <1078187189.21575.165.camel@gaston>

 > 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@sgi.com> 1.650.933.1373

  reply	other threads:[~2004-03-02  3:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27  6:27 arief#
2004-02-27  7:04 ` Benjamin Herrenschmidt
2004-02-27 10:06   ` arief#
2004-02-27  9:56     ` Benjamin Herrenschmidt
2004-02-27 10:45       ` Zilvinas Valinskas
2004-02-27 17:19   ` Mike Houston
2004-02-27 18:00   ` James Simmons
2004-02-27 22:43     ` Benjamin Herrenschmidt
2004-02-28  0:58       ` James Simmons
2004-02-28  1:37         ` Benjamin Herrenschmidt
2004-03-02  0:22           ` James Simmons
2004-03-02  0:26             ` Benjamin Herrenschmidt
2004-03-02  3:08               ` Paul Jackson [this message]
2004-03-02  7:50                 ` Paul Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040301190816.5ed4e241.pj@sgi.com \
    --to=pj@sgi.com \
    --cc=arief_m_utama@telkomsel.co.id \
    --cc=benh@kernel.crashing.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®