Skip to content

Commit 2bd1753

Browse files
author
Marc Zyngier
committed
Merge branch irq/misc-5.20 into irq/irqchip-next
* irq/misc-5.20: : . : Misc IRQ changes for 5.20: : : - Let irq_set_chip_handler_name_locked() take a const struct irq_chip * : : - Convert the ocelot irq_chip to being immutable (depends on the above) : : - Tidy-up the NOMAP irqdomain API variant : : - Teach action_show() to use for_each_action_of_desc() : : - Check ioremap() return value in the MIPS GIC driver : : - Move MMP driver init function declarations into the common .h : : - The obligatory typo fixes : . irqchip/mmp: Declare init functions in common header file irqchip/mips-gic: Check the return value of ioremap() in gic_of_init() genirq: Use for_each_action_of_desc in actions_show() irqdomain: Use hwirq_max instead of revmap_size for NOMAP domains irqdomain: Report irq number for NOMAP domains irqchip/gic-v3: Fix comment typo pinctrl: ocelot: Make irq_chip immutable genirq: Allow irq_set_chip_handler_name_locked() to take a const irq_chip Signed-off-by: Marc Zyngier <[email protected]>
2 parents 0fa72ed + 9d9b010 commit 2bd1753

File tree

10 files changed

+31
-15
lines changed

10 files changed

+31
-15
lines changed

arch/arm/mach-mmp/mmp2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#include <linux/platform_data/pxa_sdhci.h>
66

77
extern void mmp2_timer_init(void);
8-
extern void __init mmp2_init_icu(void);
98
extern void __init mmp2_init_irq(void);
109
extern void mmp2_clear_pmic_int(void);
1110

1211
#include <linux/i2c.h>
1312
#include <linux/platform_data/i2c-pxa.h>
1413
#include <linux/platform_data/dma-mmp_tdma.h>
14+
#include <linux/irqchip/mmp.h>
1515

1616
#include "devices.h"
1717

arch/arm/mach-mmp/pxa168.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <linux/reboot.h>
66

77
extern void pxa168_timer_init(void);
8-
extern void __init icu_init_irq(void);
98
extern void __init pxa168_init_irq(void);
109
extern void pxa168_restart(enum reboot_mode, const char *);
1110
extern void pxa168_clear_keypad_wakeup(void);
@@ -18,6 +17,7 @@ extern void pxa168_clear_keypad_wakeup(void);
1817
#include <linux/pxa168_eth.h>
1918
#include <linux/platform_data/mv_usb.h>
2019
#include <linux/soc/mmp/cputype.h>
20+
#include <linux/irqchip/mmp.h>
2121

2222
#include "devices.h"
2323

arch/arm/mach-mmp/pxa910.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#define __ASM_MACH_PXA910_H
44

55
extern void pxa910_timer_init(void);
6-
extern void __init icu_init_irq(void);
76
extern void __init pxa910_init_irq(void);
87

98
#include <linux/i2c.h>
109
#include <linux/platform_data/i2c-pxa.h>
1110
#include <linux/platform_data/mtd-nand-pxa3xx.h>
1211
#include <video/mmp_disp.h>
12+
#include <linux/irqchip/mmp.h>
1313

1414
#include "devices.h"
1515

drivers/irqchip/irq-gic-v3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ static void gic_enable_nmi_support(void)
17831783
* the security state of the GIC (controlled by the GICD_CTRL.DS bit)
17841784
* and if Group 0 interrupts can be delivered to Linux in the non-secure
17851785
* world as FIQs (controlled by the SCR_EL3.FIQ bit). These affect the
1786-
* the ICC_PMR_EL1 register and the priority that software assigns to
1786+
* ICC_PMR_EL1 register and the priority that software assigns to
17871787
* interrupts:
17881788
*
17891789
* GICD_CTRL.DS | SCR_EL3.FIQ | ICC_PMR_EL1 | Group 1 priority

drivers/irqchip/irq-mips-gic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,10 @@ static int __init gic_of_init(struct device_node *node,
783783
}
784784

785785
mips_gic_base = ioremap(gic_base, gic_len);
786+
if (!mips_gic_base) {
787+
pr_err("Failed to ioremap gic_base\n");
788+
return -ENOMEM;
789+
}
786790

787791
gicconfig = read_gic_config();
788792
gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig);

drivers/pinctrl/pinctrl-ocelot.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,7 @@ static void ocelot_irq_mask(struct irq_data *data)
17611761

17621762
regmap_update_bits(info->map, REG(OCELOT_GPIO_INTR_ENA, info, gpio),
17631763
BIT(gpio % 32), 0);
1764+
gpiochip_disable_irq(chip, gpio);
17641765
}
17651766

17661767
static void ocelot_irq_unmask(struct irq_data *data)
@@ -1769,6 +1770,7 @@ static void ocelot_irq_unmask(struct irq_data *data)
17691770
struct ocelot_pinctrl *info = gpiochip_get_data(chip);
17701771
unsigned int gpio = irqd_to_hwirq(data);
17711772

1773+
gpiochip_enable_irq(chip, gpio);
17721774
regmap_update_bits(info->map, REG(OCELOT_GPIO_INTR_ENA, info, gpio),
17731775
BIT(gpio % 32), BIT(gpio % 32));
17741776
}
@@ -1790,8 +1792,10 @@ static struct irq_chip ocelot_eoi_irqchip = {
17901792
.irq_mask = ocelot_irq_mask,
17911793
.irq_eoi = ocelot_irq_ack,
17921794
.irq_unmask = ocelot_irq_unmask,
1793-
.flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED,
1795+
.flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED |
1796+
IRQCHIP_IMMUTABLE,
17941797
.irq_set_type = ocelot_irq_set_type,
1798+
GPIOCHIP_IRQ_RESOURCE_HELPERS
17951799
};
17961800

17971801
static struct irq_chip ocelot_irqchip = {
@@ -1800,6 +1804,8 @@ static struct irq_chip ocelot_irqchip = {
18001804
.irq_ack = ocelot_irq_ack,
18011805
.irq_unmask = ocelot_irq_unmask,
18021806
.irq_set_type = ocelot_irq_set_type,
1807+
.flags = IRQCHIP_IMMUTABLE,
1808+
GPIOCHIP_IRQ_RESOURCE_HELPERS
18031809
};
18041810

18051811
static int ocelot_irq_set_type(struct irq_data *data, unsigned int type)
@@ -1863,7 +1869,7 @@ static int ocelot_gpiochip_register(struct platform_device *pdev,
18631869
irq = platform_get_irq_optional(pdev, 0);
18641870
if (irq > 0) {
18651871
girq = &gc->irq;
1866-
girq->chip = &ocelot_irqchip;
1872+
gpio_irq_chip_set_chip(girq, &ocelot_irqchip);
18671873
girq->parent_handler = ocelot_irq_handler;
18681874
girq->num_parents = 1;
18691875
girq->parents = devm_kcalloc(&pdev->dev, 1,

include/linux/irqchip/mmp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44

55
extern struct irq_chip icu_irq_chip;
66

7+
extern void icu_init_irq(void);
8+
extern void mmp2_init_icu(void);
9+
710
#endif /* __IRQCHIP_MMP_H */

include/linux/irqdesc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,15 @@ static inline void irq_set_handler_locked(struct irq_data *data,
209209
* Must be called with irq_desc locked and valid parameters.
210210
*/
211211
static inline void
212-
irq_set_chip_handler_name_locked(struct irq_data *data, struct irq_chip *chip,
212+
irq_set_chip_handler_name_locked(struct irq_data *data,
213+
const struct irq_chip *chip,
213214
irq_flow_handler_t handler, const char *name)
214215
{
215216
struct irq_desc *desc = irq_data_to_desc(data);
216217

217218
desc->handle_irq = handler;
218219
desc->name = name;
219-
data->chip = chip;
220+
data->chip = (struct irq_chip *)chip;
220221
}
221222

222223
bool irq_check_status_bit(unsigned int irq, unsigned int bitmask);

kernel/irq/irqdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static ssize_t actions_show(struct kobject *kobj,
251251
char *p = "";
252252

253253
raw_spin_lock_irq(&desc->lock);
254-
for (action = desc->action; action != NULL; action = action->next) {
254+
for_each_action_of_desc(desc, action) {
255255
ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
256256
p, action->name);
257257
p = ",";

kernel/irq/irqdomain.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s
147147
static atomic_t unknown_domains;
148148

149149
if (WARN_ON((size && direct_max) ||
150-
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max)))
150+
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max) ||
151+
(direct_max && (direct_max != hwirq_max))))
151152
return NULL;
152153

153154
domain = kzalloc_node(struct_size(domain, revmap, size),
@@ -219,7 +220,6 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s
219220
domain->hwirq_max = hwirq_max;
220221

221222
if (direct_max) {
222-
size = direct_max;
223223
domain->flags |= IRQ_DOMAIN_FLAG_NO_MAP;
224224
}
225225

@@ -650,9 +650,9 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain)
650650
pr_debug("create_direct virq allocation failed\n");
651651
return 0;
652652
}
653-
if (virq >= domain->revmap_size) {
654-
pr_err("ERROR: no free irqs available below %i maximum\n",
655-
domain->revmap_size);
653+
if (virq >= domain->hwirq_max) {
654+
pr_err("ERROR: no free irqs available below %lu maximum\n",
655+
domain->hwirq_max);
656656
irq_free_desc(virq);
657657
return 0;
658658
}
@@ -906,10 +906,12 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domain *domain,
906906
return desc;
907907

908908
if (irq_domain_is_nomap(domain)) {
909-
if (hwirq < domain->revmap_size) {
909+
if (hwirq < domain->hwirq_max) {
910910
data = irq_domain_get_irq_data(domain, hwirq);
911911
if (data && data->hwirq == hwirq)
912912
desc = irq_data_to_desc(data);
913+
if (irq && desc)
914+
*irq = hwirq;
913915
}
914916

915917
return desc;

0 commit comments

Comments
 (0)