chip.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. /*
  2. * linux/kernel/irq/chip.c
  3. *
  4. * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
  5. * Copyright (C) 2005-2006, Thomas Gleixner, Russell King
  6. *
  7. * This file contains the core interrupt handling code, for irq-chip
  8. * based architectures.
  9. *
  10. * Detailed information is available in Documentation/DocBook/genericirq
  11. */
  12. #include <linux/irq.h>
  13. #include <linux/msi.h>
  14. #include <linux/module.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/kernel_stat.h>
  17. #include "internals.h"
  18. /**
  19. * dynamic_irq_init - initialize a dynamically allocated irq
  20. * @irq: irq number to initialize
  21. */
  22. void dynamic_irq_init(unsigned int irq)
  23. {
  24. struct irq_desc *desc;
  25. unsigned long flags;
  26. desc = irq_to_desc(irq);
  27. if (!desc) {
  28. WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
  29. return;
  30. }
  31. /* Ensure we don't have left over values from a previous use of this irq */
  32. spin_lock_irqsave(&desc->lock, flags);
  33. desc->status = IRQ_DISABLED;
  34. desc->chip = &no_irq_chip;
  35. desc->handle_irq = handle_bad_irq;
  36. desc->depth = 1;
  37. desc->msi_desc = NULL;
  38. desc->handler_data = NULL;
  39. desc->chip_data = NULL;
  40. desc->action = NULL;
  41. desc->irq_count = 0;
  42. desc->irqs_unhandled = 0;
  43. #ifdef CONFIG_SMP
  44. cpumask_setall(desc->affinity);
  45. #ifdef CONFIG_GENERIC_PENDING_IRQ
  46. cpumask_clear(desc->pending_mask);
  47. #endif
  48. #endif
  49. spin_unlock_irqrestore(&desc->lock, flags);
  50. }
  51. /**
  52. * dynamic_irq_cleanup - cleanup a dynamically allocated irq
  53. * @irq: irq number to initialize
  54. */
  55. void dynamic_irq_cleanup(unsigned int irq)
  56. {
  57. struct irq_desc *desc = irq_to_desc(irq);
  58. unsigned long flags;
  59. if (!desc) {
  60. WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
  61. return;
  62. }
  63. spin_lock_irqsave(&desc->lock, flags);
  64. if (desc->action) {
  65. spin_unlock_irqrestore(&desc->lock, flags);
  66. WARN(1, KERN_ERR "Destroying IRQ%d without calling free_irq\n",
  67. irq);
  68. return;
  69. }
  70. desc->msi_desc = NULL;
  71. desc->handler_data = NULL;
  72. desc->chip_data = NULL;
  73. desc->handle_irq = handle_bad_irq;
  74. desc->chip = &no_irq_chip;
  75. desc->name = NULL;
  76. clear_kstat_irqs(desc);
  77. spin_unlock_irqrestore(&desc->lock, flags);
  78. }
  79. /**
  80. * set_irq_chip - set the irq chip for an irq
  81. * @irq: irq number
  82. * @chip: pointer to irq chip description structure
  83. */
  84. int set_irq_chip(unsigned int irq, struct irq_chip *chip)
  85. {
  86. struct irq_desc *desc = irq_to_desc(irq);
  87. unsigned long flags;
  88. if (!desc) {
  89. WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
  90. return -EINVAL;
  91. }
  92. if (!chip)
  93. chip = &no_irq_chip;
  94. spin_lock_irqsave(&desc->lock, flags);
  95. irq_chip_set_defaults(chip);
  96. desc->chip = chip;
  97. spin_unlock_irqrestore(&desc->lock, flags);
  98. return 0;
  99. }
  100. EXPORT_SYMBOL(set_irq_chip);
  101. /**
  102. * set_irq_type - set the irq trigger type for an irq
  103. * @irq: irq number
  104. * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
  105. */
  106. int set_irq_type(unsigned int irq, unsigned int type)
  107. {
  108. struct irq_desc *desc = irq_to_desc(irq);
  109. unsigned long flags;
  110. int ret = -ENXIO;
  111. if (!desc) {
  112. printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
  113. return -ENODEV;
  114. }
  115. type &= IRQ_TYPE_SENSE_MASK;
  116. if (type == IRQ_TYPE_NONE)
  117. return 0;
  118. spin_lock_irqsave(&desc->lock, flags);
  119. ret = __irq_set_trigger(desc, irq, type);
  120. spin_unlock_irqrestore(&desc->lock, flags);
  121. return ret;
  122. }
  123. EXPORT_SYMBOL(set_irq_type);
  124. /**
  125. * set_irq_data - set irq type data for an irq
  126. * @irq: Interrupt number
  127. * @data: Pointer to interrupt specific data
  128. *
  129. * Set the hardware irq controller data for an irq
  130. */
  131. int set_irq_data(unsigned int irq, void *data)
  132. {
  133. struct irq_desc *desc = irq_to_desc(irq);
  134. unsigned long flags;
  135. if (!desc) {
  136. printk(KERN_ERR
  137. "Trying to install controller data for IRQ%d\n", irq);
  138. return -EINVAL;
  139. }
  140. spin_lock_irqsave(&desc->lock, flags);
  141. desc->handler_data = data;
  142. spin_unlock_irqrestore(&desc->lock, flags);
  143. return 0;
  144. }
  145. EXPORT_SYMBOL(set_irq_data);
  146. /**
  147. * set_irq_data - set irq type data for an irq
  148. * @irq: Interrupt number
  149. * @entry: Pointer to MSI descriptor data
  150. *
  151. * Set the hardware irq controller data for an irq
  152. */
  153. int set_irq_msi(unsigned int irq, struct msi_desc *entry)
  154. {
  155. struct irq_desc *desc = irq_to_desc(irq);
  156. unsigned long flags;
  157. if (!desc) {
  158. printk(KERN_ERR
  159. "Trying to install msi data for IRQ%d\n", irq);
  160. return -EINVAL;
  161. }
  162. spin_lock_irqsave(&desc->lock, flags);
  163. desc->msi_desc = entry;
  164. if (entry)
  165. entry->irq = irq;
  166. spin_unlock_irqrestore(&desc->lock, flags);
  167. return 0;
  168. }
  169. /**
  170. * set_irq_chip_data - set irq chip data for an irq
  171. * @irq: Interrupt number
  172. * @data: Pointer to chip specific data
  173. *
  174. * Set the hardware irq chip data for an irq
  175. */
  176. int set_irq_chip_data(unsigned int irq, void *data)
  177. {
  178. struct irq_desc *desc = irq_to_desc(irq);
  179. unsigned long flags;
  180. if (!desc) {
  181. printk(KERN_ERR
  182. "Trying to install chip data for IRQ%d\n", irq);
  183. return -EINVAL;
  184. }
  185. if (!desc->chip) {
  186. printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq);
  187. return -EINVAL;
  188. }
  189. spin_lock_irqsave(&desc->lock, flags);
  190. desc->chip_data = data;
  191. spin_unlock_irqrestore(&desc->lock, flags);
  192. return 0;
  193. }
  194. EXPORT_SYMBOL(set_irq_chip_data);
  195. /**
  196. * set_irq_nested_thread - Set/Reset the IRQ_NESTED_THREAD flag of an irq
  197. *
  198. * @irq: Interrupt number
  199. * @nest: 0 to clear / 1 to set the IRQ_NESTED_THREAD flag
  200. *
  201. * The IRQ_NESTED_THREAD flag indicates that on
  202. * request_threaded_irq() no separate interrupt thread should be
  203. * created for the irq as the handler are called nested in the
  204. * context of a demultiplexing interrupt handler thread.
  205. */
  206. void set_irq_nested_thread(unsigned int irq, int nest)
  207. {
  208. struct irq_desc *desc = irq_to_desc(irq);
  209. unsigned long flags;
  210. if (!desc)
  211. return;
  212. spin_lock_irqsave(&desc->lock, flags);
  213. if (nest)
  214. desc->status |= IRQ_NESTED_THREAD;
  215. else
  216. desc->status &= ~IRQ_NESTED_THREAD;
  217. spin_unlock_irqrestore(&desc->lock, flags);
  218. }
  219. EXPORT_SYMBOL_GPL(set_irq_nested_thread);
  220. /*
  221. * default enable function
  222. */
  223. static void default_enable(unsigned int irq)
  224. {
  225. struct irq_desc *desc = irq_to_desc(irq);
  226. desc->chip->unmask(irq);
  227. desc->status &= ~IRQ_MASKED;
  228. }
  229. /*
  230. * default disable function
  231. */
  232. static void default_disable(unsigned int irq)
  233. {
  234. }
  235. /*
  236. * default startup function
  237. */
  238. static unsigned int default_startup(unsigned int irq)
  239. {
  240. struct irq_desc *desc = irq_to_desc(irq);
  241. desc->chip->enable(irq);
  242. return 0;
  243. }
  244. /*
  245. * default shutdown function
  246. */
  247. static void default_shutdown(unsigned int irq)
  248. {
  249. struct irq_desc *desc = irq_to_desc(irq);
  250. desc->chip->mask(irq);
  251. desc->status |= IRQ_MASKED;
  252. }
  253. /*
  254. * Fixup enable/disable function pointers
  255. */
  256. void irq_chip_set_defaults(struct irq_chip *chip)
  257. {
  258. if (!chip->enable)
  259. chip->enable = default_enable;
  260. if (!chip->disable)
  261. chip->disable = default_disable;
  262. if (!chip->startup)
  263. chip->startup = default_startup;
  264. /*
  265. * We use chip->disable, when the user provided its own. When
  266. * we have default_disable set for chip->disable, then we need
  267. * to use default_shutdown, otherwise the irq line is not
  268. * disabled on free_irq():
  269. */
  270. if (!chip->shutdown)
  271. chip->shutdown = chip->disable != default_disable ?
  272. chip->disable : default_shutdown;
  273. if (!chip->name)
  274. chip->name = chip->typename;
  275. if (!chip->end)
  276. chip->end = dummy_irq_chip.end;
  277. }
  278. static inline void mask_ack_irq(struct irq_desc *desc, int irq)
  279. {
  280. if (desc->chip->mask_ack)
  281. desc->chip->mask_ack(irq);
  282. else {
  283. desc->chip->mask(irq);
  284. if (desc->chip->ack)
  285. desc->chip->ack(irq);
  286. }
  287. }
  288. /*
  289. * handle_nested_irq - Handle a nested irq from a irq thread
  290. * @irq: the interrupt number
  291. *
  292. * Handle interrupts which are nested into a threaded interrupt
  293. * handler. The handler function is called inside the calling
  294. * threads context.
  295. */
  296. void handle_nested_irq(unsigned int irq)
  297. {
  298. struct irq_desc *desc = irq_to_desc(irq);
  299. struct irqaction *action;
  300. irqreturn_t action_ret;
  301. might_sleep();
  302. spin_lock_irq(&desc->lock);
  303. kstat_incr_irqs_this_cpu(irq, desc);
  304. action = desc->action;
  305. if (unlikely(!action || (desc->status & IRQ_DISABLED)))
  306. goto out_unlock;
  307. desc->status |= IRQ_INPROGRESS;
  308. spin_unlock_irq(&desc->lock);
  309. action_ret = action->thread_fn(action->irq, action->dev_id);
  310. if (!noirqdebug)
  311. note_interrupt(irq, desc, action_ret);
  312. spin_lock_irq(&desc->lock);
  313. desc->status &= ~IRQ_INPROGRESS;
  314. out_unlock:
  315. spin_unlock_irq(&desc->lock);
  316. }
  317. EXPORT_SYMBOL_GPL(handle_nested_irq);
  318. /**
  319. * handle_simple_irq - Simple and software-decoded IRQs.
  320. * @irq: the interrupt number
  321. * @desc: the interrupt description structure for this irq
  322. *
  323. * Simple interrupts are either sent from a demultiplexing interrupt
  324. * handler or come from hardware, where no interrupt hardware control
  325. * is necessary.
  326. *
  327. * Note: The caller is expected to handle the ack, clear, mask and
  328. * unmask issues if necessary.
  329. */
  330. void
  331. handle_simple_irq(unsigned int irq, struct irq_desc *desc)
  332. {
  333. struct irqaction *action;
  334. irqreturn_t action_ret;
  335. spin_lock(&desc->lock);
  336. if (unlikely(desc->status & IRQ_INPROGRESS))
  337. goto out_unlock;
  338. desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
  339. kstat_incr_irqs_this_cpu(irq, desc);
  340. action = desc->action;
  341. if (unlikely(!action || (desc->status & IRQ_DISABLED)))
  342. goto out_unlock;
  343. desc->status |= IRQ_INPROGRESS;
  344. spin_unlock(&desc->lock);
  345. action_ret = handle_IRQ_event(irq, action);
  346. if (!noirqdebug)
  347. note_interrupt(irq, desc, action_ret);
  348. spin_lock(&desc->lock);
  349. desc->status &= ~IRQ_INPROGRESS;
  350. out_unlock:
  351. spin_unlock(&desc->lock);
  352. }
  353. /**
  354. * handle_level_irq - Level type irq handler
  355. * @irq: the interrupt number
  356. * @desc: the interrupt description structure for this irq
  357. *
  358. * Level type interrupts are active as long as the hardware line has
  359. * the active level. This may require to mask the interrupt and unmask
  360. * it after the associated handler has acknowledged the device, so the
  361. * interrupt line is back to inactive.
  362. */
  363. void
  364. handle_level_irq(unsigned int irq, struct irq_desc *desc)
  365. {
  366. struct irqaction *action;
  367. irqreturn_t action_ret;
  368. spin_lock(&desc->lock);
  369. mask_ack_irq(desc, irq);
  370. if (unlikely(desc->status & IRQ_INPROGRESS))
  371. goto out_unlock;
  372. desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
  373. kstat_incr_irqs_this_cpu(irq, desc);
  374. /*
  375. * If its disabled or no action available
  376. * keep it masked and get out of here
  377. */
  378. action = desc->action;
  379. if (unlikely(!action || (desc->status & IRQ_DISABLED)))
  380. goto out_unlock;
  381. desc->status |= IRQ_INPROGRESS;
  382. spin_unlock(&desc->lock);
  383. action_ret = handle_IRQ_event(irq, action);
  384. if (!noirqdebug)
  385. note_interrupt(irq, desc, action_ret);
  386. spin_lock(&desc->lock);
  387. desc->status &= ~IRQ_INPROGRESS;
  388. if (unlikely(desc->status & IRQ_ONESHOT))
  389. desc->status |= IRQ_MASKED;
  390. else if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
  391. desc->chip->unmask(irq);
  392. out_unlock:
  393. spin_unlock(&desc->lock);
  394. }
  395. EXPORT_SYMBOL_GPL(handle_level_irq);
  396. /**
  397. * handle_fasteoi_irq - irq handler for transparent controllers
  398. * @irq: the interrupt number
  399. * @desc: the interrupt description structure for this irq
  400. *
  401. * Only a single callback will be issued to the chip: an ->eoi()
  402. * call when the interrupt has been serviced. This enables support
  403. * for modern forms of interrupt handlers, which handle the flow
  404. * details in hardware, transparently.
  405. */
  406. void
  407. handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
  408. {
  409. struct irqaction *action;
  410. irqreturn_t action_ret;
  411. spin_lock(&desc->lock);
  412. if (unlikely(desc->status & IRQ_INPROGRESS))
  413. goto out;
  414. desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
  415. kstat_incr_irqs_this_cpu(irq, desc);
  416. /*
  417. * If its disabled or no action available
  418. * then mask it and get out of here:
  419. */
  420. action = desc->action;
  421. if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
  422. desc->status |= IRQ_PENDING;
  423. if (desc->chip->mask)
  424. desc->chip->mask(irq);
  425. goto out;
  426. }
  427. desc->status |= IRQ_INPROGRESS;
  428. desc->status &= ~IRQ_PENDING;
  429. spin_unlock(&desc->lock);
  430. action_ret = handle_IRQ_event(irq, action);
  431. if (!noirqdebug)
  432. note_interrupt(irq, desc, action_ret);
  433. spin_lock(&desc->lock);
  434. desc->status &= ~IRQ_INPROGRESS;
  435. out:
  436. desc->chip->eoi(irq);
  437. spin_unlock(&desc->lock);
  438. }
  439. /**
  440. * handle_edge_irq - edge type IRQ handler
  441. * @irq: the interrupt number
  442. * @desc: the interrupt description structure for this irq
  443. *
  444. * Interrupt occures on the falling and/or rising edge of a hardware
  445. * signal. The occurence is latched into the irq controller hardware
  446. * and must be acked in order to be reenabled. After the ack another
  447. * interrupt can happen on the same source even before the first one
  448. * is handled by the assosiacted event handler. If this happens it
  449. * might be necessary to disable (mask) the interrupt depending on the
  450. * controller hardware. This requires to reenable the interrupt inside
  451. * of the loop which handles the interrupts which have arrived while
  452. * the handler was running. If all pending interrupts are handled, the
  453. * loop is left.
  454. */
  455. void
  456. handle_edge_irq(unsigned int irq, struct irq_desc *desc)
  457. {
  458. spin_lock(&desc->lock);
  459. desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
  460. /*
  461. * If we're currently running this IRQ, or its disabled,
  462. * we shouldn't process the IRQ. Mark it pending, handle
  463. * the necessary masking and go out
  464. */
  465. if (unlikely((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
  466. !desc->action)) {
  467. desc->status |= (IRQ_PENDING | IRQ_MASKED);
  468. mask_ack_irq(desc, irq);
  469. goto out_unlock;
  470. }
  471. kstat_incr_irqs_this_cpu(irq, desc);
  472. /* Start handling the irq */
  473. if (desc->chip->ack)
  474. desc->chip->ack(irq);
  475. /* Mark the IRQ currently in progress.*/
  476. desc->status |= IRQ_INPROGRESS;
  477. do {
  478. struct irqaction *action = desc->action;
  479. irqreturn_t action_ret;
  480. if (unlikely(!action)) {
  481. desc->chip->mask(irq);
  482. goto out_unlock;
  483. }
  484. /*
  485. * When another irq arrived while we were handling
  486. * one, we could have masked the irq.
  487. * Renable it, if it was not disabled in meantime.
  488. */
  489. if (unlikely((desc->status &
  490. (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) ==
  491. (IRQ_PENDING | IRQ_MASKED))) {
  492. desc->chip->unmask(irq);
  493. desc->status &= ~IRQ_MASKED;
  494. }
  495. desc->status &= ~IRQ_PENDING;
  496. spin_unlock(&desc->lock);
  497. action_ret = handle_IRQ_event(irq, action);
  498. if (!noirqdebug)
  499. note_interrupt(irq, desc, action_ret);
  500. spin_lock(&desc->lock);
  501. } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
  502. desc->status &= ~IRQ_INPROGRESS;
  503. out_unlock:
  504. spin_unlock(&desc->lock);
  505. }
  506. /**
  507. * handle_percpu_IRQ - Per CPU local irq handler
  508. * @irq: the interrupt number
  509. * @desc: the interrupt description structure for this irq
  510. *
  511. * Per CPU interrupts on SMP machines without locking requirements
  512. */
  513. void
  514. handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
  515. {
  516. irqreturn_t action_ret;
  517. kstat_incr_irqs_this_cpu(irq, desc);
  518. if (desc->chip->ack)
  519. desc->chip->ack(irq);
  520. action_ret = handle_IRQ_event(irq, desc->action);
  521. if (!noirqdebug)
  522. note_interrupt(irq, desc, action_ret);
  523. if (desc->chip->eoi)
  524. desc->chip->eoi(irq);
  525. }
  526. void
  527. __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
  528. const char *name)
  529. {
  530. struct irq_desc *desc = irq_to_desc(irq);
  531. unsigned long flags;
  532. if (!desc) {
  533. printk(KERN_ERR
  534. "Trying to install type control for IRQ%d\n", irq);
  535. return;
  536. }
  537. if (!handle)
  538. handle = handle_bad_irq;
  539. else if (desc->chip == &no_irq_chip) {
  540. printk(KERN_WARNING "Trying to install %sinterrupt handler "
  541. "for IRQ%d\n", is_chained ? "chained " : "", irq);
  542. /*
  543. * Some ARM implementations install a handler for really dumb
  544. * interrupt hardware without setting an irq_chip. This worked
  545. * with the ARM no_irq_chip but the check in setup_irq would
  546. * prevent us to setup the interrupt at all. Switch it to
  547. * dummy_irq_chip for easy transition.
  548. */
  549. desc->chip = &dummy_irq_chip;
  550. }
  551. chip_bus_lock(irq, desc);
  552. spin_lock_irqsave(&desc->lock, flags);
  553. /* Uninstall? */
  554. if (handle == handle_bad_irq) {
  555. if (desc->chip != &no_irq_chip)
  556. mask_ack_irq(desc, irq);
  557. desc->status |= IRQ_DISABLED;
  558. desc->depth = 1;
  559. }
  560. desc->handle_irq = handle;
  561. desc->name = name;
  562. if (handle != handle_bad_irq && is_chained) {
  563. desc->status &= ~IRQ_DISABLED;
  564. desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
  565. desc->depth = 0;
  566. desc->chip->startup(irq);
  567. }
  568. spin_unlock_irqrestore(&desc->lock, flags);
  569. chip_bus_sync_unlock(irq, desc);
  570. }
  571. EXPORT_SYMBOL_GPL(__set_irq_handler);
  572. void
  573. set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
  574. irq_flow_handler_t handle)
  575. {
  576. set_irq_chip(irq, chip);
  577. __set_irq_handler(irq, handle, 0, NULL);
  578. }
  579. void
  580. set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
  581. irq_flow_handler_t handle, const char *name)
  582. {
  583. set_irq_chip(irq, chip);
  584. __set_irq_handler(irq, handle, 0, name);
  585. }
  586. void __init set_irq_noprobe(unsigned int irq)
  587. {
  588. struct irq_desc *desc = irq_to_desc(irq);
  589. unsigned long flags;
  590. if (!desc) {
  591. printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
  592. return;
  593. }
  594. spin_lock_irqsave(&desc->lock, flags);
  595. desc->status |= IRQ_NOPROBE;
  596. spin_unlock_irqrestore(&desc->lock, flags);
  597. }
  598. void __init set_irq_probe(unsigned int irq)
  599. {
  600. struct irq_desc *desc = irq_to_desc(irq);
  601. unsigned long flags;
  602. if (!desc) {
  603. printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
  604. return;
  605. }
  606. spin_lock_irqsave(&desc->lock, flags);
  607. desc->status &= ~IRQ_NOPROBE;
  608. spin_unlock_irqrestore(&desc->lock, flags);
  609. }