diff options
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/TODO-parport | 11 | ||||
-rw-r--r-- | drivers/misc/parport_procfs.c | 33 | ||||
-rw-r--r-- | drivers/misc/parport_share.c | 10 |
3 files changed, 22 insertions, 32 deletions
diff --git a/drivers/misc/TODO-parport b/drivers/misc/TODO-parport index 08860cc27..523a1ca94 100644 --- a/drivers/misc/TODO-parport +++ b/drivers/misc/TODO-parport @@ -6,20 +6,13 @@ Things to be done. 2. A better lp.c: - a) It's a _mess_ - - b) ECP support would be nice. This can only work if both the port and + a) ECP support would be nice. This can only work if both the port and the printer support it. - c) Errors could do with being handled better. There's no point logging a - message every 10 seconds when the printer is out of paper. - - d) Handle status readback automatically. IEEE1284 printers can post status + b) Handle status readback automatically. IEEE1284 printers can post status bits when they have something to say. We should read out and deal with (maybe just log) whatever the printer wants to tell the world. 3. Support more hardware (eg m68k, Sun bpp). 4. A better PLIP (make use of bidirectional/ECP/EPP ports). - - diff --git a/drivers/misc/parport_procfs.c b/drivers/misc/parport_procfs.c index 97717448c..a3f40e9f4 100644 --- a/drivers/misc/parport_procfs.c +++ b/drivers/misc/parport_procfs.c @@ -37,8 +37,8 @@ static int irq_write_proc(struct file *file, const char *buffer, int retval = -EINVAL; int newirq = PARPORT_IRQ_NONE; struct parport *pp = (struct parport *)data; - struct pardevice *cad = pp->cad; int oldirq = pp->irq; + unsigned long flags; /* * We can have these valid cases: @@ -70,36 +70,31 @@ static int irq_write_proc(struct file *file, const char *buffer, if (oldirq == newirq) goto out; + spin_lock_irqsave(&pp->lock, flags); if (pp->flags & PARPORT_FLAG_COMA) goto out_ok; - if (newirq != PARPORT_IRQ_NONE) { - void (*handler)(int, void *, struct pt_regs *); - - if (cad && cad->irq_func) - handler = cad->irq_func; - else - handler = parport_null_intr_func; + retval = -EBUSY; + if (pp->cad) + goto out_unlock; - retval = request_irq(newirq, handler, - SA_INTERRUPT, - cad ? cad->name : pp->name, - cad ? cad->private : NULL); + if (newirq != PARPORT_IRQ_NONE) { + retval = request_irq(newirq, parport_null_intr_func, + SA_INTERRUPT, pp->name, NULL); if (retval) - goto out; + goto out_unlock; else retval = count; } - if (oldirq != PARPORT_IRQ_NONE) { - if (cad && cad->irq_func) - free_irq(oldirq, cad->private); - else - free_irq(oldirq, NULL); - } + if (oldirq != PARPORT_IRQ_NONE) + free_irq(oldirq, NULL); out_ok: pp->irq = newirq; +out_unlock: + spin_unlock_irqrestore (&pp->lock, flags); + out: return retval; } diff --git a/drivers/misc/parport_share.c b/drivers/misc/parport_share.c index 7da49fae4..be53e2ba6 100644 --- a/drivers/misc/parport_share.c +++ b/drivers/misc/parport_share.c @@ -1,4 +1,5 @@ -/* $Id: parport_share.c,v 1.14 1998/05/04 19:05:05 ralf Exp $ +/* $Id: parport_share.c,v 1.9 1998/05/07 02:59:59 ralf Exp $ + * * Parallel-port resource manager code. * * Authors: David Campbell <campbell@tirian.che.curtin.edu.au> @@ -308,7 +309,9 @@ try_again: } /* Now we do the change of devices */ + spin_lock_irqsave(&port->lock, flags); port->cad = dev; + spin_unlock_irqrestore(&port->lock, flags); /* Swap the IRQ handlers. */ if (port->irq != PARPORT_IRQ_NONE) { @@ -346,9 +349,8 @@ blocked: dev->waitprev = port->waittail; if (port->waittail) port->waittail->waitnext = dev; - else { - port->waithead = dev->port->waittail = dev; - } + else + port->waithead = port->waittail = dev; } spin_unlock_irqrestore (&port->lock, flags); } |