]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: Switch to irq_domain_create_*()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Wed, 19 Mar 2025 09:29:10 +0000 (10:29 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 16 May 2025 19:06:09 +0000 (21:06 +0200)
irq_domain_add_*() interfaces are going away as being obsolete now.
Switch to the preferred irq_domain_create_*() ones. Those differ in the
node parameter: They take more generic struct fwnode_handle instead of
struct device_node. Therefore, of_fwnode_handle() is added around the
original parameter.

Note some of the users can likely use dev->fwnode directly instead of
indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not
guaranteed to be set for all, so this has to be investigated on case to
case basis (by people who can actually test with the HW).

[ tglx: Fix up subject prefix ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-18-jirislaby@kernel.org
15 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-sa1100.c
drivers/gpio/gpio-sodaville.c
drivers/gpio/gpio-tb10x.c
drivers/gpio/gpio-twl4030.c
include/linux/gpio/driver.h

index ca3472977431e42f66e727a99ef4894451ff9d8e..e7671bcd5c07a3a2e639cc749c8f98b884053114 100644 (file)
@@ -437,7 +437,7 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
        int err;
 
        priv->irq_domain =
-               irq_domain_add_linear(np, priv->num_gpios,
+               irq_domain_create_linear(of_fwnode_handle(np), priv->num_gpios,
                                      &brcmstb_gpio_irq_domain_ops,
                                      priv);
        if (!priv->irq_domain) {
index 63fc7888c1d42d25b0d88301eb7aaf9ad7b431e7..3c3b3ed46d9b480eb7916fa2402e5bbcc06cd563 100644 (file)
@@ -479,9 +479,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
                        return irq;
                }
 
-               irq_domain = irq_domain_add_legacy(dev->of_node, ngpio, irq, 0,
-                                                       &davinci_gpio_irq_ops,
-                                                       chips);
+               irq_domain = irq_domain_create_legacy(of_fwnode_handle(dev->of_node), ngpio, irq, 0,
+                                                     &davinci_gpio_irq_ops, chips);
                if (!irq_domain) {
                        dev_err(dev, "Couldn't register an IRQ domain\n");
                        return -ENODEV;
index 6c862c57232277adf48865da61fd802f8c7cb627..8d86f205f53e58f2137784252b0bbd57fbb6c78a 100644 (file)
@@ -323,8 +323,9 @@ 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_add_simple(dev->of_node, ngpios, 0,
-                                             &em_gio_irq_domain_ops, p);
+       p->irq_domain = irq_domain_create_simple(of_fwnode_handle(dev->of_node),
+                                                ngpios, 0,
+                                                &em_gio_irq_domain_ops, p);
        if (!p->irq_domain) {
                dev_err(dev, "cannot initialize irq domain\n");
                return -ENXIO;
index 30a0522ae735ff51577342313beb3a3b5cbb3357..641df8f2fd3d3fc523acd5103cc77d50113599e5 100644 (file)
@@ -397,7 +397,7 @@ static int grgpio_probe(struct platform_device *ofdev)
                        return -EINVAL;
                }
 
-               priv->domain = irq_domain_add_linear(np, gc->ngpio,
+               priv->domain = irq_domain_create_linear(of_fwnode_handle(np), gc->ngpio,
                                                     &grgpio_irq_domain_ops,
                                                     priv);
                if (!priv->domain) {
index 2cf9fb4637a2bbc7b97b26b4d2c69ba071e9638f..ae6182cce7234166fe94ab0c8d5e07c11bb71101 100644 (file)
@@ -240,11 +240,9 @@ static int lpc18xx_gpio_pin_ic_probe(struct lpc18xx_gpio_chip *gc)
 
        raw_spin_lock_init(&ic->lock);
 
-       ic->domain = irq_domain_add_hierarchy(parent_domain, 0,
-                                             NR_LPC18XX_GPIO_PIN_IC_IRQS,
-                                             dev->of_node,
-                                             &lpc18xx_gpio_pin_ic_domain_ops,
-                                             ic);
+       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);
        if (!ic->domain) {
                pr_err("unable to add irq domain\n");
                ret = -ENODEV;
index 3604abcb6fecb3a12b67803fe26cd19d28414173..4055596faef7603965564b6fbf93cdc1b5384b92 100644 (file)
@@ -1242,7 +1242,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
                return 0;
 
        mvchip->domain =
-           irq_domain_add_linear(np, ngpios, &irq_generic_chip_ops, NULL);
+           irq_domain_create_linear(of_fwnode_handle(np), 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 619b6fb9d833a4bb94a93b4209f01b49ad1cbdb0..74bc8f06a97ac069ae44435c4639cbfa1992f06c 100644 (file)
@@ -502,7 +502,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
                goto out_bgio;
        }
 
-       port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
+       port->domain = irq_domain_create_legacy(of_fwnode_handle(np), 32, irq_base, 0,
                                             &irq_domain_simple_ops, NULL);
        if (!port->domain) {
                err = -ENODEV;
index 024ad077e98d7242714b0c27bca52087ba250a85..b418fbccb26c0df1c9921efdafdc48252bfe8076 100644 (file)
@@ -303,8 +303,8 @@ static int mxs_gpio_probe(struct platform_device *pdev)
                goto out_iounmap;
        }
 
-       port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
-                                            &irq_domain_simple_ops, NULL);
+       port->domain = irq_domain_create_legacy(of_fwnode_handle(np), 32, irq_base, 0,
+                                               &irq_domain_simple_ops, NULL);
        if (!port->domain) {
                err = -ENODEV;
                goto out_iounmap;
index 91cea97255fa6dd851bb2036fcf76f81956b8fe7..c3dfaed45c4319a54b545bd89b834253b77d369d 100644 (file)
@@ -636,9 +636,9 @@ static int pxa_gpio_probe(struct platform_device *pdev)
        if (!pxa_last_gpio)
                return -EINVAL;
 
-       pchip->irqdomain = irq_domain_add_legacy(pdev->dev.of_node,
-                                                pxa_last_gpio + 1, irq_base,
-                                                0, &pxa_irq_domain_ops, pchip);
+       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);
        if (!pchip->irqdomain)
                return -ENOMEM;
 
index 01a3b3dac58bf108fb488d71c6509fa58ff26189..c63352f2f1ec7911f9eaf445ee23559fba335051 100644 (file)
@@ -521,7 +521,7 @@ static int rockchip_interrupts_register(struct rockchip_pin_bank *bank)
        struct irq_chip_generic *gc;
        int ret;
 
-       bank->domain = irq_domain_add_linear(bank->of_node, 32,
+       bank->domain = irq_domain_create_linear(of_fwnode_handle(bank->of_node), 32,
                                        &irq_generic_chip_ops, NULL);
        if (!bank->domain) {
                dev_warn(bank->dev, "could not init irq domain for bank %s\n",
index 242dad763ac4d5ea913cf1ac4332348615217332..3f3ee36bc3cb19a7baf530def0575d2ff09dd3c5 100644 (file)
@@ -319,7 +319,7 @@ void __init sa1100_init_gpio(void)
 
        gpiochip_add_data(&sa1100_gpio_chip.chip, NULL);
 
-       sa1100_gpio_irqdomain = irq_domain_add_simple(NULL,
+       sa1100_gpio_irqdomain = irq_domain_create_simple(NULL,
                        28, IRQ_GPIO0,
                        &sa1100_gpio_irqdomain_ops, sgc);
 
index c2a2c76c1652ddd5cc9b56eac2c5b1c529365a75..6a3c4c625138862d37d213e17625f06d782af8f5 100644 (file)
@@ -169,7 +169,7 @@ 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_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS,
+       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);
        if (!sd->id)
                return -ENODEV;
index b6335cde455f72f8dcb83940253abf00011d63d4..8cf676fd0a0bb582377eb36146a77b42f4ee575d 100644 (file)
@@ -183,7 +183,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
                if (ret != 0)
                        return ret;
 
-               tb10x_gpio->domain = irq_domain_add_linear(np,
+               tb10x_gpio->domain = irq_domain_create_linear(of_fwnode_handle(np),
                                                tb10x_gpio->gc.ngpio,
                                                &irq_generic_chip_ops, NULL);
                if (!tb10x_gpio->domain) {
index bcd692229c7c73c51cffab353d78b63e1fc2151d..0d17985a5fdc44ae7809c13bcbafb0bfd4fc8cb6 100644 (file)
@@ -502,7 +502,6 @@ static void gpio_twl4030_power_off_action(void *data)
 static int gpio_twl4030_probe(struct platform_device *pdev)
 {
        struct twl4030_gpio_platform_data *pdata;
-       struct device_node *node = pdev->dev.of_node;
        struct gpio_twl4030_priv *priv;
        int ret, irq_base;
 
@@ -524,8 +523,8 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
                return irq_base;
        }
 
-       irq_domain_add_legacy(node, TWL4030_GPIO_MAX, irq_base, 0,
-                             &irq_domain_simple_ops, NULL);
+       irq_domain_create_legacy(of_fwnode_handle(pdev->dev.of_node), TWL4030_GPIO_MAX, irq_base, 0,
+                                &irq_domain_simple_ops, NULL);
 
        ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO, irq_base);
        if (ret < 0)
index 4c0294a9104d9283095978f30790da70c940f84a..b53233051beed0c6b927a951669ae5cf17d88a68 100644 (file)
@@ -287,8 +287,9 @@ struct gpio_irq_chip {
        /**
         * @first:
         *
-        * Required for static IRQ allocation. If set, irq_domain_add_simple()
-        * will allocate and map all IRQs during initialization.
+        * Required for static IRQ allocation. If set,
+        * irq_domain_create_simple() will allocate and map all IRQs
+        * during initialization.
         */
        unsigned int first;