Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Fix building without CONFIG_OF

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.

Fixes: e3d44f11da04 ("mfd: Switch to irq_domain_create_*()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250520154106.2019525-1-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Arnd Bergmann and committed by
Lee Jones
d9d79e4f 19272b37

+5 -7
+1 -2
drivers/mfd/88pm860x-core.c
··· 573 573 unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; 574 574 int data, mask, ret = -EINVAL; 575 575 int nr_irqs, irq_base = -1; 576 - struct device_node *node = i2c->dev.of_node; 577 576 578 577 mask = PM8607_B0_MISC1_INV_INT | PM8607_B0_MISC1_INT_CLEAR 579 578 | PM8607_B0_MISC1_INT_MASK; ··· 623 624 ret = -EBUSY; 624 625 goto out; 625 626 } 626 - irq_domain_create_legacy(of_fwnode_handle(node), nr_irqs, chip->irq_base, 0, 627 + irq_domain_create_legacy(dev_fwnode(&i2c->dev), nr_irqs, chip->irq_base, 0, 627 628 &pm860x_irq_domain_ops, chip); 628 629 chip->core_irq = i2c->irq; 629 630 if (!chip->core_irq)
+3 -3
drivers/mfd/max8925-core.c
··· 656 656 { 657 657 unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; 658 658 int ret; 659 - struct device_node *node = chip->dev->of_node; 660 659 661 660 /* clear all interrupts */ 662 661 max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ1); ··· 681 682 return -EBUSY; 682 683 } 683 684 684 - irq_domain_create_legacy(of_fwnode_handle(node), MAX8925_NR_IRQS, chip->irq_base, 0, 685 - &max8925_irq_domain_ops, chip); 685 + irq_domain_create_legacy(dev_fwnode(chip->dev), MAX8925_NR_IRQS, 686 + chip->irq_base, 0, &max8925_irq_domain_ops, 687 + chip); 686 688 687 689 /* request irq handler for pmic main irq*/ 688 690 chip->core_irq = irq;
+1 -2
drivers/mfd/twl4030-irq.c
··· 676 676 static struct irq_chip twl4030_irq_chip; 677 677 int status, i; 678 678 int irq_base, irq_end, nr_irqs; 679 - struct device_node *node = dev->of_node; 680 679 681 680 /* 682 681 * TWL core and pwr interrupts must be contiguous because ··· 690 691 return irq_base; 691 692 } 692 693 693 - irq_domain_create_legacy(of_fwnode_handle(node), nr_irqs, irq_base, 0, 694 + irq_domain_create_legacy(dev_fwnode(dev), nr_irqs, irq_base, 0, 694 695 &irq_domain_simple_ops, NULL); 695 696 696 697 irq_end = irq_base + TWL4030_CORE_NR_IRQS;