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 <jgarzik@redhat.com>
return status;
}
-/* as this ports irq handling is already done, we use a generic funktion */
-static irqreturn_t amiga_interrupt(int irq, void *dev_id)
-{
- parport_generic_irq(irq, (struct parport *) dev_id);
- return IRQ_HANDLED;
-}
-
static void amiga_enable_irq(struct parport *p)
{
enable_irq(IRQ_AMIGA_CIAA_FLG);
if (!p)
goto out_port;
- err = request_irq(IRQ_AMIGA_CIAA_FLG, amiga_interrupt, 0, p->name, p);
+ err = request_irq(IRQ_AMIGA_CIAA_FLG, parport_irq_handler, 0, p->name, p);
if (err)
goto out_irq;
{
}
-static irqreturn_t
-parport_atari_interrupt(int irq, void *dev_id)
-{
- parport_generic_irq(irq, (struct parport *) dev_id);
- return IRQ_HANDLED;
-}
-
static void
parport_atari_enable_irq(struct parport *p)
{
&parport_atari_ops);
if (!p)
return -ENODEV;
- if (request_irq(IRQ_MFP_BUSY, parport_atari_interrupt,
+ if (request_irq(IRQ_MFP_BUSY, parport_irq_handler,
IRQ_TYPE_SLOW, p->name, p)) {
parport_put_port (p);
return -ENODEV;
writeb(s->u.ax88796.cpr, dd->spp_cpr);
}
-static irqreturn_t
-parport_ax88796_interrupt(int irq, void *dev_id)
-{
- parport_generic_irq(irq, dev_id);
- return IRQ_HANDLED;
-}
-
-
static struct parport_operations parport_ax88796_ops = {
.write_data = parport_ax88796_write_data,
.read_data = parport_ax88796_read_data,
if (irq >= 0) {
/* request irq */
- ret = request_irq(irq, parport_ax88796_interrupt,
+ ret = request_irq(irq, parport_irq_handler,
IRQF_TRIGGER_FALLING, pdev->name, pp);
if (ret < 0)
* of these are in parport_gsc.h.
*/
-static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id)
-{
- parport_generic_irq(irq, (struct parport *) dev_id);
- return IRQ_HANDLED;
-}
-
void parport_gsc_init_state(struct pardevice *dev, struct parport_state *s)
{
s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0);
printk("]\n");
if (p->irq != PARPORT_IRQ_NONE) {
- if (request_irq (p->irq, parport_gsc_interrupt,
+ if (request_irq (p->irq, parport_irq_handler,
0, p->name, p)) {
printk (KERN_WARNING "%s: irq %d in use, "
"resorting to polled operation\n",
struct parport * const p = dev_id;
struct parport_ip32_private * const priv = p->physport->private_data;
enum parport_ip32_irq_mode irq_mode = priv->irq_mode;
+
switch (irq_mode) {
case PARPORT_IP32_IRQ_FWD:
- parport_generic_irq(irq, p);
- break;
+ return parport_irq_handler(irq, dev_id);
+
case PARPORT_IP32_IRQ_HERE:
parport_ip32_wakeup(p);
break;
}
+
return IRQ_HANDLED;
}
* of these are in parport_pc.h.
*/
-static irqreturn_t parport_pc_interrupt(int irq, void *dev_id)
-{
- parport_generic_irq(irq, (struct parport *) dev_id);
- /* FIXME! Was it really ours? */
- return IRQ_HANDLED;
-}
-
static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
{
s->u.pc.ctr = 0xc;
EPP_res = NULL;
}
if (p->irq != PARPORT_IRQ_NONE) {
- if (request_irq (p->irq, parport_pc_interrupt,
+ if (request_irq (p->irq, parport_irq_handler,
0, p->name, p)) {
printk (KERN_WARNING "%s: irq %d in use, "
"resorting to polled operation\n",
#define dprintk(x)
#endif
-static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id)
-{
- parport_generic_irq(irq, (struct parport *) dev_id);
- return IRQ_HANDLED;
-}
-
static void parport_sunbpp_disable_irq(struct parport *p)
{
struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
p->size = size;
p->dev = &sdev->ofdev.dev;
- if ((err = request_irq(p->irq, parport_sunbpp_interrupt,
+ if ((err = request_irq(p->irq, parport_irq_handler,
IRQF_SHARED, p->name, p)) != 0) {
goto out_put_port;
}
}
}
+irqreturn_t parport_irq_handler(int irq, void *dev_id)
+{
+ struct parport *port = dev_id;
+
+ parport_generic_irq(irq, port);
+
+ return IRQ_HANDLED;
+}
+
/* Exported symbols for modules. */
EXPORT_SYMBOL(parport_claim);
EXPORT_SYMBOL(parport_put_port);
EXPORT_SYMBOL(parport_find_number);
EXPORT_SYMBOL(parport_find_base);
+EXPORT_SYMBOL(parport_irq_handler);
MODULE_LICENSE("GPL");
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
+#include <linux/irqreturn.h>
#include <asm/system.h>
#include <asm/ptrace.h>
#include <asm/semaphore.h>
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 *);
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);