forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/arch/powerpc/platforms/powermac/pic.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Support for the interrupt controllers found on Power Macintosh,
34 * currently Apple's "Grand Central" interrupt controller in all
....@@ -7,12 +8,6 @@
78 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org)
89 * Copyright (C) 2005 Benjamin Herrenschmidt (benh@kernel.crashing.org)
910 * IBM, Corp.
10
- *
11
- * This program is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU General Public License
13
- * as published by the Free Software Foundation; either version
14
- * 2 of the License, or (at your option) any later version.
15
- *
1611 */
1712
1813 #include <linux/stddef.h>
....@@ -255,20 +250,6 @@
255250 return irq_linear_revmap(pmac_pic_host, irq);
256251 }
257252
258
-#ifdef CONFIG_XMON
259
-static struct irqaction xmon_action = {
260
- .handler = xmon_irq,
261
- .flags = IRQF_NO_THREAD,
262
- .name = "NMI - XMON"
263
-};
264
-#endif
265
-
266
-static struct irqaction gatwick_cascade_action = {
267
- .handler = gatwick_action,
268
- .flags = IRQF_NO_THREAD,
269
- .name = "cascade",
270
-};
271
-
272253 static int pmac_pic_host_match(struct irq_domain *h, struct device_node *node,
273254 enum irq_domain_bus_token bus_token)
274255 {
....@@ -389,12 +370,17 @@
389370 out_le32(&pmac_irq_hw[i]->enable, 0);
390371
391372 /* Hookup cascade irq */
392
- if (slave && pmac_irq_cascade)
393
- setup_irq(pmac_irq_cascade, &gatwick_cascade_action);
373
+ if (slave && pmac_irq_cascade) {
374
+ if (request_irq(pmac_irq_cascade, gatwick_action,
375
+ IRQF_NO_THREAD, "cascade", NULL))
376
+ pr_err("Failed to register cascade interrupt\n");
377
+ }
394378
395379 printk(KERN_INFO "irq: System has %d possible interrupts\n", max_irqs);
396380 #ifdef CONFIG_XMON
397
- setup_irq(irq_create_mapping(NULL, 20), &xmon_action);
381
+ i = irq_create_mapping(NULL, 20);
382
+ if (request_irq(i, xmon_irq, IRQF_NO_THREAD, "NMI - XMON", NULL))
383
+ pr_err("Failed to register NMI-XMON interrupt\n");
398384 #endif
399385 }
400386
....@@ -417,7 +403,7 @@
417403 if (ints != NULL)
418404 break;
419405 device = device->parent;
420
- if (device && strcmp(device->type, "pci") != 0)
406
+ if (!of_node_is_type(device, "pci"))
421407 break;
422408 }
423409 if (ints == NULL)
....@@ -446,7 +432,9 @@
446432 nmi_irq = irq_of_parse_and_map(pswitch, 0);
447433 if (nmi_irq) {
448434 mpic_irq_set_priority(nmi_irq, 9);
449
- setup_irq(nmi_irq, &xmon_action);
435
+ if (request_irq(nmi_irq, xmon_irq, IRQF_NO_THREAD,
436
+ "NMI - XMON", NULL))
437
+ pr_err("Failed to register NMI-XMON interrupt\n");
450438 }
451439 of_node_put(pswitch);
452440 }
....@@ -553,13 +541,13 @@
553541
554542 for_each_node_with_property(np, "interrupt-controller") {
555543 /* Skip /chosen/interrupt-controller */
556
- if (strcmp(np->name, "chosen") == 0)
544
+ if (of_node_name_eq(np, "chosen"))
557545 continue;
558546 /* It seems like at least one person wants
559547 * to use BootX on a machine with an AppleKiwi
560548 * controller which happens to pretend to be an
561549 * interrupt controller too. */
562
- if (strcmp(np->name, "AppleKiwi") == 0)
550
+ if (of_node_name_eq(np, "AppleKiwi"))
563551 continue;
564552 /* I think we found one ! */
565553 of_irq_dflt_pic = np;