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