[PARPORT] imm.c schedule loop

Tim Waugh (twaugh@matra.co.uk)
Fri, 25 Sep 1998 11:43:59 +0100

Hi David and everyone,

Here's a pseudo-diff against the code in question. Essentially, nothing has
changed -- it's just the way I'd write it if it were me.

The cause of the hang then, as I understand it, is that there is another
parport device driver on the port, and it is buggy. If it claims the port
on open() and doesn't release it until stop() it absolutely _must_ support
preemption, at least under the current scheme.

If it's a network driver, the idea is that it relinquishes the port and
let's another driver have a go. In the meantime, it may well miss packets.
Don't use a shared parallel-port if you want guaranteed delivery.

Now, it may very well be the case that incoming network data will confuse
other drivers. If so, perhaps the network driver ought to to the
request_region itself, to lock parport out i.e. become a 'legacy' device

At the moment, I'm not all that convinced that parport will take notice of
this properly. I'll take a look at this when I get time.

I think there should be a way of gaining exclusive access to a port, using
parport, and that would solve all of this.

Phil, what do you reckon? PARPORT_DEV_EXCL for parport_register_device?

I'd like to wait until 2.3 before doing any of this, though, because there
are workarounds. That said, if we need a PARPORT_DEV_EXCL flag, we should
define it now.


         /* Claim the bus so it remembers what we do to the control
          * registers. [ CTR and ECP ]
- if (imm_pb_claim(i))
- while (imm_hosts[i].p_busy)
- schedule(); /* We are safe to schedule here */
+ if (imm_pb_claim(i)) {
+ imm_hosts[i].p_busy = 1;
+ parport_claim_or_block (pb);
+ imm_hosts[i].p_busy = 0;
+ }

twaugh@matra.co.uk     MATRA Systems (UK) Ltd., Home Farm, Leigh Road,
                       Eastleigh, SO50 9EU  Registered in Cardiff 2642797

-- To unsubscribe, send mail to: linux-parport-request@torque.net -- -- with the single word "unsubscribe" in the body of the message. --

This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:18:23 EST