summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2022-02-09 16:25:59 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-19 05:33:45 +0200
commitf19bf41e73317b29331787bba0f5afdeb686a760 (patch)
tree1df88ce91fec360e7c80771418046ba4814d70fb /kernel
parent922b824bb71ae57f9b368710bba68e7ad0c09377 (diff)
downloadlinux-f19bf41e73317b29331787bba0f5afdeb686a760.tar.gz
linux-f19bf41e73317b29331787bba0f5afdeb686a760.tar.bz2
linux-f19bf41e73317b29331787bba0f5afdeb686a760.zip
genirq: Allow irq_chip registration functions to take a const irq_chip
[ Upstream commit 393e1280f765661cf39785e967676a4e57324126 ] In order to let a const irqchip be fed to the irqchip layer, adjust the various prototypes. An extra cast in irq_set_chip()() is required to avoid a warning. Signed-off-by: Marc Zyngier <maz@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220209162607.1118325-3-maz@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/irq/chip.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 498f76beb876..5f85eac6af11 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -38,7 +38,7 @@ struct irqaction chained_action = {
* @irq: irq number
* @chip: pointer to irq chip description structure
*/
-int irq_set_chip(unsigned int irq, struct irq_chip *chip)
+int irq_set_chip(unsigned int irq, const struct irq_chip *chip)
{
unsigned long flags;
struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
@@ -46,10 +46,7 @@ int irq_set_chip(unsigned int irq, struct irq_chip *chip)
if (!desc)
return -EINVAL;
- if (!chip)
- chip = &no_irq_chip;
-
- desc->irq_data.chip = chip;
+ desc->irq_data.chip = (struct irq_chip *)(chip ?: &no_irq_chip);
irq_put_desc_unlock(desc, flags);
/*
* For !CONFIG_SPARSE_IRQ make the irq show up in
@@ -1086,7 +1083,7 @@ irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
EXPORT_SYMBOL_GPL(irq_set_chained_handler_and_data);
void
-irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
+irq_set_chip_and_handler_name(unsigned int irq, const struct irq_chip *chip,
irq_flow_handler_t handle, const char *name)
{
irq_set_chip(irq, chip);