Re: Strange code in 2.0.pre35 - apricot.c

Stephen Williams (steve@icarus.com)
Wed, 15 Jul 1998 23:45:42 -0700


Sprach Ion Badulescu <ionut@moisil.cs.columbia.edu>:
[...]
> >> while (lp->scb.status, lp->scb.command)
[...]
> If it's intentional, what is it supposed to do then?

sinster@darkwater.com said:
> A lot of these devices require two reads to get status information: a
> read from one address tells the hardware to prepare the proper data at
> another address. More commonly, though, it's a write at one address
> to tell the device which data to prepare for a read at another address
> (VGA cards and many UARTs use this).

The variable needs to be declared volatile for this to work. Maybe it is.

register int hold;
do {
hold = lp->scb.status;
} while (lp->scb.command);

This is absolutely no effect. If lp->scb.status and lp->scb.command are
volatile, then it doesn't matter that there is an assign to hold.

It is this sort of thing that the egcs or gcc-2.8.1 compilers might optimize
away unless "volatile" is used correctly. This is why 2.0.X kernels don't
get along well with these later compilers.

No?

-- 
Steve Williams                "The woods are lovely, dark and deep.
steve@icarus.com              But I have promises to keep,
steve@picturel.com            and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html