[PATCH v4 4/5] irqchip/loongson-liointc: Fix 'loongson,parent_int_map' parse

Binbin Zhou
2023-11-13T02:37:06Z

While 'loongson,parent_int_map' is deprecated, we need to make sure that
both forms can be parsed.

Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
drivers/irqchip/irq-loongson-liointc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c
index e4b33aed1c97..add2e0a955b8 100644
--- a/drivers/irqchip/irq-loongson-liointc.c
+++ b/drivers/irqchip/irq-loongson-liointc.c
@@ -330,6 +330,7 @@ static int __init liointc_of_init(struct device_node *node,
bool have_parent = FALSE;
int sz, i, index, revision, err = 0;
struct resource res;
+ const char *prop_name = "loongson,parent-int-map";

if (!of_device_is_compatible(node, "loongson,liointc-2.0")) {
index = 0;
@@ -350,8 +351,12 @@ static int __init liointc_of_init(struct device_node *node,
if (!have_parent)
return -ENODEV;

+ if (!of_find_property(node, prop_name, &i))
+ /* Fallback to 'loongson,parent_int_map', although it is deprecated. */
+ prop_name = "loongson,parent_int_map";
+
sz = of_property_read_variable_u32_array(node,
- "loongson,parent_int_map",
+ prop_name,
&parent_int_map[0],
LIOINTC_NUM_PARENT,
LIOINTC_NUM_PARENT);
--
2.39.3