From c0177fe9eaf4935c42ff04500583738d0f8824c3 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 20 Apr 2003 20:32:35 -0700 Subject: [PATCH] [PATCH] irqs: hotplug drivers Update hotplug and pcmcia drivers to the new IRQ API. --- drivers/hotplug/cpci_hotplug_core.c | 5 +++-- drivers/hotplug/cpqphp.h | 3 ++- drivers/hotplug/cpqphp_core.c | 3 +-- drivers/hotplug/cpqphp_ctrl.c | 7 ++++--- drivers/pcmcia/i82092.c | 10 +++++++--- drivers/pcmcia/i82092aa.h | 4 +++- drivers/pcmcia/i82365.c | 17 ++++++++--------- drivers/pcmcia/tcic.c | 11 ++++++----- 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/drivers/hotplug/cpci_hotplug_core.c b/drivers/hotplug/cpci_hotplug_core.c index e8981f780b629..d1f99032c56da 100644 --- a/drivers/hotplug/cpci_hotplug_core.c +++ b/drivers/hotplug/cpci_hotplug_core.c @@ -446,7 +446,7 @@ cpci_find_slot(struct pci_bus *bus, unsigned int devfn) } /* This is the interrupt mode interrupt handler */ -void +irqreturn_t cpci_hp_intr(int irq, void *data, struct pt_regs *regs) { dbg("entered cpci_hp_intr"); @@ -455,7 +455,7 @@ cpci_hp_intr(int irq, void *data, struct pt_regs *regs) if((controller->irq_flags & SA_SHIRQ) && !controller->ops->check_irq(controller->dev_id)) { dbg("exited cpci_hp_intr, not our interrupt"); - return; + return IRQ_NONE; } /* Disable ENUM interrupt */ @@ -465,6 +465,7 @@ cpci_hp_intr(int irq, void *data, struct pt_regs *regs) dbg("Signal event_semaphore"); up(&event_semaphore); dbg("exited cpci_hp_intr"); + return IRQ_HANDLED; } /* diff --git a/drivers/hotplug/cpqphp.h b/drivers/hotplug/cpqphp.h index f44704f388844..758efd88411e0 100644 --- a/drivers/hotplug/cpqphp.h +++ b/drivers/hotplug/cpqphp.h @@ -29,6 +29,7 @@ #define _CPQPHP_H #include "pci_hotplug.h" +#include #include /* for read? and write? functions */ @@ -408,7 +409,7 @@ extern void cpqhp_create_ctrl_files (struct controller *ctrl); /* controller functions */ extern void cpqhp_pushbutton_thread (unsigned long event_pointer); -extern void cpqhp_ctrl_intr (int IRQ, struct controller *ctrl_input, struct pt_regs *regs); +extern irqreturn_t cpqhp_ctrl_intr (int IRQ, void *data, struct pt_regs *regs); extern int cpqhp_find_available_resources (struct controller *ctrl, void *rom_start); extern int cpqhp_event_start_thread (void); extern void cpqhp_event_stop_thread (void); diff --git a/drivers/hotplug/cpqphp_core.c b/drivers/hotplug/cpqphp_core.c index 2555d43eeb946..af9f62e63e470 100644 --- a/drivers/hotplug/cpqphp_core.c +++ b/drivers/hotplug/cpqphp_core.c @@ -1148,8 +1148,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* set up the interrupt */ dbg("HPC interrupt = %d \n", ctrl->interrupt); - if (request_irq(ctrl->interrupt, - (void (*)(int, void *, struct pt_regs *)) &cpqhp_ctrl_intr, + if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, SA_SHIRQ, MY_NAME, ctrl)) { err("Can't get irq %d for the hotplug pci controller\n", ctrl->interrupt); rc = -ENODEV; diff --git a/drivers/hotplug/cpqphp_ctrl.c b/drivers/hotplug/cpqphp_ctrl.c index b9a8432487f44..ba6b48bd8895b 100644 --- a/drivers/hotplug/cpqphp_ctrl.c +++ b/drivers/hotplug/cpqphp_ctrl.c @@ -916,8 +916,9 @@ int cpqhp_resource_sort_and_combine(struct pci_resource **head) } -void cpqhp_ctrl_intr(int IRQ, struct controller * ctrl, struct pt_regs *regs) +irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data, struct pt_regs *regs) { + struct controller *ctrl = data; u8 schedule_flag = 0; u16 misc; u32 Diff; @@ -929,7 +930,7 @@ void cpqhp_ctrl_intr(int IRQ, struct controller * ctrl, struct pt_regs *regs) // Check to see if it was our interrupt //********************************* if (!(misc & 0x000C)) { - return; + return IRQ_NONE; } if (misc & 0x0004) { @@ -974,7 +975,7 @@ void cpqhp_ctrl_intr(int IRQ, struct controller * ctrl, struct pt_regs *regs) up(&event_semaphore); dbg("Signal event_semaphore\n"); } - + return IRQ_HANDLED; } diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index 7bbe2e2b6e172..266b349ff609a 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -219,6 +219,7 @@ static unsigned char indirect_read(int socket, unsigned short reg) return val; } +#if 0 static unsigned short indirect_read16(int socket, unsigned short reg) { unsigned short int port; @@ -235,6 +236,7 @@ static unsigned short indirect_read16(int socket, unsigned short reg) spin_unlock_irqrestore(&port_lock,flags); return tmp; } +#endif static void indirect_write(int socket, unsigned short reg, unsigned char value) { @@ -334,11 +336,12 @@ static void i82092aa_bh(void *dummy) static DECLARE_WORK(i82092aa_task, i82092aa_bh, NULL); -static void i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs) +static irqreturn_t i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs) { int i; int loopcount = 0; - + int handled = 0; + unsigned int events, active=0; /* enter("i82092aa_interrupt");*/ @@ -362,6 +365,7 @@ static void i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs) if ((csc==0) || /* no events on this socket */ (sockets[i].handler==NULL)) /* no way to handle events */ continue; + handled = 1; events = 0; if (csc & I365_CSC_DETECT) { @@ -390,7 +394,7 @@ static void i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs) break; } - + return IRQ_RETVAL(handled); /* leave("i82092aa_interrupt");*/ } diff --git a/drivers/pcmcia/i82092aa.h b/drivers/pcmcia/i82092aa.h index dc56daec6bb90..191a3bd920971 100644 --- a/drivers/pcmcia/i82092aa.h +++ b/drivers/pcmcia/i82092aa.h @@ -1,6 +1,8 @@ #ifndef _INCLUDE_GUARD_i82092aa_H_ #define _INCLUDE_GUARD_i82092aa_H_ +#include + /* $Id: i82092aa.h,v 1.1.1.1 2001/09/19 14:53:15 dwmw2 Exp $ */ /* Debuging defines */ @@ -21,7 +23,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id); static void i82092aa_pci_remove(struct pci_dev *dev); static int card_present(int socketno); -static void i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs); +static irqreturn_t i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs); diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index d93b2410f3ac5..df519fe22f36b 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -78,7 +78,7 @@ static const char *version = #define DEBUG(n, args...) do { } while (0) #endif -static void i365_count_irq(int, void *, struct pt_regs *); +static irqreturn_t i365_count_irq(int, void *, struct pt_regs *); static inline int _check_irq(int irq, int flags) { if (request_irq(irq, i365_count_irq, flags, "x", i365_count_irq) != 0) @@ -535,11 +535,12 @@ static u_int __init set_bridge_opts(u_short s, u_short ns) static volatile u_int irq_hits; static u_short irq_sock; -static void i365_count_irq(int irq, void *dev, struct pt_regs *regs) +static irqreturn_t i365_count_irq(int irq, void *dev, struct pt_regs *regs) { i365_get(irq_sock, I365_CSC); irq_hits++; DEBUG(2, "-> hit on irq %d\n", irq); + return IRQ_HANDLED; } static u_int __init test_irq(u_short sock, int irq) @@ -627,11 +628,6 @@ static int to_cycles(int ns) return ns/cycle_time; } -static int to_ns(int cycles) -{ - return cycle_time*cycles; -} - /*====================================================================*/ #ifdef CONFIG_ISA @@ -939,7 +935,7 @@ static DECLARE_WORK(pcic_task, pcic_bh, NULL); static unsigned long last_detect_jiffies; -static void pcic_interrupt(int irq, void *dev, +static irqreturn_t pcic_interrupt(int irq, void *dev, struct pt_regs *regs) { int i, j, csc; @@ -947,7 +943,8 @@ static void pcic_interrupt(int irq, void *dev, #ifdef CONFIG_ISA u_long flags = 0; #endif - + int handled = 0; + DEBUG(4, "i82365: pcic_interrupt(%d)\n", irq); for (j = 0; j < 20; j++) { @@ -956,6 +953,7 @@ static void pcic_interrupt(int irq, void *dev, if ((socket[i].cs_irq != irq) && (socket[i].cap.pci_irq != irq)) continue; + handled = 1; ISA_LOCK(i, flags); csc = i365_get(i, I365_CSC); if ((csc == 0) || (!socket[i].handler) || @@ -1002,6 +1000,7 @@ static void pcic_interrupt(int irq, void *dev, printk(KERN_NOTICE "i82365: infinite loop in interrupt handler\n"); DEBUG(4, "i82365: interrupt done\n"); + return IRQ_RETVAL(handled); } /* pcic_interrupt */ static void pcic_interrupt_wrapper(u_long data) diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index d664c1da5effb..4663ca38c1b92 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -111,7 +111,7 @@ MODULE_PARM(cycle_time, "i"); /*====================================================================*/ -static void tcic_interrupt(int irq, void *dev, struct pt_regs *regs); +static irqreturn_t tcic_interrupt(int irq, void *dev, struct pt_regs *regs); static void tcic_timer(u_long data); static struct pccard_operations tcic_operations; @@ -229,9 +229,10 @@ static int to_cycles(int ns) static volatile u_int irq_hits; -static void __init tcic_irq_count(int irq, void *dev, struct pt_regs *regs) +static irqreturn_t __init tcic_irq_count(int irq, void *dev, struct pt_regs *regs) { irq_hits++; + return IRQ_HANDLED; } static u_int __init try_irq(int irq) @@ -565,7 +566,7 @@ static void tcic_bh(void *dummy) static DECLARE_WORK(tcic_task, tcic_bh, NULL); -static void tcic_interrupt(int irq, void *dev, struct pt_regs *regs) +static irqreturn_t tcic_interrupt(int irq, void *dev, struct pt_regs *regs) { int i, quick = 0; u_char latch, sstat; @@ -575,7 +576,7 @@ static void tcic_interrupt(int irq, void *dev, struct pt_regs *regs) if (active) { printk(KERN_NOTICE "tcic: reentered interrupt handler!\n"); - return; + return IRQ_NONE; } else active = 1; @@ -620,7 +621,7 @@ static void tcic_interrupt(int irq, void *dev, struct pt_regs *regs) active = 0; DEBUG(2, "tcic: interrupt done\n"); - + return IRQ_HANDLED; } /* tcic_interrupt */ static void tcic_timer(u_long data) -- 2.53.0