xref: /openbmc/linux/kernel/irq/dummychip.c (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
152a65ff5SThomas Gleixner // SPDX-License-Identifier: GPL-2.0
23795de23SThomas Gleixner /*
33795de23SThomas Gleixner  * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
43795de23SThomas Gleixner  * Copyright (C) 2005-2006, Thomas Gleixner, Russell King
53795de23SThomas Gleixner  *
63795de23SThomas Gleixner  * This file contains the dummy interrupt chip implementation
73795de23SThomas Gleixner  */
83795de23SThomas Gleixner #include <linux/interrupt.h>
93795de23SThomas Gleixner #include <linux/irq.h>
1017d83127SKuninori Morimoto #include <linux/export.h>
113795de23SThomas Gleixner 
123795de23SThomas Gleixner #include "internals.h"
133795de23SThomas Gleixner 
143795de23SThomas Gleixner /*
153795de23SThomas Gleixner  * What should we do if we get a hw irq event on an illegal vector?
16*a359f757SIngo Molnar  * Each architecture has to answer this themselves.
173795de23SThomas Gleixner  */
ack_bad(struct irq_data * data)183795de23SThomas Gleixner static void ack_bad(struct irq_data *data)
193795de23SThomas Gleixner {
203795de23SThomas Gleixner 	struct irq_desc *desc = irq_data_to_desc(data);
213795de23SThomas Gleixner 
223795de23SThomas Gleixner 	print_irq_desc(data->irq, desc);
233795de23SThomas Gleixner 	ack_bad_irq(data->irq);
243795de23SThomas Gleixner }
253795de23SThomas Gleixner 
263795de23SThomas Gleixner /*
273795de23SThomas Gleixner  * NOP functions
283795de23SThomas Gleixner  */
noop(struct irq_data * data)293795de23SThomas Gleixner static void noop(struct irq_data *data) { }
303795de23SThomas Gleixner 
noop_ret(struct irq_data * data)313795de23SThomas Gleixner static unsigned int noop_ret(struct irq_data *data)
323795de23SThomas Gleixner {
333795de23SThomas Gleixner 	return 0;
343795de23SThomas Gleixner }
353795de23SThomas Gleixner 
363795de23SThomas Gleixner /*
373795de23SThomas Gleixner  * Generic no controller implementation
383795de23SThomas Gleixner  */
393795de23SThomas Gleixner struct irq_chip no_irq_chip = {
403795de23SThomas Gleixner 	.name		= "none",
413795de23SThomas Gleixner 	.irq_startup	= noop_ret,
423795de23SThomas Gleixner 	.irq_shutdown	= noop,
433795de23SThomas Gleixner 	.irq_enable	= noop,
443795de23SThomas Gleixner 	.irq_disable	= noop,
453795de23SThomas Gleixner 	.irq_ack	= ack_bad,
46de8d1810SGeert Uytterhoeven 	.flags		= IRQCHIP_SKIP_SET_WAKE,
473795de23SThomas Gleixner };
483795de23SThomas Gleixner 
493795de23SThomas Gleixner /*
503795de23SThomas Gleixner  * Generic dummy implementation which can be used for
513795de23SThomas Gleixner  * real dumb interrupt sources
523795de23SThomas Gleixner  */
533795de23SThomas Gleixner struct irq_chip dummy_irq_chip = {
543795de23SThomas Gleixner 	.name		= "dummy",
553795de23SThomas Gleixner 	.irq_startup	= noop_ret,
563795de23SThomas Gleixner 	.irq_shutdown	= noop,
573795de23SThomas Gleixner 	.irq_enable	= noop,
583795de23SThomas Gleixner 	.irq_disable	= noop,
593795de23SThomas Gleixner 	.irq_ack	= noop,
603795de23SThomas Gleixner 	.irq_mask	= noop,
613795de23SThomas Gleixner 	.irq_unmask	= noop,
6210a50f1aSRoger Quadros 	.flags		= IRQCHIP_SKIP_SET_WAKE,
633795de23SThomas Gleixner };
6417d83127SKuninori Morimoto EXPORT_SYMBOL_GPL(dummy_irq_chip);
65