Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch irq/print_chip into irq/irqchip-next

* irq/print_chip:
: .
: Convert irqchip drivers that use the .name field as a topology
: description to the .irq_print_chip callback, which allows the
: name to be made dymanic. The irq_chip structures are then made
: 'const' in order to prevent further abuse.
: .
irqchip/versatile-fpga: Switch to dynamic chip name output
irqchip/ts4800: Switch to dynamic chip name output
irqchip/mvebu-pic: Switch to dynamic chip name output
irqchip/lpc32xx: Switch to dynamic chip name output
irqchip/gic: Switch to dynamic chip name output
genirq/debugfs: Use irq_print_chip() when provided by irqchip
genirq: Allow irq_chip registration functions to take a const irq_chip
irqdomain: Let irq_domain_set_{info,hwirq_and_chip} take a const irq_chip

Signed-off-by: Marc Zyngier <maz@kernel.org>

+158 -130
-1
drivers/irqchip/irq-ftintc010.c
··· 11 11 #include <linux/irq.h> 12 12 #include <linux/io.h> 13 13 #include <linux/irqchip.h> 14 - #include <linux/irqchip/versatile-fpga.h> 15 14 #include <linux/irqdomain.h> 16 15 #include <linux/module.h> 17 16 #include <linux/of.h>
+54 -48
drivers/irqchip/irq-gic.c
··· 34 34 #include <linux/irqdomain.h> 35 35 #include <linux/interrupt.h> 36 36 #include <linux/percpu.h> 37 + #include <linux/seq_file.h> 37 38 #include <linux/slab.h> 38 39 #include <linux/irqchip.h> 39 40 #include <linux/irqchip/chained_irq.h> ··· 67 66 }; 68 67 69 68 struct gic_chip_data { 70 - struct irq_chip chip; 71 69 union gic_base dist_base; 72 70 union gic_base cpu_base; 73 71 void __iomem *raw_dist_base; ··· 397 397 chained_irq_exit(chip, desc); 398 398 } 399 399 400 - static const struct irq_chip gic_chip = { 401 - .irq_mask = gic_mask_irq, 402 - .irq_unmask = gic_unmask_irq, 403 - .irq_eoi = gic_eoi_irq, 404 - .irq_set_type = gic_set_type, 405 - .irq_retrigger = gic_retrigger, 406 - .irq_get_irqchip_state = gic_irq_get_irqchip_state, 407 - .irq_set_irqchip_state = gic_irq_set_irqchip_state, 408 - .flags = IRQCHIP_SET_TYPE_MASKED | 409 - IRQCHIP_SKIP_SET_WAKE | 410 - IRQCHIP_MASK_ON_SUSPEND, 411 - }; 400 + static void gic_irq_print_chip(struct irq_data *d, struct seq_file *p) 401 + { 402 + struct gic_chip_data *gic = irq_data_get_irq_chip_data(d); 403 + 404 + if (gic->domain->dev) 405 + seq_printf(p, gic->domain->dev->of_node->name); 406 + else 407 + seq_printf(p, "GIC-%d", (int)(gic - &gic_data[0])); 408 + } 412 409 413 410 void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) 414 411 { ··· 796 799 bool force) 797 800 { 798 801 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + gic_irq(d); 802 + struct gic_chip_data *gic = irq_data_get_irq_chip_data(d); 799 803 unsigned int cpu; 804 + 805 + if (unlikely(gic != &gic_data[0])) 806 + return -EINVAL; 800 807 801 808 if (!force) 802 809 cpu = cpumask_any_and(mask_val, cpu_online_mask); ··· 880 879 #define gic_set_affinity NULL 881 880 #define gic_ipi_send_mask NULL 882 881 #endif 882 + 883 + static const struct irq_chip gic_chip = { 884 + .irq_mask = gic_mask_irq, 885 + .irq_unmask = gic_unmask_irq, 886 + .irq_eoi = gic_eoi_irq, 887 + .irq_set_type = gic_set_type, 888 + .irq_retrigger = gic_retrigger, 889 + .irq_set_affinity = gic_set_affinity, 890 + .ipi_send_mask = gic_ipi_send_mask, 891 + .irq_get_irqchip_state = gic_irq_get_irqchip_state, 892 + .irq_set_irqchip_state = gic_irq_set_irqchip_state, 893 + .irq_print_chip = gic_irq_print_chip, 894 + .flags = IRQCHIP_SET_TYPE_MASKED | 895 + IRQCHIP_SKIP_SET_WAKE | 896 + IRQCHIP_MASK_ON_SUSPEND, 897 + }; 898 + 899 + static const struct irq_chip gic_chip_mode1 = { 900 + .name = "GICv2", 901 + .irq_mask = gic_eoimode1_mask_irq, 902 + .irq_unmask = gic_unmask_irq, 903 + .irq_eoi = gic_eoimode1_eoi_irq, 904 + .irq_set_type = gic_set_type, 905 + .irq_retrigger = gic_retrigger, 906 + .irq_set_affinity = gic_set_affinity, 907 + .ipi_send_mask = gic_ipi_send_mask, 908 + .irq_get_irqchip_state = gic_irq_get_irqchip_state, 909 + .irq_set_irqchip_state = gic_irq_set_irqchip_state, 910 + .irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity, 911 + .flags = IRQCHIP_SET_TYPE_MASKED | 912 + IRQCHIP_SKIP_SET_WAKE | 913 + IRQCHIP_MASK_ON_SUSPEND, 914 + }; 883 915 884 916 #ifdef CONFIG_BL_SWITCHER 885 917 /* ··· 1058 1024 { 1059 1025 struct gic_chip_data *gic = d->host_data; 1060 1026 struct irq_data *irqd = irq_desc_get_irq_data(irq_to_desc(irq)); 1027 + const struct irq_chip *chip; 1028 + 1029 + chip = (static_branch_likely(&supports_deactivate_key) && 1030 + gic == &gic_data[0]) ? &gic_chip_mode1 : &gic_chip; 1061 1031 1062 1032 switch (hw) { 1063 1033 case 0 ... 31: 1064 1034 irq_set_percpu_devid(irq); 1065 - irq_domain_set_info(d, irq, hw, &gic->chip, d->host_data, 1035 + irq_domain_set_info(d, irq, hw, chip, d->host_data, 1066 1036 handle_percpu_devid_irq, NULL, NULL); 1067 1037 break; 1068 1038 default: 1069 - irq_domain_set_info(d, irq, hw, &gic->chip, d->host_data, 1039 + irq_domain_set_info(d, irq, hw, chip, d->host_data, 1070 1040 handle_fasteoi_irq, NULL, NULL); 1071 1041 irq_set_probe(irq); 1072 1042 irqd_set_single_target(irqd); ··· 1164 1126 .map = gic_irq_domain_map, 1165 1127 .unmap = gic_irq_domain_unmap, 1166 1128 }; 1167 - 1168 - static void gic_init_chip(struct gic_chip_data *gic, const char *name, 1169 - bool use_eoimode1) 1170 - { 1171 - /* Initialize irq_chip */ 1172 - gic->chip = gic_chip; 1173 - gic->chip.name = name; 1174 - 1175 - if (use_eoimode1) { 1176 - gic->chip.irq_mask = gic_eoimode1_mask_irq; 1177 - gic->chip.irq_eoi = gic_eoimode1_eoi_irq; 1178 - gic->chip.irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity; 1179 - } 1180 - 1181 - if (gic == &gic_data[0]) { 1182 - gic->chip.irq_set_affinity = gic_set_affinity; 1183 - gic->chip.ipi_send_mask = gic_ipi_send_mask; 1184 - } 1185 - } 1186 1129 1187 1130 static int gic_init_bases(struct gic_chip_data *gic, 1188 1131 struct fwnode_handle *handle) ··· 1264 1245 static int __init __gic_init_bases(struct gic_chip_data *gic, 1265 1246 struct fwnode_handle *handle) 1266 1247 { 1267 - char *name; 1268 1248 int i, ret; 1269 1249 1270 1250 if (WARN_ON(!gic || gic->domain)) ··· 1283 1265 pr_info("GIC: Using split EOI/Deactivate mode\n"); 1284 1266 } 1285 1267 1286 - if (static_branch_likely(&supports_deactivate_key) && gic == &gic_data[0]) { 1287 - name = kasprintf(GFP_KERNEL, "GICv2"); 1288 - gic_init_chip(gic, name, true); 1289 - } else { 1290 - name = kasprintf(GFP_KERNEL, "GIC-%d", (int)(gic-&gic_data[0])); 1291 - gic_init_chip(gic, name, false); 1292 - } 1293 - 1294 1268 ret = gic_init_bases(gic, handle); 1295 - if (ret) 1296 - kfree(name); 1297 - else if (gic == &gic_data[0]) 1269 + if (gic == &gic_data[0]) 1298 1270 gic_smp_init(); 1299 1271 1300 1272 return ret; ··· 1466 1458 *gic = devm_kzalloc(dev, sizeof(**gic), GFP_KERNEL); 1467 1459 if (!*gic) 1468 1460 return -ENOMEM; 1469 - 1470 - gic_init_chip(*gic, dev->of_node->name, false); 1471 1461 1472 1462 ret = gic_of_setup(*gic, dev->of_node); 1473 1463 if (ret)
+22 -12
drivers/irqchip/irq-lpc32xx.c
··· 11 11 #include <linux/of_address.h> 12 12 #include <linux/of_irq.h> 13 13 #include <linux/of_platform.h> 14 + #include <linux/seq_file.h> 14 15 #include <linux/slab.h> 15 16 #include <asm/exception.h> 16 17 ··· 26 25 27 26 struct lpc32xx_irq_chip { 28 27 void __iomem *base; 28 + phys_addr_t addr; 29 29 struct irq_domain *domain; 30 - struct irq_chip chip; 31 30 }; 32 31 33 32 static struct lpc32xx_irq_chip *lpc32xx_mic_irqc; ··· 119 118 return 0; 120 119 } 121 120 121 + static void lpc32xx_irq_print_chip(struct irq_data *d, struct seq_file *p) 122 + { 123 + struct lpc32xx_irq_chip *ic = irq_data_get_irq_chip_data(d); 124 + 125 + if (ic == lpc32xx_mic_irqc) 126 + seq_printf(p, "%08x.mic", ic->addr); 127 + else 128 + seq_printf(p, "%08x.sic", ic->addr); 129 + } 130 + 131 + static const struct irq_chip lpc32xx_chip = { 132 + .irq_ack = lpc32xx_irq_ack, 133 + .irq_mask = lpc32xx_irq_mask, 134 + .irq_unmask = lpc32xx_irq_unmask, 135 + .irq_set_type = lpc32xx_irq_set_type, 136 + .irq_print_chip = lpc32xx_irq_print_chip, 137 + }; 138 + 122 139 static void __exception_irq_entry lpc32xx_handle_irq(struct pt_regs *regs) 123 140 { 124 141 struct lpc32xx_irq_chip *ic = lpc32xx_mic_irqc; ··· 172 153 struct lpc32xx_irq_chip *ic = id->host_data; 173 154 174 155 irq_set_chip_data(virq, ic); 175 - irq_set_chip_and_handler(virq, &ic->chip, handle_level_irq); 156 + irq_set_chip_and_handler(virq, &lpc32xx_chip, handle_level_irq); 176 157 irq_set_status_flags(virq, IRQ_LEVEL); 177 158 irq_set_noprobe(virq); 178 159 ··· 202 183 if (!irqc) 203 184 return -ENOMEM; 204 185 186 + irqc->addr = addr; 205 187 irqc->base = of_iomap(node, 0); 206 188 if (!irqc->base) { 207 189 pr_err("%pOF: unable to map registers\n", node); ··· 210 190 return -EINVAL; 211 191 } 212 192 213 - irqc->chip.irq_ack = lpc32xx_irq_ack; 214 - irqc->chip.irq_mask = lpc32xx_irq_mask; 215 - irqc->chip.irq_unmask = lpc32xx_irq_unmask; 216 - irqc->chip.irq_set_type = lpc32xx_irq_set_type; 217 - if (is_mic) 218 - irqc->chip.name = kasprintf(GFP_KERNEL, "%08x.mic", addr); 219 - else 220 - irqc->chip.name = kasprintf(GFP_KERNEL, "%08x.sic", addr); 221 - 222 193 irqc->domain = irq_domain_add_linear(node, NR_LPC32XX_IC_IRQS, 223 194 &lpc32xx_irq_domain_ops, irqc); 224 195 if (!irqc->domain) { 225 196 pr_err("unable to add irq domain\n"); 226 197 iounmap(irqc->base); 227 - kfree(irqc->chip.name); 228 198 kfree(irqc); 229 199 return -ENODEV; 230 200 }
+18 -10
drivers/irqchip/irq-mvebu-pic.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/of_irq.h> 20 20 #include <linux/platform_device.h> 21 + #include <linux/seq_file.h> 21 22 22 23 #define PIC_CAUSE 0x0 23 24 #define PIC_MASK 0x4 ··· 30 29 void __iomem *base; 31 30 u32 parent_irq; 32 31 struct irq_domain *domain; 33 - struct irq_chip irq_chip; 32 + struct platform_device *pdev; 34 33 }; 35 34 36 35 static void mvebu_pic_reset(struct mvebu_pic *pic) ··· 67 66 writel(reg, pic->base + PIC_MASK); 68 67 } 69 68 69 + static void mvebu_pic_print_chip(struct irq_data *d, struct seq_file *p) 70 + { 71 + struct mvebu_pic *pic = irq_data_get_irq_chip_data(d); 72 + 73 + seq_printf(p, dev_name(&pic->pdev->dev)); 74 + } 75 + 76 + static const struct irq_chip mvebu_pic_chip = { 77 + .irq_mask = mvebu_pic_mask_irq, 78 + .irq_unmask = mvebu_pic_unmask_irq, 79 + .irq_eoi = mvebu_pic_eoi_irq, 80 + .irq_print_chip = mvebu_pic_print_chip, 81 + }; 82 + 70 83 static int mvebu_pic_irq_map(struct irq_domain *domain, unsigned int virq, 71 84 irq_hw_number_t hwirq) 72 85 { ··· 88 73 89 74 irq_set_percpu_devid(virq); 90 75 irq_set_chip_data(virq, pic); 91 - irq_set_chip_and_handler(virq, &pic->irq_chip, 92 - handle_percpu_devid_irq); 76 + irq_set_chip_and_handler(virq, &mvebu_pic_chip, handle_percpu_devid_irq); 93 77 irq_set_status_flags(virq, IRQ_LEVEL); 94 78 irq_set_probe(virq); 95 79 ··· 134 120 { 135 121 struct device_node *node = pdev->dev.of_node; 136 122 struct mvebu_pic *pic; 137 - struct irq_chip *irq_chip; 138 123 139 124 pic = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pic), GFP_KERNEL); 140 125 if (!pic) 141 126 return -ENOMEM; 142 127 128 + pic->pdev = pdev; 143 129 pic->base = devm_platform_ioremap_resource(pdev, 0); 144 130 if (IS_ERR(pic->base)) 145 131 return PTR_ERR(pic->base); 146 - 147 - irq_chip = &pic->irq_chip; 148 - irq_chip->name = dev_name(&pdev->dev); 149 - irq_chip->irq_mask = mvebu_pic_mask_irq; 150 - irq_chip->irq_unmask = mvebu_pic_unmask_irq; 151 - irq_chip->irq_eoi = mvebu_pic_eoi_irq; 152 132 153 133 pic->parent_irq = irq_of_parse_and_map(node, 0); 154 134 if (pic->parent_irq <= 0) {
+17 -8
drivers/irqchip/irq-ts4800.c
··· 19 19 #include <linux/of_address.h> 20 20 #include <linux/of_irq.h> 21 21 #include <linux/platform_device.h> 22 + #include <linux/seq_file.h> 22 23 23 24 #define IRQ_MASK 0x4 24 25 #define IRQ_STATUS 0x8 25 26 26 27 struct ts4800_irq_data { 27 28 void __iomem *base; 29 + struct platform_device *pdev; 28 30 struct irq_domain *domain; 29 - struct irq_chip irq_chip; 30 31 }; 31 32 32 33 static void ts4800_irq_mask(struct irq_data *d) ··· 48 47 writew(reg & ~mask, data->base + IRQ_MASK); 49 48 } 50 49 50 + static void ts4800_irq_print_chip(struct irq_data *d, struct seq_file *p) 51 + { 52 + struct ts4800_irq_data *data = irq_data_get_irq_chip_data(d); 53 + 54 + seq_printf(p, "%s", dev_name(&data->pdev->dev)); 55 + } 56 + 57 + static const struct irq_chip ts4800_chip = { 58 + .irq_mask = ts4800_irq_mask, 59 + .irq_unmask = ts4800_irq_unmask, 60 + .irq_print_chip = ts4800_irq_print_chip, 61 + }; 62 + 51 63 static int ts4800_irqdomain_map(struct irq_domain *d, unsigned int irq, 52 64 irq_hw_number_t hwirq) 53 65 { 54 66 struct ts4800_irq_data *data = d->host_data; 55 67 56 - irq_set_chip_and_handler(irq, &data->irq_chip, handle_simple_irq); 68 + irq_set_chip_and_handler(irq, &ts4800_chip, handle_simple_irq); 57 69 irq_set_chip_data(irq, data); 58 70 irq_set_noprobe(irq); 59 71 ··· 106 92 { 107 93 struct device_node *node = pdev->dev.of_node; 108 94 struct ts4800_irq_data *data; 109 - struct irq_chip *irq_chip; 110 95 int parent_irq; 111 96 112 97 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 113 98 if (!data) 114 99 return -ENOMEM; 115 100 101 + data->pdev = pdev; 116 102 data->base = devm_platform_ioremap_resource(pdev, 0); 117 103 if (IS_ERR(data->base)) 118 104 return PTR_ERR(data->base); ··· 124 110 dev_err(&pdev->dev, "failed to get parent IRQ\n"); 125 111 return -EINVAL; 126 112 } 127 - 128 - irq_chip = &data->irq_chip; 129 - irq_chip->name = dev_name(&pdev->dev); 130 - irq_chip->irq_mask = ts4800_irq_mask; 131 - irq_chip->irq_unmask = ts4800_irq_unmask; 132 113 133 114 data->domain = irq_domain_add_linear(node, 8, &ts4800_ic_ops, data); 134 115 if (!data->domain) {
+26 -20
drivers/irqchip/irq-versatile-fpga.c
··· 7 7 #include <linux/io.h> 8 8 #include <linux/irqchip.h> 9 9 #include <linux/irqchip/chained_irq.h> 10 - #include <linux/irqchip/versatile-fpga.h> 11 10 #include <linux/irqdomain.h> 12 11 #include <linux/module.h> 13 12 #include <linux/of.h> 14 13 #include <linux/of_address.h> 15 14 #include <linux/of_irq.h> 15 + #include <linux/seq_file.h> 16 16 17 17 #include <asm/exception.h> 18 18 #include <asm/mach/irq.h> ··· 34 34 /** 35 35 * struct fpga_irq_data - irq data container for the FPGA IRQ controller 36 36 * @base: memory offset in virtual memory 37 - * @chip: chip container for this instance 38 37 * @domain: IRQ domain for this instance 39 38 * @valid: mask for valid IRQs on this controller 40 39 * @used_irqs: number of active IRQs on this controller 41 40 */ 42 41 struct fpga_irq_data { 43 42 void __iomem *base; 44 - struct irq_chip chip; 45 43 u32 valid; 46 44 struct irq_domain *domain; 47 45 u8 used_irqs; ··· 64 66 65 67 writel(mask, f->base + IRQ_ENABLE_SET); 66 68 } 69 + 70 + static void fpga_irq_print_chip(struct irq_data *d, struct seq_file *p) 71 + { 72 + struct fpga_irq_data *f = irq_data_get_irq_chip_data(d); 73 + 74 + seq_printf(p, irq_domain_get_of_node(f->domain)->name); 75 + } 76 + 77 + static const struct irq_chip fpga_chip = { 78 + .irq_ack = fpga_irq_mask, 79 + .irq_mask = fpga_irq_mask, 80 + .irq_unmask = fpga_irq_unmask, 81 + .irq_print_chip = fpga_irq_print_chip, 82 + }; 67 83 68 84 static void fpga_irq_handle(struct irq_desc *desc) 69 85 { ··· 128 116 * Keep iterating over all registered FPGA IRQ controllers until there are 129 117 * no pending interrupts. 130 118 */ 131 - asmlinkage void __exception_irq_entry fpga_handle_irq(struct pt_regs *regs) 119 + static asmlinkage void __exception_irq_entry fpga_handle_irq(struct pt_regs *regs) 132 120 { 133 121 int i, handled; 134 122 ··· 147 135 if (!(f->valid & BIT(hwirq))) 148 136 return -EPERM; 149 137 irq_set_chip_data(irq, f); 150 - irq_set_chip_and_handler(irq, &f->chip, 151 - handle_level_irq); 138 + irq_set_chip_and_handler(irq, &fpga_chip, handle_level_irq); 152 139 irq_set_probe(irq); 153 140 return 0; 154 141 } ··· 157 146 .xlate = irq_domain_xlate_onetwocell, 158 147 }; 159 148 160 - void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start, 161 - int parent_irq, u32 valid, struct device_node *node) 149 + static void __init fpga_irq_init(void __iomem *base, int parent_irq, 150 + u32 valid, struct device_node *node) 162 151 { 163 152 struct fpga_irq_data *f; 164 153 int i; ··· 169 158 } 170 159 f = &fpga_irq_devices[fpga_irq_id]; 171 160 f->base = base; 172 - f->chip.name = name; 173 - f->chip.irq_ack = fpga_irq_mask; 174 - f->chip.irq_mask = fpga_irq_mask; 175 - f->chip.irq_unmask = fpga_irq_unmask; 176 161 f->valid = valid; 177 162 178 163 if (parent_irq != -1) { ··· 176 169 f); 177 170 } 178 171 179 - /* This will also allocate irq descriptors */ 180 - f->domain = irq_domain_add_simple(node, fls(valid), irq_start, 172 + f->domain = irq_domain_add_linear(node, fls(valid), 181 173 &fpga_irqdomain_ops, f); 182 174 183 175 /* This will allocate all valid descriptors in the linear case */ 184 176 for (i = 0; i < fls(valid); i++) 185 177 if (valid & BIT(i)) { 186 - if (!irq_start) 187 - irq_create_mapping(f->domain, i); 178 + /* Is this still required? */ 179 + irq_create_mapping(f->domain, i); 188 180 f->used_irqs++; 189 181 } 190 182 191 183 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs", 192 - fpga_irq_id, name, base, f->used_irqs); 184 + fpga_irq_id, node->name, base, f->used_irqs); 193 185 if (parent_irq != -1) 194 186 pr_cont(", parent IRQ: %d\n", parent_irq); 195 187 else ··· 198 192 } 199 193 200 194 #ifdef CONFIG_OF 201 - int __init fpga_irq_of_init(struct device_node *node, 202 - struct device_node *parent) 195 + static int __init fpga_irq_of_init(struct device_node *node, 196 + struct device_node *parent) 203 197 { 204 198 void __iomem *base; 205 199 u32 clear_mask; ··· 228 222 parent_irq = -1; 229 223 } 230 224 231 - fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node); 225 + fpga_irq_init(base, parent_irq, valid_mask, node); 232 226 233 227 /* 234 228 * On Versatile AB/PB, some secondary interrupts have a direct
+4 -3
include/linux/irq.h
··· 710 710 extern struct irq_chip dummy_irq_chip; 711 711 712 712 extern void 713 - irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, 713 + irq_set_chip_and_handler_name(unsigned int irq, const struct irq_chip *chip, 714 714 irq_flow_handler_t handle, const char *name); 715 715 716 - static inline void irq_set_chip_and_handler(unsigned int irq, struct irq_chip *chip, 716 + static inline void irq_set_chip_and_handler(unsigned int irq, 717 + const struct irq_chip *chip, 717 718 irq_flow_handler_t handle) 718 719 { 719 720 irq_set_chip_and_handler_name(irq, chip, handle, NULL); ··· 804 803 } 805 804 806 805 /* Set/get chip/data for an IRQ: */ 807 - extern int irq_set_chip(unsigned int irq, struct irq_chip *chip); 806 + extern int irq_set_chip(unsigned int irq, const struct irq_chip *chip); 808 807 extern int irq_set_handler_data(unsigned int irq, void *data); 809 808 extern int irq_set_chip_data(unsigned int irq, void *data); 810 809 extern int irq_set_irq_type(unsigned int irq, unsigned int type);
-14
include/linux/irqchip/versatile-fpga.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef PLAT_FPGA_IRQ_H 3 - #define PLAT_FPGA_IRQ_H 4 - 5 - struct device_node; 6 - struct pt_regs; 7 - 8 - void fpga_handle_irq(struct pt_regs *regs); 9 - void fpga_irq_init(void __iomem *, const char *, int, int, u32, 10 - struct device_node *node); 11 - int fpga_irq_of_init(struct device_node *node, 12 - struct device_node *parent); 13 - 14 - #endif
+3 -2
include/linux/irqdomain.h
··· 479 479 extern struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain, 480 480 unsigned int virq); 481 481 extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, 482 - irq_hw_number_t hwirq, struct irq_chip *chip, 482 + irq_hw_number_t hwirq, 483 + const struct irq_chip *chip, 483 484 void *chip_data, irq_flow_handler_t handler, 484 485 void *handler_data, const char *handler_name); 485 486 extern void irq_domain_reset_irq_data(struct irq_data *irq_data); ··· 523 522 extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain, 524 523 unsigned int virq, 525 524 irq_hw_number_t hwirq, 526 - struct irq_chip *chip, 525 + const struct irq_chip *chip, 527 526 void *chip_data); 528 527 extern void irq_domain_free_irqs_common(struct irq_domain *domain, 529 528 unsigned int virq,
+3 -6
kernel/irq/chip.c
··· 38 38 * @irq: irq number 39 39 * @chip: pointer to irq chip description structure 40 40 */ 41 - int irq_set_chip(unsigned int irq, struct irq_chip *chip) 41 + int irq_set_chip(unsigned int irq, const struct irq_chip *chip) 42 42 { 43 43 unsigned long flags; 44 44 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); ··· 46 46 if (!desc) 47 47 return -EINVAL; 48 48 49 - if (!chip) 50 - chip = &no_irq_chip; 51 - 52 - desc->irq_data.chip = chip; 49 + desc->irq_data.chip = (struct irq_chip *)(chip ?: &no_irq_chip); 53 50 irq_put_desc_unlock(desc, flags); 54 51 /* 55 52 * For !CONFIG_SPARSE_IRQ make the irq show up in ··· 1070 1073 EXPORT_SYMBOL_GPL(irq_set_chained_handler_and_data); 1071 1074 1072 1075 void 1073 - irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, 1076 + irq_set_chip_and_handler_name(unsigned int irq, const struct irq_chip *chip, 1074 1077 irq_flow_handler_t handle, const char *name) 1075 1078 { 1076 1079 irq_set_chip(irq, chip);
+6 -2
kernel/irq/debugfs.c
··· 69 69 seq_printf(m, "chip: None\n"); 70 70 return; 71 71 } 72 - seq_printf(m, "%*schip: %s\n", ind, "", chip->name); 73 - seq_printf(m, "%*sflags: 0x%lx\n", ind + 1, "", chip->flags); 72 + seq_printf(m, "%*schip: ", ind, ""); 73 + if (chip->irq_print_chip) 74 + chip->irq_print_chip(data, m); 75 + else 76 + seq_printf(m, "%s", chip->name); 77 + seq_printf(m, "\n%*sflags: 0x%lx\n", ind + 1, "", chip->flags); 74 78 irq_debug_show_bits(m, ind, chip->flags, irqchip_flags, 75 79 ARRAY_SIZE(irqchip_flags)); 76 80 }
+5 -4
kernel/irq/irqdomain.c
··· 1319 1319 * @chip_data: The associated chip data 1320 1320 */ 1321 1321 int irq_domain_set_hwirq_and_chip(struct irq_domain *domain, unsigned int virq, 1322 - irq_hw_number_t hwirq, struct irq_chip *chip, 1322 + irq_hw_number_t hwirq, 1323 + const struct irq_chip *chip, 1323 1324 void *chip_data) 1324 1325 { 1325 1326 struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq); ··· 1329 1328 return -ENOENT; 1330 1329 1331 1330 irq_data->hwirq = hwirq; 1332 - irq_data->chip = chip ? chip : &no_irq_chip; 1331 + irq_data->chip = (struct irq_chip *)(chip ? chip : &no_irq_chip); 1333 1332 irq_data->chip_data = chip_data; 1334 1333 1335 1334 return 0; ··· 1348 1347 * @handler_name: The interrupt handler name 1349 1348 */ 1350 1349 void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, 1351 - irq_hw_number_t hwirq, struct irq_chip *chip, 1350 + irq_hw_number_t hwirq, const struct irq_chip *chip, 1352 1351 void *chip_data, irq_flow_handler_t handler, 1353 1352 void *handler_data, const char *handler_name) 1354 1353 { ··· 1854 1853 * @handler_name: The interrupt handler name 1855 1854 */ 1856 1855 void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, 1857 - irq_hw_number_t hwirq, struct irq_chip *chip, 1856 + irq_hw_number_t hwirq, const struct irq_chip *chip, 1858 1857 void *chip_data, irq_flow_handler_t handler, 1859 1858 void *handler_data, const char *handler_name) 1860 1859 {