Skip to contentSkip to conversation

mfd: Remove node variables that are unused with CONFIG_OF=n

PATCH In review Nathan Chancellor 3 participants 9 messages May 8, 2025 – Jun 19, 2025

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

PATCH 1/1 mfd: Remove node variables that are unused with CONFIG_OF=n

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

Fixes e3d44f11da04 ("mfd: Switch to irq_domain_create_*()")
---
 drivers/mfd/88pm860x-core.c | 5 ++---
 drivers/mfd/max8925-core.c  | 5 ++---
 drivers/mfd/twl4030-irq.c   | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)
drivers/mfd/88pm860x-core.c +2 -3
index 488e346047c1..25300b53a8ef 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 78b16c67a5fc..91388477ad2b 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 +2 -3
index 232c2bfe8c18..c7191d2992a1 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,8 +690,8 @@ 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_simple_ops, NULL);
+	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;
 

---
base-commit: c63e393a16c9c4cf8c9b70fedf9f27b442874ef2
change-id: 20250508-mfd-fix-unused-node-variables-14fe4f2cfd6c

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

   drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
   drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]
     679 |         struct                  device_node *node = dev->of_node;
         |                                              ^~~~
   drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
   drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
     659 |         struct device_node *node = chip->dev->of_node;
         |                             ^~~~
   drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
   drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
     576 |         struct device_node *node = i2c->dev.of_node;
         |                             ^~~~
Quoted 2 lines

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

It's good on its own.

Though, I have a series to convert to dev_fwnode() in (I think) all the cases.

thanks,

Signature · 2 lines
js
suse labs
maintainer
#2 lore raw
In reply to Nathan Chancellor
Quoted 20 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

Quoted 7 lines
Fixes e3d44f11da04 ("mfd: Switch to irq_domain_create_*()")
---
 drivers/mfd/88pm860x-core.c | 5 ++---
 drivers/mfd/max8925-core.c  | 5 ++---
 drivers/mfd/twl4030-irq.c   | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)

Doesn't apply. Which base commit / repo / branch are you using?

Signature · 1 line
Lee Jones [李琼斯]
#3 lore raw
Quoted 30 lines · Lee Jones
Quoted 20 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

Quoted 7 lines
Fixes e3d44f11da04 ("mfd: Switch to irq_domain_create_*()")
---
 drivers/mfd/88pm860x-core.c | 5 ++---
 drivers/mfd/max8925-core.c  | 5 ++---
 drivers/mfd/twl4030-irq.c   | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)
Quoted 1 line

Doesn't apply. Which base commit / repo / branch are you using?

-tip's irq/cleanups branch:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=irq/cleanups

This change has both a base commit and a Fixes tag and you were on Cc, not To. Is there anything else I can do (aside from a note in the scissor area) to signal that you don't need to handle this change?

Cheers,
Nathan

maintainer
#4 lore raw
Quoted 33 lines · Nathan Chancellor
Quoted 30 lines · Lee Jones
Quoted 20 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

Quoted 7 lines
Fixes e3d44f11da04 ("mfd: Switch to irq_domain_create_*()")
---
 drivers/mfd/88pm860x-core.c | 5 ++---
 drivers/mfd/max8925-core.c  | 5 ++---
 drivers/mfd/twl4030-irq.c   | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)
Quoted 1 line

Doesn't apply. Which base commit / repo / branch are you using?

Quoted 7 lines

-tip's irq/cleanups branch:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=irq/cleanups

This change has both a base commit and a Fixes tag and you were on Cc, not To. Is there anything else I can do (aside from a note in the scissor area) to signal that you don't need to handle this change?

Wait what! This is not okay.

e3d44f11da04 ("mfd: Switch to irq_domain_create_*()") should not have been applied without at least an MFD Ack. Preferably it would have been applied to an MFD based immutable branch where it could have been shared from (if required).

It was missed because the submitted patch had an "irqdomain" prefix. And now we're in a position where conflicts are likely to occur.

Signature · 1 line
Lee Jones [李琼斯]
#5 lore raw
In reply to Nathan Chancellor

Hi Thomas,

Quoted 6 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

Quoted 10 lines
    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

These warnings are now present in mainline after the merge of the irq/cleanups branch...

Quoted 4 lines

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

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

but this hash has changed, so this should be

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

but the rest of the change is still applicable. Would you like a new change or can you adjust that when applying?

Quoted 85 lines
---
 drivers/mfd/88pm860x-core.c | 5 ++---
 drivers/mfd/max8925-core.c  | 5 ++---
 drivers/mfd/twl4030-irq.c   | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)
drivers/mfd/88pm860x-core.c +2 -3
index 488e346047c1..25300b53a8ef 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 78b16c67a5fc..91388477ad2b 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 +2 -4
index 232c2bfe8c18..c7191d2992a1 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,8 +690,8 @@ 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_simple_ops, NULL);
+	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;
 
 
---

base-commit: c63e393a16c9c4cf8c9b70fedf9f27b442874ef2
change-id: 20250508-mfd-fix-unused-node-variables-14fe4f2cfd6c

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>
maintainer
#6 lore raw
Quoted 26 lines · Nathan Chancellor

Hi Thomas,

Quoted 6 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

Quoted 10 lines
    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

These warnings are now present in mainline after the merge of the irq/cleanups branch...

Quoted 3 lines

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

Quoted 8 lines
Quoted 1 line
Fixes e3d44f11da04 ("mfd: Switch to irq_domain_create_*()")

but this hash has changed, so this should be

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

but the rest of the change is still applicable. Would you like a new change or can you adjust that when applying?

Okay, please rebase and resubmit.

I suspect at least one of these has been fixed by Arnd already.

Signature · 1 line
Lee Jones [李琼斯]
#7 lore raw
Quoted 32 lines · Lee Jones
Quoted 30 lines · Nathan Chancellor

Hi Thomas,

Quoted 6 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

Quoted 10 lines
    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

These warnings are now present in mainline after the merge of the irq/cleanups branch...

Quoted 4 lines

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

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

but this hash has changed, so this should be

Quoted 8 lines
Quoted 4 lines
Fixes a36aa0f7226a ("mfd: Switch to irq_domain_create_*()")

but the rest of the change is still applicable. Would you like a new change or can you adjust that when applying?

Okay, please rebase and resubmit.

I suspect at least one of these has been fixed by Arnd already.

All of these are addressed by commit fc5f017a71d0 ("mfd: Fix building without CONFIG_OF") in your tree. Is that going to be merged into 6.16?

Cheers,
Nathan

maintainer
#8 lore raw
Quoted 38 lines · Nathan Chancellor
Quoted 37 lines · Lee Jones
Quoted 34 lines · Nathan Chancellor

Hi Thomas,

Quoted 6 lines · Nathan Chancellor

A recent cleanup introduced a few instances of -Wunused-variable in configurations without CONFIG_OF because of_fwnode_handle() does not reference its argument in that case:

drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':
drivers/mfd/twl4030-irq.c:679:46: warning: unused variable 'node' [-Wunused-variable]

Quoted 10 lines
    679 |         struct                  device_node *node = dev->of_node;
        |                                              ^~~~
  drivers/mfd/max8925-core.c: In function 'max8925_irq_init':
  drivers/mfd/max8925-core.c:659:29: warning: unused variable 'node' [-Wunused-variable]
    659 |         struct device_node *node = chip->dev->of_node;
        |                             ^~~~
  drivers/mfd/88pm860x-core.c: In function 'device_irq_init':
  drivers/mfd/88pm860x-core.c:576:29: warning: unused variable 'node' [-Wunused-variable]
    576 |         struct device_node *node = i2c->dev.of_node;
        |                             ^~~~

These warnings are now present in mainline after the merge of the irq/cleanups branch...

Quoted 4 lines

Use the value of these variables as the argument to of_fwnode_handle() directly, clearing up the warnings.

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

but this hash has changed, so this should be

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

but the rest of the change is still applicable. Would you like a new change or can you adjust that when applying?

Quoted 6 lines
Quoted 3 lines

Okay, please rebase and resubmit.

I suspect at least one of these has been fixed by Arnd already.

All of these are addressed by commit fc5f017a71d0 ("mfd: Fix building without CONFIG_OF") in your tree. Is that going to be merged into 6.16?

Yes, I can make that happen.

Signature · 1 line
Lee Jones [李琼斯]