mfd: fix building without CONFIG_OF
Subsystems (2)
PATCH 1/1 mfd: fix building without CONFIG_OF
From: Arnd Bergmann <[email protected]>
Using the of_fwnode_handle() means that local 'node' variables are unused whenever CONFIG_OF is disabled for compile testing:
drivers/mfd/88pm860x-core.c: In function 'device_irq_init':drivers/mfd/88pm860x-core.c:576:29: error: unused variable 'node' [-Werror=unused-variable]
576 | struct device_node *node = i2c->dev.of_node;
| ^~~~drivers/mfd/max8925-core.c: In function 'max8925_irq_init':drivers/mfd/max8925-core.c:659:29: error: unused variable 'node' [-Werror=unused-variable]
659 | struct device_node *node = chip->dev->of_node;
| ^~~~drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':drivers/mfd/twl4030-irq.c:679:46: error: unused variable 'node' [-Werror=unused-variable]
679 | struct device_node *node = dev->of_node;
| ^~~~
Replace these with the corresponding dev_fwnode() lookups that keep the code simpler in addition to avoiding the warnings.
---
Thomas, can you pick this up into the tip/irq/cleanups branch that contains the earlier commit that introduced the warnings?
--- drivers/mfd/88pm860x-core.c | 3 +-- drivers/mfd/max8925-core.c | 6 +++--- drivers/mfd/twl4030-irq.c | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-)
drivers/mfd/88pm860x-core.c +1 -2
@@ -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,7 +623,7 @@ 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 , +irq_domain_create_legacy (dev_fwnode (&i2c->dev), nr_irqs, chip->irq_base,0 , &pm860x_irq_domain_ops, chip); chip->core_irq = i2c->irq;if (!chip->core_irq)
drivers/mfd/max8925-core.c +3 -3
@@ -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,9 @@ 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 (dev_fwnode (chip->dev),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
@@ -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 (dev_fwnode (dev), nr_irqs, irq_base,0 , &irq_domain_simple_ops,NULL ); irq_end = irq_base +TWL4030_CORE_NR_IRQS ;
Signature · 1 line
2.39.5
Quoted 18 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Using the
of_fwnode_handle()means that local 'node' variables are unused wheneverCONFIG_OFis disabled for compile testing:
drivers/mfd/88pm860x-core.c: In function 'device_irq_init':drivers/mfd/88pm860x-core.c:576:29: error: unused variable 'node' [-Werror=unused-variable]
576 | structdevice_node*node =i2c->dev.of_node;
| ^~~~drivers/mfd/max8925-core.c: In function 'max8925_irq_init':drivers/mfd/max8925-core.c:659:29: error: unused variable 'node' [-Werror=unused-variable]
659 | structdevice_node*node =chip->dev->of_node;
| ^~~~drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':drivers/mfd/twl4030-irq.c:679:46: error: unused variable 'node' [-Werror=unused-variable]
679 | structdevice_node*node =dev->of_node;
| ^~~~
Quoted 2 lines
Replace these with the corresponding
dev_fwnode()lookups that keep the code simpler in addition to avoiding the warnings.
Exactly the same as I have, except:
...
drivers/mfd/max8925-core.c static int max8925_irq_init(struct max8925_chip *chip, int irq, · line 686
Quoted 12 lines
drivers/mfd/max8925-core.c +3
-2@@ -682,8 +681,9 @@ 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 (dev_fwnode (chip->dev),MAX8925_NR_IRQS , + chip->irq_base,0 , &max8925_irq_domain_ops, + chip);
I used 100 columns -- without actually adding a line break and reflowing.
thanks,
Signature · 2 lines
js suse labs
Re: (subset) [PATCH] mfd: fix building without CONFIG_OF
In reply to Arnd BergmannQuoted 16 lines · Arnd Bergmann
Using the
of_fwnode_handle()means that local 'node' variables are unused wheneverCONFIG_OFis disabled for compile testing:
drivers/mfd/88pm860x-core.c: In function 'device_irq_init':drivers/mfd/88pm860x-core.c:576:29: error: unused variable 'node' [-Werror=unused-variable]
576 | structdevice_node*node =i2c->dev.of_node;
| ^~~~drivers/mfd/max8925-core.c: In function 'max8925_irq_init':drivers/mfd/max8925-core.c:659:29: error: unused variable 'node' [-Werror=unused-variable]
659 | structdevice_node*node =chip->dev->of_node;
| ^~~~drivers/mfd/twl4030-irq.c: In function 'twl4030_init_irq':drivers/mfd/twl4030-irq.c:679:46: error: unused variable 'node' [-Werror=unused-variable]
679 | structdevice_node*node =dev->of_node;
| ^~~~
Quoted 1 line
[...]
Applied, thanks!
[1/1] mfd: fix building without CONFIG_OF
commit: fc5f017a71d08eea3983762ce57d27e5bc300db1
--
Lee Jones [李琼斯]