diff options
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/parport_arc.c | 3 | ||||
-rw-r--r-- | drivers/misc/parport_init.c | 9 | ||||
-rw-r--r-- | drivers/misc/parport_pc.c | 20 | ||||
-rw-r--r-- | drivers/misc/parport_procfs.c | 9 | ||||
-rw-r--r-- | drivers/misc/parport_share.c | 35 |
5 files changed, 49 insertions, 27 deletions
diff --git a/drivers/misc/parport_arc.c b/drivers/misc/parport_arc.c index 8ceaee794..932ecab8c 100644 --- a/drivers/misc/parport_arc.c +++ b/drivers/misc/parport_arc.c @@ -1,4 +1,4 @@ -/* $Id: parport_arc.c,v 1.1 1997/07/25 01:53:12 ralf Exp $ +/* $Id: parport_arc.c,v 1.1 1997/07/29 03:59:12 ralf Exp $ * Parallel-port routines for ARC onboard hardware. * * Author: Phil Blundell <pjb27@cam.ac.uk> @@ -10,7 +10,6 @@ #include <asm/io.h> #include <asm/dma.h> -#include <linux/config.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/interrupt.h> diff --git a/drivers/misc/parport_init.c b/drivers/misc/parport_init.c index 52f3c6e33..a0f280b2f 100644 --- a/drivers/misc/parport_init.c +++ b/drivers/misc/parport_init.c @@ -1,4 +1,4 @@ -/* $Id: parport_init.c,v 1.1 1997/07/25 01:53:14 ralf Exp $ +/* $Id: parport_init.c,v 1.1 1997/07/29 03:59:13 ralf Exp $ * Parallel-port initialisation code. * * Authors: David Campbell <campbell@tirian.che.curtin.edu.au> @@ -56,6 +56,7 @@ __initfunc(void parport_setup(char *str, int *ints)) #ifdef MODULE int init_module(void) { + parport_proc_init(); return 0; } @@ -79,7 +80,8 @@ __initfunc(int parport_init(void)) { struct parport *pb; - if (io[0] == PARPORT_DISABLE) return 1; + if (io[0] == PARPORT_DISABLE) return 1; + parport_proc_init(); #ifdef CONFIG_PARPORT_PC parport_pc_init(io, irq, dma); #endif @@ -92,12 +94,15 @@ __initfunc(int parport_init(void)) EXPORT_SYMBOL(parport_claim); EXPORT_SYMBOL(parport_release); EXPORT_SYMBOL(parport_register_port); +EXPORT_SYMBOL(parport_unregister_port); EXPORT_SYMBOL(parport_quiesce); EXPORT_SYMBOL(parport_register_device); EXPORT_SYMBOL(parport_unregister_device); EXPORT_SYMBOL(parport_enumerate); EXPORT_SYMBOL(parport_ieee1284_nibble_mode_ok); EXPORT_SYMBOL(parport_wait_peripheral); +EXPORT_SYMBOL(parport_proc_register); +EXPORT_SYMBOL(parport_proc_unregister); void inc_parport_count(void) { diff --git a/drivers/misc/parport_pc.c b/drivers/misc/parport_pc.c index 925f697f6..6c6dbd033 100644 --- a/drivers/misc/parport_pc.c +++ b/drivers/misc/parport_pc.c @@ -1,4 +1,4 @@ -/* $Id: parport_pc.c,v 1.1 1997/07/25 01:53:16 ralf Exp $ +/* $Id: parport_pc.c,v 1.1 1997/07/29 03:59:13 ralf Exp $ * Parallel-port routines for PC architecture * * Authors: Phil Blundell <pjb27@cam.ac.uk> @@ -10,6 +10,7 @@ * and Philip Blundell <Philip.Blundell@pobox.com> */ +#include <linux/stddef.h> #include <linux/tasks.h> #include <asm/ptrace.h> @@ -140,7 +141,7 @@ static void pc_enable_irq(struct parport *p) static void pc_release_resources(struct parport *p) { if (p->irq != PARPORT_IRQ_NONE) - free_irq(p->irq, NULL); + free_irq(p->irq, p); release_region(p->base, p->size); if (p->modes & PARPORT_MODE_PCECR) release_region(p->base+0x400, 3); @@ -439,9 +440,10 @@ static int parport_SPP_supported(struct parport *pb) */ static int parport_ECR_present(struct parport *pb) { - int r, octr = pc_read_control(pb), oecr = pc_read_econtrol(pb); + unsigned int r, octr = pc_read_control(pb), + oecr = pc_read_econtrol(pb); - r= pc_read_control(pb); + r = pc_read_control(pb); if ((pc_read_econtrol(pb) & 0x03) == (r & 0x03)) { pc_write_control(pb, r ^ 0x03 ); /* Toggle bits 0-1 */ @@ -820,7 +822,10 @@ static int probe_one_port(unsigned long int base, int irq, int dma) } if (p->irq != PARPORT_IRQ_NONE) printk(", irq %d", p->irq); - if (p->irq != PARPORT_DMA_NONE) + if (p->dma == PARPORT_DMA_AUTO) + p->dma = (p->modes & PARPORT_MODE_PCECP)? + parport_dma_probe(p):PARPORT_DMA_NONE; + if (p->dma != PARPORT_DMA_NONE) printk(", dma %d", p->dma); printk(" ["); #define printmode(x) {if(p->modes&PARPORT_MODE_PC##x){printk("%s%s",f?",":"",#x);f++;}} @@ -835,6 +840,7 @@ static int probe_one_port(unsigned long int base, int irq, int dma) } #undef printmode printk("]\n"); + parport_proc_register(p); return 1; } @@ -868,7 +874,7 @@ MODULE_PARM(dma, "1-" __MODULE_STRING(PC_MAX_PORTS) "i"); static int init_module(void) { - return (parport_pc_init(NULL, NULL, NULL)?0:1); + return (parport_pc_init(io, irq, dma)?0:1); } static void cleanup_module(void) @@ -878,6 +884,8 @@ static void cleanup_module(void) if (p->modes & PARPORT_MODE_PCSPP) { if (!(p->flags & PARPORT_FLAG_COMA)) parport_quiesce(p); + parport_proc_unregister(p); + parport_unregister_port(p); } p = p->next; } diff --git a/drivers/misc/parport_procfs.c b/drivers/misc/parport_procfs.c index 5365c0df7..0fd03fddf 100644 --- a/drivers/misc/parport_procfs.c +++ b/drivers/misc/parport_procfs.c @@ -1,4 +1,4 @@ -/* $Id: parport_procfs.c,v 1.1 1997/07/25 01:53:18 ralf Exp $ +/* $Id: parport_procfs.c,v 1.1 1997/07/29 03:59:13 ralf Exp $ * Parallel port /proc interface code. * * Authors: David Campbell <campbell@tirian.che.curtin.edu.au> @@ -8,12 +8,12 @@ * and Philip Blundell <Philip.Blundell@pobox.com> */ +#include <linux/stddef.h> #include <linux/tasks.h> #include <asm/ptrace.h> #include <asm/io.h> #include <asm/dma.h> -#include <linux/config.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/interrupt.h> @@ -131,7 +131,10 @@ static int hardware_read_proc(char *page, char **start, off_t off, len += sprintf(page+len, "irq:\tnone\n"); else len += sprintf(page+len, "irq:\t%d\n",pp->irq); - len += sprintf(page+len, "dma:\t%d\n",pp->dma); + if (pp->dma == PARPORT_DMA_NONE) + len += sprintf(page+len, "dma:\tnone\n"); + else + len += sprintf(page+len, "dma:\t%d\n",pp->dma); #if 0 diff --git a/drivers/misc/parport_share.c b/drivers/misc/parport_share.c index 55b64e856..256cbcee6 100644 --- a/drivers/misc/parport_share.c +++ b/drivers/misc/parport_share.c @@ -1,4 +1,4 @@ -/* $Id: parport_share.c,v 1.1 1997/07/25 01:53:19 ralf Exp $ +/* $Id: parport_share.c,v 1.1 1997/07/29 03:59:13 ralf Exp $ * Parallel-port resource manager code. * * Authors: David Campbell <campbell@tirian.che.curtin.edu.au> @@ -88,6 +88,23 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma, return tmp; } +void parport_unregister_port(struct parport *port) +{ + struct parport *p; + kfree(port->name); + if (portlist == port) { + portlist = port->next; + } else { + for (p = portlist; (p != NULL) && (p->next != port); + p=p->next); + if (p) { + if ((p->next = port->next) == NULL) + portlist_tail = p; + } + } + kfree(port); +} + void parport_quiesce(struct parport *port) { if (port->devices) { @@ -106,7 +123,7 @@ void parport_quiesce(struct parport *port) } struct pardevice *parport_register_device(struct parport *port, const char *name, - int (*pf)(void *), int (*kf)(void *), + int (*pf)(void *), void (*kf)(void *), void (*irq_func)(int, void *, struct pt_regs *), int flags, void *handle) { @@ -223,7 +240,6 @@ int parport_claim(struct pardevice *dev) pd1 = dev->port->cad; if (dev->port->cad) { if (dev->port->cad->preempt) { - /* Now try to preempt */ if (dev->port->cad->preempt(dev->port->cad->private)) return -EAGAIN; dev->port->ops->save_state(dev->port, dev->state); @@ -301,19 +317,10 @@ void parport_release(struct pardevice *dev) } /* Now give the lurker a chance. - * There should be a wakeup callback because we checked for it + * There must be a wakeup callback because we checked for it * at registration. */ if (dev->port->lurker && (dev->port->lurker != dev)) { - if (dev->port->lurker->wakeup) { - dev->port->lurker->wakeup(dev->port->lurker->private); - } -#ifdef PARPORT_PARANOID - else { /* can't happen */ - printk(KERN_DEBUG - "%s (%s): lurker's wakeup callback went away!\n", - dev->port->name, dev->name); - } -#endif + dev->port->lurker->wakeup(dev->port->lurker->private); } } |