From 3f2e40df0e1d7694224c3083b0bebd129039a40a Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 19 Oct 2007 01:42:14 -0400 Subject: [PARPORT] Consolidate code copies into a single generic irq handler Several arches used the exact same code for their parport irq handling. Make that code generic, in parport_irq_handler(). Also, s/__inline__/inline/ in include/linux/parport.h. Signed-off-by: Jeff Garzik --- include/linux/parport.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/parport.h b/include/linux/parport.h index ec3f7659832..66026eab10c 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -100,6 +100,7 @@ typedef enum { #include #include #include +#include #include #include #include @@ -366,6 +367,9 @@ extern void parport_unregister_driver (struct parport_driver *); extern struct parport *parport_find_number (int); extern struct parport *parport_find_base (unsigned long); +/* generic irq handler, if it suits your needs */ +extern irqreturn_t parport_irq_handler(int irq, void *dev_id); + /* Reference counting for ports. */ extern struct parport *parport_get_port (struct parport *); extern void parport_put_port (struct parport *); @@ -514,7 +518,7 @@ extern void parport_daisy_deselect_all (struct parport *port); extern int parport_daisy_select (struct parport *port, int daisy, int mode); /* Lowlevel drivers _can_ call this support function to handle irqs. */ -static __inline__ void parport_generic_irq(int irq, struct parport *port) +static inline void parport_generic_irq(int irq, struct parport *port) { parport_ieee1284_interrupt (irq, port); read_lock(&port->cad_lock); -- cgit v1.2.3 From f230d1010ad0dcd71d9ca8ea6864afac49c5aa9b Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 19 Oct 2007 01:56:02 -0400 Subject: [PARPORT] Kill useful 'irq' arg from parport_{generic_irq,ieee1284_interrupt} parport_ieee1284_interrupt() was not using its first arg at all. Delete. parport_generic_irq()'s second arg makes its first arg completely redundant. Delete, and use port->irq in the one place where we actually need it. Also, s/__inline__/inline/ to make the code look nicer. Signed-off-by: Jeff Garzik --- include/linux/parport.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/parport.h b/include/linux/parport.h index 66026eab10c..557c37de1f3 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -465,7 +465,7 @@ static __inline__ int parport_yield_blocking(struct pardevice *dev) #define PARPORT_FLAG_EXCL (1<<1) /* EXCL driver registered. */ /* IEEE1284 functions */ -extern void parport_ieee1284_interrupt (int, void *); +extern void parport_ieee1284_interrupt (void *); extern int parport_negotiate (struct parport *, int mode); extern ssize_t parport_write (struct parport *, const void *buf, size_t len); extern ssize_t parport_read (struct parport *, void *buf, size_t len); @@ -518,12 +518,12 @@ extern void parport_daisy_deselect_all (struct parport *port); extern int parport_daisy_select (struct parport *port, int daisy, int mode); /* Lowlevel drivers _can_ call this support function to handle irqs. */ -static inline void parport_generic_irq(int irq, struct parport *port) +static inline void parport_generic_irq(struct parport *port) { - parport_ieee1284_interrupt (irq, port); + parport_ieee1284_interrupt (port); read_lock(&port->cad_lock); if (port->cad && port->cad->irq_func) - port->cad->irq_func(irq, port->cad->private); + port->cad->irq_func(port->irq, port->cad->private); read_unlock(&port->cad_lock); } -- cgit v1.2.3 From 5712cb3d81566893c3b14e24075cf48ec5c35d00 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 19 Oct 2007 02:54:26 -0400 Subject: [PARPORT] Remove unused 'irq' argument from parport irq functions None of the drivers with a struct pardevice's ->irq_func() hook ever used the 'irq' argument passed to it, so remove it. Signed-off-by: Jeff Garzik --- include/linux/parport.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/linux/parport.h b/include/linux/parport.h index 557c37de1f3..d1ad546c8c9 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -230,7 +230,7 @@ struct pardevice { int (*preempt)(void *); void (*wakeup)(void *); void *private; - void (*irq_func)(int, void *); + void (*irq_func)(void *); unsigned int flags; struct pardevice *next; struct pardevice *prev; @@ -383,7 +383,7 @@ extern void parport_put_port (struct parport *); struct pardevice *parport_register_device(struct parport *port, const char *name, int (*pf)(void *), void (*kf)(void *), - void (*irq_func)(int, void *), + void (*irq_func)(void *), int flags, void *handle); /* parport_unregister unlinks a device from the chain. */ @@ -507,11 +507,7 @@ extern size_t parport_ieee1284_epp_read_addr (struct parport *, /* IEEE1284.3 functions */ extern int parport_daisy_init (struct parport *port); extern void parport_daisy_fini (struct parport *port); -extern struct pardevice *parport_open (int devnum, const char *name, - int (*pf) (void *), - void (*kf) (void *), - void (*irqf) (int, void *), - int flags, void *handle); +extern struct pardevice *parport_open (int devnum, const char *name); extern void parport_close (struct pardevice *dev); extern ssize_t parport_device_id (int devnum, char *buffer, size_t len); extern void parport_daisy_deselect_all (struct parport *port); @@ -523,7 +519,7 @@ static inline void parport_generic_irq(struct parport *port) parport_ieee1284_interrupt (port); read_lock(&port->cad_lock); if (port->cad && port->cad->irq_func) - port->cad->irq_func(port->irq, port->cad->private); + port->cad->irq_func(port->cad->private); read_unlock(&port->cad_lock); } -- cgit v1.2.3