Re: [PATCH] unexpected IO-APIC update

Randy.Dunlap (rddunlap@osdl.org)
Wed, 25 Jun 2003 08:57:14 -0700


On Tue, 24 Jun 2003 18:31:12 -0700 (PDT) Linus Torvalds <torvalds@transmeta.com> wrote:

|
| On Tue, 24 Jun 2003, Randy.Dunlap wrote:
| >
| > + if (reg_01.version >= 0x20)
| > + *(int *)&reg_03 = io_apic_read(apic, 3);
|
| There's a lot of these
|
| *(int *)&reg_03
|
| kinds of things there, and the fact is, gcc's alias analysis doesn't like
| them, _and_ they are ugly.
|
[snippage]
|
| But the ugliness part I care about, and I wonder if it wouldn't be better
| in this case to just make the register definition a "union", and have
| something like
|
| union reg_03 {
| u32 value;
| struct {
| u32 boot_DT:1,
| reserved:31;
| } bits;
| };
|
| and then you can avoid the ugly dereference/cast/address-of thing, and
| just say
|
| reg_03.value
|
| or
|
| reg_03.bits.boot_DT
|
| which looks a lot cleaner.
|
| This is what unions are _designed_ for.

Sure, I'll do that.

--
~Randy
~ http://developer.osdl.org/rddunlap/ ~ http://www.xenotime.net/linux/ ~
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/