of/irq: Use irq_of_parse_and_map()
authorThierry Reding <thierry.reding@gmail.com>
Wed, 18 Sep 2013 13:24:44 +0000 (15:24 +0200)
committerGrant Likely <grant.likely@linaro.org>
Thu, 24 Oct 2013 10:50:35 +0000 (11:50 +0100)
Replace some instances of of_irq_map_one()/irq_create_of_mapping() and
of_irq_to_resource() by the simpler equivalent irq_of_parse_and_map().

Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
[grant.likely: resolved conflicts with core code renames]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
16 files changed:
arch/arm/mach-u300/timer.c
arch/powerpc/platforms/cell/celleb_scc_pciex.c
arch/powerpc/platforms/cell/spider-pic.c
arch/powerpc/sysdev/fsl_gtm.c
arch/powerpc/sysdev/mpic_msgr.c
drivers/crypto/caam/ctrl.c
drivers/crypto/caam/jr.c
drivers/crypto/omap-sham.c
drivers/i2c/busses/i2c-cpm.c
drivers/input/serio/xilinx_ps2.c
drivers/net/ethernet/arc/emac_main.c
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
drivers/net/ethernet/freescale/fs_enet/mac-fec.c
drivers/net/ethernet/freescale/fs_enet/mac-scc.c
drivers/spi/spi-fsl-espi.c
drivers/tty/serial/cpm_uart/cpm_uart_core.c

index b5db207dfd1e0129a08ae9cd91a4d6df7210079d..9a5f9fb352ce1c7ca97baa3e4269ef54770e2faa 100644 (file)
@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer;
  */
 static void __init u300_timer_init_of(struct device_node *np)
 {
-       struct resource irq_res;
-       int irq;
+       unsigned int irq;
        struct clk *clk;
        unsigned long rate;
 
@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np)
                panic("could not ioremap system timer\n");
 
        /* Get the IRQ for the GP1 timer */
-       irq = of_irq_to_resource(np, 2, &irq_res);
-       if (irq <= 0)
+       irq = irq_of_parse_and_map(np, 2);
+       if (!irq)
                panic("no IRQ for system timer\n");
 
-       pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq);
+       pr_info("U300 GP1 timer @ base: %p, IRQ: %u\n", u300_timer_base, irq);
 
        /* Clock the interrupt controller */
        clk = of_clk_get(np, 0);
index b3ea96db5b06a15b6efc80f4ee5b1963b08cc641..4278acfa2edef7441a720233912acc2e0f246e2e 100644 (file)
@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node,
                                     struct pci_controller *phb)
 {
        struct resource r;
-       struct of_phandle_args oirq;
        int virq;
 
        /* SMMIO registers; used inside this file */
@@ -507,11 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node,
        phb->ops = &scc_pciex_pci_ops;
 
        /* internal interrupt handler */
-       if (of_irq_parse_one(node, 1, &oirq)) {
+       virq = irq_of_parse_and_map(node, 1);
+       if (!virq) {
                pr_err("PCIEXC:Failed to map irq\n");
                goto error;
        }
-       virq = irq_create_of_mapping(&oirq);
        if (request_irq(virq, pciex_handle_internal_irq,
                        0, "pciex", (void *)phb)) {
                pr_err("PCIEXC:Failed to request irq\n");
index d20680446174f477665bf9892c846b52efe3f8f0..1f72f4ab6353cdcee1c2cae3d2f7d01a694a903d 100644 (file)
@@ -235,9 +235,9 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
        /* First, we check whether we have a real "interrupts" in the device
         * tree in case the device-tree is ever fixed
         */
-       struct of_phandle_args oirq;
-       if (of_irq_parse_one(pic->host->of_node, 0, &oirq) == 0)
-               return irq_create_of_mapping(&oirq);
+       virq = irq_of_parse_and_map(pic->host->of_node, 0);
+       if (virq)
+               return virq;
 
        /* Now do the horrible hacks */
        tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
index 0eb871cc3437f9250372422f727f112a18f6b002..dd0d5be6cd1fc155cf59615fa0fcdcd6ed6517b0 100644 (file)
@@ -401,16 +401,15 @@ static int __init fsl_gtm_init(void)
                gtm->clock = *clock;
 
                for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) {
-                       int ret;
-                       struct resource irq;
+                       unsigned int irq;
 
-                       ret = of_irq_to_resource(np, i, &irq);
-                       if (ret == NO_IRQ) {
+                       irq = irq_of_parse_and_map(np, i);
+                       if (irq == NO_IRQ) {
                                pr_err("%s: not enough interrupts specified\n",
                                       np->full_name);
                                goto err;
                        }
-                       gtm->timers[i].irq = irq.start;
+                       gtm->timers[i].irq = irq;
                        gtm->timers[i].gtm = gtm;
                }
 
index c75325865a8573053e0e47279d00d046c19dab9f..2c9b52aa266cc9ac68f29e45d9eb8272e95c8c1a 100644 (file)
@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev)
                raw_spin_lock_init(&msgr->lock);
 
                if (receive_mask & (1 << i)) {
-                       struct resource irq;
-
-                       if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) {
+                       msgr->irq = irq_of_parse_and_map(np, irq_index);
+                       if (msgr->irq == NO_IRQ) {
                                dev_err(&dev->dev,
                                                "Missing interrupt specifier");
                                kfree(msgr);
                                return -EFAULT;
                        }
-                       msgr->irq = irq.start;
                        irq_index += 1;
                } else {
                        msgr->irq = NO_IRQ;
index b010d42a18035fa48a8797dc802267f70db531d2..ae6e5542ec4697495b23d9a9cd1a74108245cbb5 100644 (file)
@@ -224,7 +224,7 @@ static int caam_probe(struct platform_device *pdev)
        topregs = (struct caam_full __iomem *)ctrl;
 
        /* Get the IRQ of the controller (for security violations only) */
-       ctrlpriv->secvio_irq = of_irq_to_resource(nprop, 0, NULL);
+       ctrlpriv->secvio_irq = irq_of_parse_and_map(nprop, 0);
 
        /*
         * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
index 105ba4da618059b63a71a36747008e362a04233f..517a16d87e4b2a5896aa51ce365c4cb8a973c1c0 100644 (file)
@@ -403,7 +403,7 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np,
                dma_set_mask(jrdev, DMA_BIT_MASK(32));
 
        /* Identify the interrupt */
-       jrpriv->irq = of_irq_to_resource(np, 0, NULL);
+       jrpriv->irq = irq_of_parse_and_map(np, 0);
 
        /* Now do the platform independent part */
        error = caam_jr_init(jrdev); /* now turn on hardware */
index 8bdde57f6bb1d7050967351744571b352062f1e1..e28104b4aab08ce20a9c1bbf26aefdb45778379a 100644 (file)
@@ -1818,7 +1818,7 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd,
                goto err;
        }
 
-       dd->irq = of_irq_to_resource(node, 0, NULL);
+       dd->irq = irq_of_parse_and_map(node, 0);
        if (!dd->irq) {
                dev_err(dev, "can't translate OF irq value\n");
                err = -EINVAL;
index b2b8aa9adc0ef24bafd93fb6c07679463d14c212..3e5ea2c87a6e19b747f34a80613d892866fba77d 100644 (file)
@@ -447,7 +447,7 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)
 
        init_waitqueue_head(&cpm->i2c_wait);
 
-       cpm->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
+       cpm->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
        if (!cpm->irq)
                return -EINVAL;
 
index 4b7662a17ae90226bce968651f0a084f3c90826f..36f7b9533397dcfd85d066f76e6fab06e66fa650 100644 (file)
@@ -235,12 +235,12 @@ static void sxps2_close(struct serio *pserio)
  */
 static int xps2_of_probe(struct platform_device *ofdev)
 {
-       struct resource r_irq; /* Interrupt resources */
        struct resource r_mem; /* IO mem resources */
        struct xps2data *drvdata;
        struct serio *serio;
        struct device *dev = &ofdev->dev;
        resource_size_t remap_size, phys_addr;
+       unsigned int irq;
        int error;
 
        dev_info(dev, "Device Tree Probing \'%s\'\n",
@@ -254,7 +254,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
        }
 
        /* Get IRQ for the device */
-       if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) {
+       irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
+       if (!irq) {
                dev_err(dev, "no IRQ found\n");
                return -ENODEV;
        }
@@ -267,7 +268,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
        }
 
        spin_lock_init(&drvdata->lock);
-       drvdata->irq = r_irq.start;
+       drvdata->irq = irq;
        drvdata->serio = serio;
        drvdata->dev = dev;
 
index 9e160148726385b136b5cdedeee31118ac299b77..d0878526c0c86c95d9c238f079c6564ca16c48bc 100644 (file)
@@ -628,12 +628,12 @@ static const struct net_device_ops arc_emac_netdev_ops = {
 
 static int arc_emac_probe(struct platform_device *pdev)
 {
-       struct resource res_regs, res_irq;
+       struct resource res_regs;
        struct device_node *phy_node;
        struct arc_emac_priv *priv;
        struct net_device *ndev;
        const char *mac_addr;
-       unsigned int id, clock_frequency;
+       unsigned int id, clock_frequency, irq;
        int err;
 
        if (!pdev->dev.of_node)
@@ -661,8 +661,8 @@ static int arc_emac_probe(struct platform_device *pdev)
        }
 
        /* Get IRQ from device tree */
-       err = of_irq_to_resource(pdev->dev.of_node, 0, &res_irq);
-       if (!err) {
+       irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+       if (!irq) {
                dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n");
                return -ENODEV;
        }
@@ -711,7 +711,7 @@ static int arc_emac_probe(struct platform_device *pdev)
                goto out;
        }
 
-       ndev->irq = res_irq.start;
+       ndev->irq = irq;
        dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq);
 
        /* Register interrupt handler for device */
index 7583a9572bcc5a55c1d4fc87378f0d1475bccc45..10f781d8cb09076fd39ccd4e219d4cfb2c1c42d5 100644 (file)
@@ -88,7 +88,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
        struct fs_platform_info *fpi = fep->fpi;
        int ret = -EINVAL;
 
-       fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
+       fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
        if (fep->interrupt == NO_IRQ)
                goto out;
 
index 9ae6cdbcac2ea910c5b967bbc3ee2e6356b05f3b..53a0c23b48902d7f54633d34029da7c33169ca3a 100644 (file)
@@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
 {
        struct platform_device *ofdev = to_platform_device(fep->dev);
 
-       fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
+       fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
        if (fep->interrupt == NO_IRQ)
                return -EINVAL;
 
index 22a02a76706933938c4b39f09404edaef2d763d7..631f09872fa21d98098e9b9d5dd6c5dc9a223ab7 100644 (file)
@@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
 {
        struct platform_device *ofdev = to_platform_device(fep->dev);
 
-       fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
+       fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
        if (fep->interrupt == NO_IRQ)
                return -EINVAL;
 
index b8f1103fe28ee63a4d5209f5f88466fdc84255af..3197d55f30cd0ff56fe5ad875766102fbbd38d6e 100644 (file)
@@ -687,7 +687,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
        struct device_node *np = ofdev->dev.of_node;
        struct spi_master *master;
        struct resource mem;
-       struct resource irq;
+       unsigned int irq;
        int ret = -ENOMEM;
 
        ret = of_mpc8xxx_spi_probe(ofdev);
@@ -702,13 +702,13 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
        if (ret)
                goto err;
 
-       ret = of_irq_to_resource(np, 0, &irq);
+       irq = irq_of_parse_and_map(np, 0);
        if (!ret) {
                ret = -EINVAL;
                goto err;
        }
 
-       master = fsl_espi_probe(dev, &mem, irq.start);
+       master = fsl_espi_probe(dev, &mem, irq);
        if (IS_ERR(master)) {
                ret = PTR_ERR(master);
                goto err;
index 1a535f70dc41b2886d9fa6d500a5f11f6556eab0..6957f445a114907c1ca5b30fb2c02589a40ab95f 100644 (file)
@@ -1207,7 +1207,7 @@ static int cpm_uart_init_port(struct device_node *np,
        pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize;
        spin_lock_init(&pinfo->port.lock);
 
-       pinfo->port.irq = of_irq_to_resource(np, 0, NULL);
+       pinfo->port.irq = irq_of_parse_and_map(np, 0);
        if (pinfo->port.irq == NO_IRQ) {
                ret = -EINVAL;
                goto out_pram;