]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: Use dev_fwnode() where applicable across drivers
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Wed, 11 Jun 2025 10:43:34 +0000 (12:43 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 16 Jun 2025 07:42:24 +0000 (09:42 +0200)
irq_domain_create_simple() takes fwnode as the first argument. It can be
extracted from the struct device using dev_fwnode() helper instead of
using of_node with of_fwnode_handle().

So use the dev_fwnode() helper where applicable.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611104348.192092-6-jirislaby@kernel.org
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
13 files changed:
drivers/gpio/gpio-brcmstb.c
drivers/gpio/gpio-davinci.c
drivers/gpio/gpio-em.c
drivers/gpio/gpio-grgpio.c
drivers/gpio/gpio-lpc18xx.c
drivers/gpio/gpio-mvebu.c
drivers/gpio/gpio-mxc.c
drivers/gpio/gpio-mxs.c
drivers/gpio/gpio-pxa.c
drivers/gpio/gpio-rockchip.c
drivers/gpio/gpio-sodaville.c
drivers/gpio/gpio-tb10x.c
drivers/gpio/gpio-twl4030.c

index e7671bcd5c07a3a2e639cc749c8f98b884053114..e29a9589b3ccbd17d10f6671088dca3e76537927 100644 (file)
@@ -436,10 +436,8 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
        struct device_node *np = dev->of_node;
        int err;
 
-       priv->irq_domain =
-               irq_domain_create_linear(of_fwnode_handle(np), priv->num_gpios,
-                                     &brcmstb_gpio_irq_domain_ops,
-                                     priv);
+       priv->irq_domain = irq_domain_create_linear(dev_fwnode(dev), priv->num_gpios,
+                                                   &brcmstb_gpio_irq_domain_ops, priv);
        if (!priv->irq_domain) {
                dev_err(dev, "Couldn't allocate IRQ domain\n");
                return -ENXIO;
index 80a82492171e43876e617e86ba024aef095229e1..8f3a36d0191d303c931fdfda336d3cbc6b92a67d 100644 (file)
@@ -478,7 +478,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
                        return irq;
                }
 
-               irq_domain = irq_domain_create_legacy(of_fwnode_handle(dev->of_node), ngpio, irq, 0,
+               irq_domain = irq_domain_create_legacy(dev_fwnode(dev), ngpio, irq, 0,
                                                      &davinci_gpio_irq_ops, chips);
                if (!irq_domain) {
                        dev_err(dev, "Couldn't register an IRQ domain\n");
index a5e6e446f39ce14f95e80514ffb7c63cb3639f91..015f1ac32dd9edfe6a344b9a88c085aadbf682af 100644 (file)
@@ -325,8 +325,7 @@ static int em_gio_probe(struct platform_device *pdev)
        irq_chip->irq_release_resources = em_gio_irq_relres;
        irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
 
-       p->irq_domain = irq_domain_create_simple(of_fwnode_handle(dev->of_node),
-                                                ngpios, 0,
+       p->irq_domain = irq_domain_create_simple(dev_fwnode(dev), ngpios, 0,
                                                 &em_gio_irq_domain_ops, p);
        if (!p->irq_domain) {
                dev_err(dev, "cannot initialize irq domain\n");
index d38a2d9854ca524f05164180601b1a936cc70983..f3f8bab62f94cefb69d31d76b961ab2d346df49e 100644 (file)
@@ -402,9 +402,8 @@ static int grgpio_probe(struct platform_device *ofdev)
                        return -EINVAL;
                }
 
-               priv->domain = irq_domain_create_linear(of_fwnode_handle(np), gc->ngpio,
-                                                    &grgpio_irq_domain_ops,
-                                                    priv);
+               priv->domain = irq_domain_create_linear(dev_fwnode(&ofdev->dev), gc->ngpio,
+                                                       &grgpio_irq_domain_ops, priv);
                if (!priv->domain) {
                        dev_err(dev, "Could not add irq domain\n");
                        return -EINVAL;
index b0a8da5c058d4c61b552ec997329baf1ead05140..2dbfbf90176ce843cbeb0074be44eb762f0780e9 100644 (file)
@@ -249,8 +249,8 @@ static int lpc18xx_gpio_pin_ic_probe(struct lpc18xx_gpio_chip *gc)
        raw_spin_lock_init(&ic->lock);
 
        ic->domain = irq_domain_create_hierarchy(parent_domain, 0, NR_LPC18XX_GPIO_PIN_IC_IRQS,
-                                                of_fwnode_handle(dev->of_node),
-                                                &lpc18xx_gpio_pin_ic_domain_ops, ic);
+                                                dev_fwnode(dev), &lpc18xx_gpio_pin_ic_domain_ops,
+                                                ic);
        if (!ic->domain) {
                pr_err("unable to add irq domain\n");
                ret = -ENODEV;
index 57633a7b42700b9ab186771468595ca1b6e0c28c..24792b8eb0839040aee98bdd8f63f65528bd5379 100644 (file)
@@ -1236,8 +1236,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
        if (!have_irqs)
                return 0;
 
-       mvchip->domain =
-           irq_domain_create_linear(of_fwnode_handle(np), ngpios, &irq_generic_chip_ops, NULL);
+       mvchip->domain = irq_domain_create_linear(dev_fwnode(&pdev->dev), ngpios,
+                                                 &irq_generic_chip_ops, NULL);
        if (!mvchip->domain) {
                dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
                        mvchip->chip.label);
index fae1a30f8ae6a9427556c536934dabdfe0e73d24..4af5a2972d12f68909dd87d9396921c80445f87c 100644 (file)
@@ -509,8 +509,8 @@ static int mxc_gpio_probe(struct platform_device *pdev)
                goto out_bgio;
        }
 
-       port->domain = irq_domain_create_legacy(of_fwnode_handle(np), 32, irq_base, 0,
-                                            &irq_domain_simple_ops, NULL);
+       port->domain = irq_domain_create_legacy(dev_fwnode(&pdev->dev), 32, irq_base, 0,
+                                               &irq_domain_simple_ops, NULL);
        if (!port->domain) {
                err = -ENODEV;
                goto out_bgio;
index b418fbccb26c0df1c9921efdafdc48252bfe8076..0ea46f3d04e128bc8e70941e26c618c0378ab9ae 100644 (file)
@@ -303,7 +303,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
                goto out_iounmap;
        }
 
-       port->domain = irq_domain_create_legacy(of_fwnode_handle(np), 32, irq_base, 0,
+       port->domain = irq_domain_create_legacy(dev_fwnode(&pdev->dev), 32, irq_base, 0,
                                                &irq_domain_simple_ops, NULL);
        if (!port->domain) {
                err = -ENODEV;
index aead35ea090e6c37e80ae3c29e12c44cc8e930c7..131ab79ebce7555313fd93b3ebd80582d1b9327d 100644 (file)
@@ -642,9 +642,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
        if (!pxa_last_gpio)
                return -EINVAL;
 
-       pchip->irqdomain = irq_domain_create_legacy(of_fwnode_handle(pdev->dev.of_node),
-                                                   pxa_last_gpio + 1, irq_base, 0,
-                                                   &pxa_irq_domain_ops, pchip);
+       pchip->irqdomain = irq_domain_create_legacy(dev_fwnode(&pdev->dev), pxa_last_gpio + 1,
+                                                   irq_base, 0, &pxa_irq_domain_ops, pchip);
        if (!pchip->irqdomain)
                return -ENOMEM;
 
index c63352f2f1ec7911f9eaf445ee23559fba335051..64700a003f9a17947dd38baea23a066e8c057caf 100644 (file)
@@ -521,8 +521,8 @@ static int rockchip_interrupts_register(struct rockchip_pin_bank *bank)
        struct irq_chip_generic *gc;
        int ret;
 
-       bank->domain = irq_domain_create_linear(of_fwnode_handle(bank->of_node), 32,
-                                       &irq_generic_chip_ops, NULL);
+       bank->domain = irq_domain_create_linear(dev_fwnode(bank->dev), 32, &irq_generic_chip_ops,
+                                               NULL);
        if (!bank->domain) {
                dev_warn(bank->dev, "could not init irq domain for bank %s\n",
                         bank->name);
index 6a3c4c625138862d37d213e17625f06d782af8f5..abd13c79ace09db228e975f93c92e727d3864ef8 100644 (file)
@@ -169,8 +169,8 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
                        IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST,
                        IRQ_LEVEL | IRQ_NOPROBE);
 
-       sd->id = irq_domain_create_legacy(of_fwnode_handle(pdev->dev.of_node), SDV_NUM_PUB_GPIOS,
-                               sd->irq_base, 0, &irq_domain_sdv_ops, sd);
+       sd->id = irq_domain_create_legacy(dev_fwnode(&pdev->dev), SDV_NUM_PUB_GPIOS, sd->irq_base,
+                                         0, &irq_domain_sdv_ops, sd);
        if (!sd->id)
                return -ENODEV;
 
index 8cf676fd0a0bb582377eb36146a77b42f4ee575d..1869ee7f9423efb31045a3394343e404db102faf 100644 (file)
@@ -183,9 +183,8 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
                if (ret != 0)
                        return ret;
 
-               tb10x_gpio->domain = irq_domain_create_linear(of_fwnode_handle(np),
-                                               tb10x_gpio->gc.ngpio,
-                                               &irq_generic_chip_ops, NULL);
+               tb10x_gpio->domain = irq_domain_create_linear(dev_fwnode(dev), tb10x_gpio->gc.ngpio,
+                                                             &irq_generic_chip_ops, NULL);
                if (!tb10x_gpio->domain) {
                        return -ENOMEM;
                }
index 0d17985a5fdc44ae7809c13bcbafb0bfd4fc8cb6..c5d7825f19c18bfa84083aa5a46e48d174b8fce6 100644 (file)
@@ -523,7 +523,7 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
                return irq_base;
        }
 
-       irq_domain_create_legacy(of_fwnode_handle(pdev->dev.of_node), TWL4030_GPIO_MAX, irq_base, 0,
+       irq_domain_create_legacy(dev_fwnode(&pdev->dev), TWL4030_GPIO_MAX, irq_base, 0,
                                 &irq_domain_simple_ops, NULL);
 
        ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO, irq_base);