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

Michael L. Galbraith (mikeg@weiden.de)
Sun, 12 Jul 1998 10:02:27 +0200 (MET DST)


On Sun, 12 Jul 1998 sinster@darkwater.com wrote:

> 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?
>
> One common trick with memory-mapped device programming is to define a
> structure that aligns with the control registers of the device, and
> then to access the device through that structure. 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).
>
> This could (hypothetically: I know nothing about the apricot) be what
> the author was trying to do, though if so then this code is broken
> anyway. It should've been something more along the lines of:
> register int hold;
> while ((hold = lp->scb.status), lp->scb.command);

Is this method not also broken? IIRC, there is no defined order of
evaluation for ','.

-Mike

-
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