patch-2.1.100 linux/drivers/misc/parport_procfs.c
Next file: linux/drivers/misc/parport_share.c
Previous file: linux/drivers/misc/TODO-parport
Back to the patch index
Back to the overall index
- Lines: 59
- Date:
Tue May 5 10:44:06 1998
- Orig file:
v2.1.99/linux/drivers/misc/parport_procfs.c
- Orig date:
Sat Apr 25 18:13:11 1998
diff -u --recursive --new-file v2.1.99/linux/drivers/misc/parport_procfs.c linux/drivers/misc/parport_procfs.c
@@ -37,8 +37,8 @@
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,35 +70,30 @@
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 *);
+ retval = -EBUSY;
+ if (pp->cad)
+ goto out_unlock;
- if (cad && cad->irq_func)
- handler = cad->irq_func;
- else
- handler = parport_null_intr_func;
-
- 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;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov