Skip to contentSkip to conversation

mfd: Fix compilation without CONFIG_OF

PATCH In review Mario Limonciello 2 participants 5 messages Jun 2, 2025 – Jun 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: Fix compilation without CONFIG_OF

From: Mario Limonciello <[email protected]>

When compiling without CONFIG_OF but with CONFIG_WERROR enabled several mfd drivers fail with -Werror=unused-variable.

The assignment from these variables is only used in of_fwnode_handle() and thus they can be moved to only be used directly in the macro.

Fixes a36aa0f7226a2 ("mfd: Switch to irq_domain_create_*()")
---
 drivers/mfd/88pm860x-core.c | 5 ++---
 drivers/mfd/max8925-core.c  | 5 ++---
 drivers/mfd/twl4030-irq.c   | 3 +--
 3 files changed, 5 insertions(+), 8 deletions(-)
drivers/mfd/88pm860x-core.c +2 -3
index 488e346047c12..25300b53a8eff 100644
@@ -573,7 +573,6 @@ static int device_irq_init(struct pm860x_chip *chip,
 	unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;
 	int data, mask, ret = -EINVAL;
 	int nr_irqs, irq_base = -1;
-	struct device_node *node = i2c->dev.of_node;
 
 	mask = PM8607_B0_MISC1_INV_INT | PM8607_B0_MISC1_INT_CLEAR
 		| PM8607_B0_MISC1_INT_MASK;
@@ -624,8 +623,8 @@ static int device_irq_init(struct pm860x_chip *chip,
 		ret = -EBUSY;
 		goto out;
 	}
-	irq_domain_create_legacy(of_fwnode_handle(node), nr_irqs, chip->irq_base, 0,
-				 &pm860x_irq_domain_ops, chip);
+	irq_domain_create_legacy(of_fwnode_handle(i2c->dev.of_node), nr_irqs,
+				 chip->irq_base, 0, &pm860x_irq_domain_ops, chip);
 	chip->core_irq = i2c->irq;
 	if (!chip->core_irq)
 		goto out;
drivers/mfd/max8925-core.c +2 -3
index 78b16c67a5fc6..91388477ad2b7 100644
@@ -656,7 +656,6 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq,
 {
 	unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;
 	int ret;
-	struct device_node *node = chip->dev->of_node;
 
 	/* clear all interrupts */
 	max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ1);
@@ -682,8 +681,8 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq,
 		return -EBUSY;
 	}
 
-	irq_domain_create_legacy(of_fwnode_handle(node), MAX8925_NR_IRQS, chip->irq_base, 0,
-				 &max8925_irq_domain_ops, chip);
+	irq_domain_create_legacy(of_fwnode_handle(chip->dev->of_node), MAX8925_NR_IRQS,
+				 chip->irq_base, 0, &max8925_irq_domain_ops, chip);
 
 	/* request irq handler for pmic main irq*/
 	chip->core_irq = irq;
drivers/mfd/twl4030-irq.c +1 -2
index 232c2bfe8c180..a2ab5deef9e21 100644
@@ -676,7 +676,6 @@ int twl4030_init_irq(struct device *dev, int irq_num)
 	static struct irq_chip	twl4030_irq_chip;
 	int			status, i;
 	int			irq_base, irq_end, nr_irqs;
-	struct			device_node *node = dev->of_node;
 
 	/*
 	 * TWL core and pwr interrupts must be contiguous because
@@ -691,7 +690,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
 		return irq_base;
 	}
 
-	irq_domain_create_legacy(of_fwnode_handle(node), nr_irqs, irq_base, 0,
+	irq_domain_create_legacy(of_fwnode_handle(dev->of_node), nr_irqs, irq_base, 0,
 				 &irq_domain_simple_ops, NULL);
 
 	irq_end = irq_base + TWL4030_CORE_NR_IRQS;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

When compiling without CONFIG_OF but with CONFIG_WERROR enabled several mfd drivers fail with -Werror=unused-variable.

The assignment from these variables is only used in of_fwnode_handle() and thus they can be moved to only be used directly in the macro.

Fixes a36aa0f7226a2 ("mfd: Switch to irq_domain_create_*()")

Arnd sent a fix for this already:
https://lore.kernel.org/all/[email protected]/

Hopefully all the fixes can be applied now, so no more duplicated efforts. Sorry for the breakage.

Signature · 2 lines
js
suse labs
#2 lore raw
Quoted 6 lines · Jiri Slaby
Quoted 5 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

When compiling without CONFIG_OF but with CONFIG_WERROR enabled several mfd drivers fail with -Werror=unused-variable.

Quoted 8 lines
Quoted 5 lines

The assignment from these variables is only used in of_fwnode_handle() and thus they can be moved to only be used directly in the macro.

Fixes a36aa0f7226a2 ("mfd: Switch to irq_domain_create_*()")

Arnd sent a fix for this already:
https://lore.kernel.org/all/[email protected]/

And actually Nathan even before:
https://lore.kernel.org/all/20250508-mfd-fix-unused-node-variables-v1-1-df84d80cca55@kernel.org/

Quoted 2 lines

Hopefully all the fixes can be applied now, so no more duplicated efforts. Sorry for the breakage.

Signature · 2 lines
js
suse labs
#3 lore raw
Quoted 10 lines · Jiri Slaby
Quoted 9 lines · Jiri Slaby
Quoted 8 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

When compiling without CONFIG_OF but with CONFIG_WERROR enabled several mfd drivers fail with -Werror=unused-variable.

The assignment from these variables is only used in of_fwnode_handle() and thus they can be moved to only be used directly in the macro.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Fixes a36aa0f7226a2 ("mfd: Switch to irq_domain_create_*()")

Arnd sent a fix for this already:
https://lore.kernel.org/all/[email protected]/

And actually Nathan even before:
https://lore.kernel.org/all/20250508-mfd-fix-unused-node-variables-v1-1- [email protected]/

Thanks for sharing those.

Quoted 4 lines
Quoted 3 lines

Hopefully all the fixes can be applied now, so no more duplicated efforts. Sorry for the breakage.

#4 lore raw
In reply to Jiri Slaby
Quoted 10 lines · Jiri Slaby
Quoted 9 lines · Jiri Slaby
Quoted 8 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

When compiling without CONFIG_OF but with CONFIG_WERROR enabled several mfd drivers fail with -Werror=unused-variable.

The assignment from these variables is only used in of_fwnode_handle() and thus they can be moved to only be used directly in the macro.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Fixes a36aa0f7226a2 ("mfd: Switch to irq_domain_create_*()")

Arnd sent a fix for this already:
https://lore.kernel.org/all/[email protected]/

And actually Nathan even before:
https://lore.kernel.org/all/20250508-mfd-fix-unused-node-variables-v1-1- [email protected]/

Sorry to interrupt once again. It turns out Arnd used dev_fwnode() -- my intention, so I actually prefer that version.

Quoted 1 line
Quoted 1 line

Hopefully all the fixes can be applied now, so no more duplicated efforts. Sorry for the breakage.

thanks,

Signature · 2 lines
js
suse labs