irq.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. /*
  2. * arch/v850/kernel/irq.c -- High-level interrupt handling
  3. *
  4. * Copyright (C) 2001,02,03,04 NEC Electronics Corporation
  5. * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org>
  6. * Copyright (C) 1994-2000 Ralf Baechle
  7. * Copyright (C) 1992 Linus Torvalds
  8. *
  9. * This file is subject to the terms and conditions of the GNU General
  10. * Public License. See the file COPYING in the main directory of this
  11. * archive for more details.
  12. *
  13. * This file was was derived from the mips version, arch/mips/kernel/irq.c
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/irq.h>
  18. #include <linux/init.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/kernel_stat.h>
  21. #include <linux/slab.h>
  22. #include <linux/mm.h>
  23. #include <linux/random.h>
  24. #include <linux/seq_file.h>
  25. #include <asm/system.h>
  26. /*
  27. * Controller mappings for all interrupt sources:
  28. */
  29. irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
  30. [0 ... NR_IRQS-1] = {
  31. .handler = &no_irq_type,
  32. .lock = SPIN_LOCK_UNLOCKED
  33. }
  34. };
  35. /*
  36. * Special irq handlers.
  37. */
  38. irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs)
  39. {
  40. return IRQ_NONE;
  41. }
  42. /*
  43. * Generic no controller code
  44. */
  45. static void enable_none(unsigned int irq) { }
  46. static unsigned int startup_none(unsigned int irq) { return 0; }
  47. static void disable_none(unsigned int irq) { }
  48. static void ack_none(unsigned int irq)
  49. {
  50. /*
  51. * 'what should we do if we get a hw irq event on an illegal vector'.
  52. * each architecture has to answer this themselves, it doesn't deserve
  53. * a generic callback i think.
  54. */
  55. printk("received IRQ %d with unknown interrupt type\n", irq);
  56. }
  57. /* startup is the same as "enable", shutdown is same as "disable" */
  58. #define shutdown_none disable_none
  59. #define end_none enable_none
  60. struct hw_interrupt_type no_irq_type = {
  61. "none",
  62. startup_none,
  63. shutdown_none,
  64. enable_none,
  65. disable_none,
  66. ack_none,
  67. end_none
  68. };
  69. volatile unsigned long irq_err_count, spurious_count;
  70. /*
  71. * Generic, controller-independent functions:
  72. */
  73. int show_interrupts(struct seq_file *p, void *v)
  74. {
  75. int i = *(loff_t *) v;
  76. struct irqaction * action;
  77. unsigned long flags;
  78. if (i == 0) {
  79. seq_puts(p, " ");
  80. for (i=0; i < 1 /*smp_num_cpus*/; i++)
  81. seq_printf(p, "CPU%d ", i);
  82. seq_putc(p, '\n');
  83. }
  84. if (i < NR_IRQS) {
  85. int j, count, num;
  86. const char *type_name = irq_desc[i].handler->typename;
  87. spin_lock_irqsave(&irq_desc[j].lock, flags);
  88. action = irq_desc[i].action;
  89. if (!action)
  90. goto skip;
  91. count = 0;
  92. num = -1;
  93. for (j = 0; j < NR_IRQS; j++)
  94. if (irq_desc[j].handler->typename == type_name) {
  95. if (i == j)
  96. num = count;
  97. count++;
  98. }
  99. seq_printf(p, "%3d: ",i);
  100. seq_printf(p, "%10u ", kstat_irqs(i));
  101. if (count > 1) {
  102. int prec = (num >= 100 ? 3 : num >= 10 ? 2 : 1);
  103. seq_printf(p, " %*s%d", 14 - prec, type_name, num);
  104. } else
  105. seq_printf(p, " %14s", type_name);
  106. seq_printf(p, " %s", action->name);
  107. for (action=action->next; action; action = action->next)
  108. seq_printf(p, ", %s", action->name);
  109. seq_putc(p, '\n');
  110. skip:
  111. spin_unlock_irqrestore(&irq_desc[j].lock, flags);
  112. } else if (i == NR_IRQS)
  113. seq_printf(p, "ERR: %10lu\n", irq_err_count);
  114. return 0;
  115. }
  116. /*
  117. * This should really return information about whether
  118. * we should do bottom half handling etc. Right now we
  119. * end up _always_ checking the bottom half, which is a
  120. * waste of time and is not what some drivers would
  121. * prefer.
  122. */
  123. int handle_IRQ_event(unsigned int irq, struct pt_regs * regs, struct irqaction * action)
  124. {
  125. int status = 1; /* Force the "do bottom halves" bit */
  126. int ret;
  127. if (!(action->flags & SA_INTERRUPT))
  128. local_irq_enable();
  129. do {
  130. ret = action->handler(irq, action->dev_id, regs);
  131. if (ret == IRQ_HANDLED)
  132. status |= action->flags;
  133. action = action->next;
  134. } while (action);
  135. if (status & SA_SAMPLE_RANDOM)
  136. add_interrupt_randomness(irq);
  137. local_irq_disable();
  138. return status;
  139. }
  140. /*
  141. * Generic enable/disable code: this just calls
  142. * down into the PIC-specific version for the actual
  143. * hardware disable after having gotten the irq
  144. * controller lock.
  145. */
  146. /**
  147. * disable_irq_nosync - disable an irq without waiting
  148. * @irq: Interrupt to disable
  149. *
  150. * Disable the selected interrupt line. Disables of an interrupt
  151. * stack. Unlike disable_irq(), this function does not ensure existing
  152. * instances of the IRQ handler have completed before returning.
  153. *
  154. * This function may be called from IRQ context.
  155. */
  156. void inline disable_irq_nosync(unsigned int irq)
  157. {
  158. irq_desc_t *desc = irq_desc + irq;
  159. unsigned long flags;
  160. spin_lock_irqsave(&desc->lock, flags);
  161. if (!desc->depth++) {
  162. desc->status |= IRQ_DISABLED;
  163. desc->handler->disable(irq);
  164. }
  165. spin_unlock_irqrestore(&desc->lock, flags);
  166. }
  167. /**
  168. * disable_irq - disable an irq and wait for completion
  169. * @irq: Interrupt to disable
  170. *
  171. * Disable the selected interrupt line. Disables of an interrupt
  172. * stack. That is for two disables you need two enables. This
  173. * function waits for any pending IRQ handlers for this interrupt
  174. * to complete before returning. If you use this function while
  175. * holding a resource the IRQ handler may need you will deadlock.
  176. *
  177. * This function may be called - with care - from IRQ context.
  178. */
  179. void disable_irq(unsigned int irq)
  180. {
  181. disable_irq_nosync(irq);
  182. synchronize_irq(irq);
  183. }
  184. /**
  185. * enable_irq - enable interrupt handling on an irq
  186. * @irq: Interrupt to enable
  187. *
  188. * Re-enables the processing of interrupts on this IRQ line
  189. * providing no disable_irq calls are now in effect.
  190. *
  191. * This function may be called from IRQ context.
  192. */
  193. void enable_irq(unsigned int irq)
  194. {
  195. irq_desc_t *desc = irq_desc + irq;
  196. unsigned long flags;
  197. spin_lock_irqsave(&desc->lock, flags);
  198. switch (desc->depth) {
  199. case 1: {
  200. unsigned int status = desc->status & ~IRQ_DISABLED;
  201. desc->status = status;
  202. if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
  203. desc->status = status | IRQ_REPLAY;
  204. hw_resend_irq(desc->handler,irq);
  205. }
  206. desc->handler->enable(irq);
  207. /* fall-through */
  208. }
  209. default:
  210. desc->depth--;
  211. break;
  212. case 0:
  213. printk("enable_irq(%u) unbalanced from %p\n", irq,
  214. __builtin_return_address(0));
  215. }
  216. spin_unlock_irqrestore(&desc->lock, flags);
  217. }
  218. /* Handle interrupt IRQ. REGS are the registers at the time of ther
  219. interrupt. */
  220. unsigned int handle_irq (int irq, struct pt_regs *regs)
  221. {
  222. /*
  223. * We ack quickly, we don't want the irq controller
  224. * thinking we're snobs just because some other CPU has
  225. * disabled global interrupts (we have already done the
  226. * INT_ACK cycles, it's too late to try to pretend to the
  227. * controller that we aren't taking the interrupt).
  228. *
  229. * 0 return value means that this irq is already being
  230. * handled by some other CPU. (or is disabled)
  231. */
  232. int cpu = smp_processor_id();
  233. irq_desc_t *desc = irq_desc + irq;
  234. struct irqaction * action;
  235. unsigned int status;
  236. irq_enter();
  237. kstat_cpu(cpu).irqs[irq]++;
  238. spin_lock(&desc->lock);
  239. desc->handler->ack(irq);
  240. /*
  241. REPLAY is when Linux resends an IRQ that was dropped earlier
  242. WAITING is used by probe to mark irqs that are being tested
  243. */
  244. status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
  245. status |= IRQ_PENDING; /* we _want_ to handle it */
  246. /*
  247. * If the IRQ is disabled for whatever reason, we cannot
  248. * use the action we have.
  249. */
  250. action = NULL;
  251. if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
  252. action = desc->action;
  253. status &= ~IRQ_PENDING; /* we commit to handling */
  254. status |= IRQ_INPROGRESS; /* we are handling it */
  255. }
  256. desc->status = status;
  257. /*
  258. * If there is no IRQ handler or it was disabled, exit early.
  259. Since we set PENDING, if another processor is handling
  260. a different instance of this same irq, the other processor
  261. will take care of it.
  262. */
  263. if (unlikely(!action))
  264. goto out;
  265. /*
  266. * Edge triggered interrupts need to remember
  267. * pending events.
  268. * This applies to any hw interrupts that allow a second
  269. * instance of the same irq to arrive while we are in handle_irq
  270. * or in the handler. But the code here only handles the _second_
  271. * instance of the irq, not the third or fourth. So it is mostly
  272. * useful for irq hardware that does not mask cleanly in an
  273. * SMP environment.
  274. */
  275. for (;;) {
  276. spin_unlock(&desc->lock);
  277. handle_IRQ_event(irq, regs, action);
  278. spin_lock(&desc->lock);
  279. if (likely(!(desc->status & IRQ_PENDING)))
  280. break;
  281. desc->status &= ~IRQ_PENDING;
  282. }
  283. desc->status &= ~IRQ_INPROGRESS;
  284. out:
  285. /*
  286. * The ->end() handler has to deal with interrupts which got
  287. * disabled while the handler was running.
  288. */
  289. desc->handler->end(irq);
  290. spin_unlock(&desc->lock);
  291. irq_exit();
  292. return 1;
  293. }
  294. /**
  295. * request_irq - allocate an interrupt line
  296. * @irq: Interrupt line to allocate
  297. * @handler: Function to be called when the IRQ occurs
  298. * @irqflags: Interrupt type flags
  299. * @devname: An ascii name for the claiming device
  300. * @dev_id: A cookie passed back to the handler function
  301. *
  302. * This call allocates interrupt resources and enables the
  303. * interrupt line and IRQ handling. From the point this
  304. * call is made your handler function may be invoked. Since
  305. * your handler function must clear any interrupt the board
  306. * raises, you must take care both to initialise your hardware
  307. * and to set up the interrupt handler in the right order.
  308. *
  309. * Dev_id must be globally unique. Normally the address of the
  310. * device data structure is used as the cookie. Since the handler
  311. * receives this value it makes sense to use it.
  312. *
  313. * If your interrupt is shared you must pass a non NULL dev_id
  314. * as this is required when freeing the interrupt.
  315. *
  316. * Flags:
  317. *
  318. * SA_SHIRQ Interrupt is shared
  319. *
  320. * SA_INTERRUPT Disable local interrupts while processing
  321. *
  322. * SA_SAMPLE_RANDOM The interrupt can be used for entropy
  323. *
  324. */
  325. int request_irq(unsigned int irq,
  326. irqreturn_t (*handler)(int, void *, struct pt_regs *),
  327. unsigned long irqflags,
  328. const char * devname,
  329. void *dev_id)
  330. {
  331. int retval;
  332. struct irqaction * action;
  333. #if 1
  334. /*
  335. * Sanity-check: shared interrupts should REALLY pass in
  336. * a real dev-ID, otherwise we'll have trouble later trying
  337. * to figure out which interrupt is which (messes up the
  338. * interrupt freeing logic etc).
  339. */
  340. if (irqflags & SA_SHIRQ) {
  341. if (!dev_id)
  342. printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]);
  343. }
  344. #endif
  345. if (irq >= NR_IRQS)
  346. return -EINVAL;
  347. if (!handler)
  348. return -EINVAL;
  349. action = (struct irqaction *)
  350. kmalloc(sizeof(struct irqaction), GFP_KERNEL);
  351. if (!action)
  352. return -ENOMEM;
  353. action->handler = handler;
  354. action->flags = irqflags;
  355. cpus_clear(action->mask);
  356. action->name = devname;
  357. action->next = NULL;
  358. action->dev_id = dev_id;
  359. retval = setup_irq(irq, action);
  360. if (retval)
  361. kfree(action);
  362. return retval;
  363. }
  364. EXPORT_SYMBOL(request_irq);
  365. /**
  366. * free_irq - free an interrupt
  367. * @irq: Interrupt line to free
  368. * @dev_id: Device identity to free
  369. *
  370. * Remove an interrupt handler. The handler is removed and if the
  371. * interrupt line is no longer in use by any driver it is disabled.
  372. * On a shared IRQ the caller must ensure the interrupt is disabled
  373. * on the card it drives before calling this function. The function
  374. * does not return until any executing interrupts for this IRQ
  375. * have completed.
  376. *
  377. * This function may be called from interrupt context.
  378. *
  379. * Bugs: Attempting to free an irq in a handler for the same irq hangs
  380. * the machine.
  381. */
  382. void free_irq(unsigned int irq, void *dev_id)
  383. {
  384. irq_desc_t *desc;
  385. struct irqaction **p;
  386. unsigned long flags;
  387. if (irq >= NR_IRQS)
  388. return;
  389. desc = irq_desc + irq;
  390. spin_lock_irqsave(&desc->lock,flags);
  391. p = &desc->action;
  392. for (;;) {
  393. struct irqaction * action = *p;
  394. if (action) {
  395. struct irqaction **pp = p;
  396. p = &action->next;
  397. if (action->dev_id != dev_id)
  398. continue;
  399. /* Found it - now remove it from the list of entries */
  400. *pp = action->next;
  401. if (!desc->action) {
  402. desc->status |= IRQ_DISABLED;
  403. desc->handler->shutdown(irq);
  404. }
  405. spin_unlock_irqrestore(&desc->lock,flags);
  406. synchronize_irq(irq);
  407. kfree(action);
  408. return;
  409. }
  410. printk("Trying to free free IRQ%d\n",irq);
  411. spin_unlock_irqrestore(&desc->lock,flags);
  412. return;
  413. }
  414. }
  415. EXPORT_SYMBOL(free_irq);
  416. /*
  417. * IRQ autodetection code..
  418. *
  419. * This depends on the fact that any interrupt that
  420. * comes in on to an unassigned handler will get stuck
  421. * with "IRQ_WAITING" cleared and the interrupt
  422. * disabled.
  423. */
  424. static DECLARE_MUTEX(probe_sem);
  425. /**
  426. * probe_irq_on - begin an interrupt autodetect
  427. *
  428. * Commence probing for an interrupt. The interrupts are scanned
  429. * and a mask of potential interrupt lines is returned.
  430. *
  431. */
  432. unsigned long probe_irq_on(void)
  433. {
  434. unsigned int i;
  435. irq_desc_t *desc;
  436. unsigned long val;
  437. unsigned long delay;
  438. down(&probe_sem);
  439. /*
  440. * something may have generated an irq long ago and we want to
  441. * flush such a longstanding irq before considering it as spurious.
  442. */
  443. for (i = NR_IRQS-1; i > 0; i--) {
  444. desc = irq_desc + i;
  445. spin_lock_irq(&desc->lock);
  446. if (!irq_desc[i].action)
  447. irq_desc[i].handler->startup(i);
  448. spin_unlock_irq(&desc->lock);
  449. }
  450. /* Wait for longstanding interrupts to trigger. */
  451. for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
  452. /* about 20ms delay */ barrier();
  453. /*
  454. * enable any unassigned irqs
  455. * (we must startup again here because if a longstanding irq
  456. * happened in the previous stage, it may have masked itself)
  457. */
  458. for (i = NR_IRQS-1; i > 0; i--) {
  459. desc = irq_desc + i;
  460. spin_lock_irq(&desc->lock);
  461. if (!desc->action) {
  462. desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
  463. if (desc->handler->startup(i))
  464. desc->status |= IRQ_PENDING;
  465. }
  466. spin_unlock_irq(&desc->lock);
  467. }
  468. /*
  469. * Wait for spurious interrupts to trigger
  470. */
  471. for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
  472. /* about 100ms delay */ barrier();
  473. /*
  474. * Now filter out any obviously spurious interrupts
  475. */
  476. val = 0;
  477. for (i = 0; i < NR_IRQS; i++) {
  478. irq_desc_t *desc = irq_desc + i;
  479. unsigned int status;
  480. spin_lock_irq(&desc->lock);
  481. status = desc->status;
  482. if (status & IRQ_AUTODETECT) {
  483. /* It triggered already - consider it spurious. */
  484. if (!(status & IRQ_WAITING)) {
  485. desc->status = status & ~IRQ_AUTODETECT;
  486. desc->handler->shutdown(i);
  487. } else
  488. if (i < 32)
  489. val |= 1 << i;
  490. }
  491. spin_unlock_irq(&desc->lock);
  492. }
  493. return val;
  494. }
  495. EXPORT_SYMBOL(probe_irq_on);
  496. /*
  497. * Return a mask of triggered interrupts (this
  498. * can handle only legacy ISA interrupts).
  499. */
  500. /**
  501. * probe_irq_mask - scan a bitmap of interrupt lines
  502. * @val: mask of interrupts to consider
  503. *
  504. * Scan the ISA bus interrupt lines and return a bitmap of
  505. * active interrupts. The interrupt probe logic state is then
  506. * returned to its previous value.
  507. *
  508. * Note: we need to scan all the irq's even though we will
  509. * only return ISA irq numbers - just so that we reset them
  510. * all to a known state.
  511. */
  512. unsigned int probe_irq_mask(unsigned long val)
  513. {
  514. int i;
  515. unsigned int mask;
  516. mask = 0;
  517. for (i = 0; i < NR_IRQS; i++) {
  518. irq_desc_t *desc = irq_desc + i;
  519. unsigned int status;
  520. spin_lock_irq(&desc->lock);
  521. status = desc->status;
  522. if (status & IRQ_AUTODETECT) {
  523. if (i < 16 && !(status & IRQ_WAITING))
  524. mask |= 1 << i;
  525. desc->status = status & ~IRQ_AUTODETECT;
  526. desc->handler->shutdown(i);
  527. }
  528. spin_unlock_irq(&desc->lock);
  529. }
  530. up(&probe_sem);
  531. return mask & val;
  532. }
  533. /*
  534. * Return the one interrupt that triggered (this can
  535. * handle any interrupt source).
  536. */
  537. /**
  538. * probe_irq_off - end an interrupt autodetect
  539. * @val: mask of potential interrupts (unused)
  540. *
  541. * Scans the unused interrupt lines and returns the line which
  542. * appears to have triggered the interrupt. If no interrupt was
  543. * found then zero is returned. If more than one interrupt is
  544. * found then minus the first candidate is returned to indicate
  545. * their is doubt.
  546. *
  547. * The interrupt probe logic state is returned to its previous
  548. * value.
  549. *
  550. * BUGS: When used in a module (which arguably shouldnt happen)
  551. * nothing prevents two IRQ probe callers from overlapping. The
  552. * results of this are non-optimal.
  553. */
  554. int probe_irq_off(unsigned long val)
  555. {
  556. int i, irq_found, nr_irqs;
  557. nr_irqs = 0;
  558. irq_found = 0;
  559. for (i = 0; i < NR_IRQS; i++) {
  560. irq_desc_t *desc = irq_desc + i;
  561. unsigned int status;
  562. spin_lock_irq(&desc->lock);
  563. status = desc->status;
  564. if (status & IRQ_AUTODETECT) {
  565. if (!(status & IRQ_WAITING)) {
  566. if (!nr_irqs)
  567. irq_found = i;
  568. nr_irqs++;
  569. }
  570. desc->status = status & ~IRQ_AUTODETECT;
  571. desc->handler->shutdown(i);
  572. }
  573. spin_unlock_irq(&desc->lock);
  574. }
  575. up(&probe_sem);
  576. if (nr_irqs > 1)
  577. irq_found = -irq_found;
  578. return irq_found;
  579. }
  580. EXPORT_SYMBOL(probe_irq_off);
  581. /* this was setup_x86_irq but it seems pretty generic */
  582. int setup_irq(unsigned int irq, struct irqaction * new)
  583. {
  584. int shared = 0;
  585. unsigned long flags;
  586. struct irqaction *old, **p;
  587. irq_desc_t *desc = irq_desc + irq;
  588. /*
  589. * Some drivers like serial.c use request_irq() heavily,
  590. * so we have to be careful not to interfere with a
  591. * running system.
  592. */
  593. if (new->flags & SA_SAMPLE_RANDOM) {
  594. /*
  595. * This function might sleep, we want to call it first,
  596. * outside of the atomic block.
  597. * Yes, this might clear the entropy pool if the wrong
  598. * driver is attempted to be loaded, without actually
  599. * installing a new handler, but is this really a problem,
  600. * only the sysadmin is able to do this.
  601. */
  602. rand_initialize_irq(irq);
  603. }
  604. /*
  605. * The following block of code has to be executed atomically
  606. */
  607. spin_lock_irqsave(&desc->lock,flags);
  608. p = &desc->action;
  609. if ((old = *p) != NULL) {
  610. /* Can't share interrupts unless both agree to */
  611. if (!(old->flags & new->flags & SA_SHIRQ)) {
  612. spin_unlock_irqrestore(&desc->lock,flags);
  613. return -EBUSY;
  614. }
  615. /* add new interrupt at end of irq queue */
  616. do {
  617. p = &old->next;
  618. old = *p;
  619. } while (old);
  620. shared = 1;
  621. }
  622. *p = new;
  623. if (!shared) {
  624. desc->depth = 0;
  625. desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);
  626. desc->handler->startup(irq);
  627. }
  628. spin_unlock_irqrestore(&desc->lock,flags);
  629. /* register_irq_proc(irq); */
  630. return 0;
  631. }
  632. /* Initialize irq handling for IRQs.
  633. BASE_IRQ, BASE_IRQ+INTERVAL, ..., BASE_IRQ+NUM*INTERVAL
  634. to IRQ_TYPE. An IRQ_TYPE of 0 means to use a generic interrupt type. */
  635. void __init
  636. init_irq_handlers (int base_irq, int num, int interval,
  637. struct hw_interrupt_type *irq_type)
  638. {
  639. while (num-- > 0) {
  640. irq_desc[base_irq].status = IRQ_DISABLED;
  641. irq_desc[base_irq].action = NULL;
  642. irq_desc[base_irq].depth = 1;
  643. irq_desc[base_irq].handler = irq_type;
  644. base_irq += interval;
  645. }
  646. }
  647. #if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
  648. void init_irq_proc(void)
  649. {
  650. }
  651. #endif /* CONFIG_PROC_FS && CONFIG_SYSCTL */