Commit f7578496 authored by Thierry Reding's avatar Thierry Reding Committed by Grant Likely

of/irq: Use irq_of_parse_and_map()

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: default avatarThierry Reding <treding@nvidia.com>
Acked-by: default avatarRob Herring <rob.herring@calxeda.com>
[grant.likely: resolved conflicts with core code renames]
Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
parent 3da52787
...@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer; ...@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer;
*/ */
static void __init u300_timer_init_of(struct device_node *np) static void __init u300_timer_init_of(struct device_node *np)
{ {
struct resource irq_res; unsigned int irq;
int irq;
struct clk *clk; struct clk *clk;
unsigned long rate; unsigned long rate;
...@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np) ...@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np)
panic("could not ioremap system timer\n"); panic("could not ioremap system timer\n");
/* Get the IRQ for the GP1 timer */ /* Get the IRQ for the GP1 timer */
irq = of_irq_to_resource(np, 2, &irq_res); irq = irq_of_parse_and_map(np, 2);
if (irq <= 0) if (!irq)
panic("no IRQ for system timer\n"); 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 */ /* Clock the interrupt controller */
clk = of_clk_get(np, 0); clk = of_clk_get(np, 0);
......
...@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node, ...@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node,
struct pci_controller *phb) struct pci_controller *phb)
{ {
struct resource r; struct resource r;
struct of_phandle_args oirq;
int virq; int virq;
/* SMMIO registers; used inside this file */ /* SMMIO registers; used inside this file */
...@@ -507,11 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node, ...@@ -507,11 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node,
phb->ops = &scc_pciex_pci_ops; phb->ops = &scc_pciex_pci_ops;
/* internal interrupt handler */ /* 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"); pr_err("PCIEXC:Failed to map irq\n");
goto error; goto error;
} }
virq = irq_create_of_mapping(&oirq);
if (request_irq(virq, pciex_handle_internal_irq, if (request_irq(virq, pciex_handle_internal_irq,
0, "pciex", (void *)phb)) { 0, "pciex", (void *)phb)) {
pr_err("PCIEXC:Failed to request irq\n"); pr_err("PCIEXC:Failed to request irq\n");
......
...@@ -235,9 +235,9 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) ...@@ -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 /* First, we check whether we have a real "interrupts" in the device
* tree in case the device-tree is ever fixed * tree in case the device-tree is ever fixed
*/ */
struct of_phandle_args oirq; virq = irq_of_parse_and_map(pic->host->of_node, 0);
if (of_irq_parse_one(pic->host->of_node, 0, &oirq) == 0) if (virq)
return irq_create_of_mapping(&oirq); return virq;
/* Now do the horrible hacks */ /* Now do the horrible hacks */
tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL); tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
......
...@@ -401,16 +401,15 @@ static int __init fsl_gtm_init(void) ...@@ -401,16 +401,15 @@ static int __init fsl_gtm_init(void)
gtm->clock = *clock; gtm->clock = *clock;
for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) {
int ret; unsigned int irq;
struct resource irq;
ret = of_irq_to_resource(np, i, &irq); irq = irq_of_parse_and_map(np, i);
if (ret == NO_IRQ) { if (irq == NO_IRQ) {
pr_err("%s: not enough interrupts specified\n", pr_err("%s: not enough interrupts specified\n",
np->full_name); np->full_name);
goto err; goto err;
} }
gtm->timers[i].irq = irq.start; gtm->timers[i].irq = irq;
gtm->timers[i].gtm = gtm; gtm->timers[i].gtm = gtm;
} }
......
...@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev) ...@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev)
raw_spin_lock_init(&msgr->lock); raw_spin_lock_init(&msgr->lock);
if (receive_mask & (1 << i)) { if (receive_mask & (1 << i)) {
struct resource irq; msgr->irq = irq_of_parse_and_map(np, irq_index);
if (msgr->irq == NO_IRQ) {
if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) {
dev_err(&dev->dev, dev_err(&dev->dev,
"Missing interrupt specifier"); "Missing interrupt specifier");
kfree(msgr); kfree(msgr);
return -EFAULT; return -EFAULT;
} }
msgr->irq = irq.start;
irq_index += 1; irq_index += 1;
} else { } else {
msgr->irq = NO_IRQ; msgr->irq = NO_IRQ;
......
...@@ -224,7 +224,7 @@ static int caam_probe(struct platform_device *pdev) ...@@ -224,7 +224,7 @@ static int caam_probe(struct platform_device *pdev)
topregs = (struct caam_full __iomem *)ctrl; topregs = (struct caam_full __iomem *)ctrl;
/* Get the IRQ of the controller (for security violations only) */ /* 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, * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
......
...@@ -403,7 +403,7 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np, ...@@ -403,7 +403,7 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np,
dma_set_mask(jrdev, DMA_BIT_MASK(32)); dma_set_mask(jrdev, DMA_BIT_MASK(32));
/* Identify the interrupt */ /* 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 */ /* Now do the platform independent part */
error = caam_jr_init(jrdev); /* now turn on hardware */ error = caam_jr_init(jrdev); /* now turn on hardware */
......
...@@ -1818,7 +1818,7 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, ...@@ -1818,7 +1818,7 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd,
goto err; goto err;
} }
dd->irq = of_irq_to_resource(node, 0, NULL); dd->irq = irq_of_parse_and_map(node, 0);
if (!dd->irq) { if (!dd->irq) {
dev_err(dev, "can't translate OF irq value\n"); dev_err(dev, "can't translate OF irq value\n");
err = -EINVAL; err = -EINVAL;
......
...@@ -447,7 +447,7 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm) ...@@ -447,7 +447,7 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)
init_waitqueue_head(&cpm->i2c_wait); 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) if (!cpm->irq)
return -EINVAL; return -EINVAL;
......
...@@ -235,12 +235,12 @@ static void sxps2_close(struct serio *pserio) ...@@ -235,12 +235,12 @@ static void sxps2_close(struct serio *pserio)
*/ */
static int xps2_of_probe(struct platform_device *ofdev) static int xps2_of_probe(struct platform_device *ofdev)
{ {
struct resource r_irq; /* Interrupt resources */
struct resource r_mem; /* IO mem resources */ struct resource r_mem; /* IO mem resources */
struct xps2data *drvdata; struct xps2data *drvdata;
struct serio *serio; struct serio *serio;
struct device *dev = &ofdev->dev; struct device *dev = &ofdev->dev;
resource_size_t remap_size, phys_addr; resource_size_t remap_size, phys_addr;
unsigned int irq;
int error; int error;
dev_info(dev, "Device Tree Probing \'%s\'\n", dev_info(dev, "Device Tree Probing \'%s\'\n",
...@@ -254,7 +254,8 @@ static int xps2_of_probe(struct platform_device *ofdev) ...@@ -254,7 +254,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
} }
/* Get IRQ for the device */ /* 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"); dev_err(dev, "no IRQ found\n");
return -ENODEV; return -ENODEV;
} }
...@@ -267,7 +268,7 @@ static int xps2_of_probe(struct platform_device *ofdev) ...@@ -267,7 +268,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
} }
spin_lock_init(&drvdata->lock); spin_lock_init(&drvdata->lock);
drvdata->irq = r_irq.start; drvdata->irq = irq;
drvdata->serio = serio; drvdata->serio = serio;
drvdata->dev = dev; drvdata->dev = dev;
......
...@@ -628,12 +628,12 @@ static const struct net_device_ops arc_emac_netdev_ops = { ...@@ -628,12 +628,12 @@ static const struct net_device_ops arc_emac_netdev_ops = {
static int arc_emac_probe(struct platform_device *pdev) 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 device_node *phy_node;
struct arc_emac_priv *priv; struct arc_emac_priv *priv;
struct net_device *ndev; struct net_device *ndev;
const char *mac_addr; const char *mac_addr;
unsigned int id, clock_frequency; unsigned int id, clock_frequency, irq;
int err; int err;
if (!pdev->dev.of_node) if (!pdev->dev.of_node)
...@@ -661,8 +661,8 @@ static int arc_emac_probe(struct platform_device *pdev) ...@@ -661,8 +661,8 @@ static int arc_emac_probe(struct platform_device *pdev)
} }
/* Get IRQ from device tree */ /* Get IRQ from device tree */
err = of_irq_to_resource(pdev->dev.of_node, 0, &res_irq); irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
if (!err) { if (!irq) {
dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n"); dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n");
return -ENODEV; return -ENODEV;
} }
...@@ -711,7 +711,7 @@ static int arc_emac_probe(struct platform_device *pdev) ...@@ -711,7 +711,7 @@ static int arc_emac_probe(struct platform_device *pdev)
goto out; goto out;
} }
ndev->irq = res_irq.start; ndev->irq = irq;
dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq); dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq);
/* Register interrupt handler for device */ /* Register interrupt handler for device */
......
...@@ -88,7 +88,7 @@ static int do_pd_setup(struct fs_enet_private *fep) ...@@ -88,7 +88,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
struct fs_platform_info *fpi = fep->fpi; struct fs_platform_info *fpi = fep->fpi;
int ret = -EINVAL; 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) if (fep->interrupt == NO_IRQ)
goto out; goto out;
......
...@@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep) ...@@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
{ {
struct platform_device *ofdev = to_platform_device(fep->dev); 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) if (fep->interrupt == NO_IRQ)
return -EINVAL; return -EINVAL;
......
...@@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep) ...@@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
{ {
struct platform_device *ofdev = to_platform_device(fep->dev); 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) if (fep->interrupt == NO_IRQ)
return -EINVAL; return -EINVAL;
......
...@@ -687,7 +687,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) ...@@ -687,7 +687,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
struct spi_master *master; struct spi_master *master;
struct resource mem; struct resource mem;
struct resource irq; unsigned int irq;
int ret = -ENOMEM; int ret = -ENOMEM;
ret = of_mpc8xxx_spi_probe(ofdev); ret = of_mpc8xxx_spi_probe(ofdev);
...@@ -702,13 +702,13 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) ...@@ -702,13 +702,13 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
if (ret) if (ret)
goto err; goto err;
ret = of_irq_to_resource(np, 0, &irq); irq = irq_of_parse_and_map(np, 0);
if (!ret) { if (!ret) {
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
master = fsl_espi_probe(dev, &mem, irq.start); master = fsl_espi_probe(dev, &mem, irq);
if (IS_ERR(master)) { if (IS_ERR(master)) {
ret = PTR_ERR(master); ret = PTR_ERR(master);
goto err; goto err;
......
...@@ -1207,7 +1207,7 @@ static int cpm_uart_init_port(struct device_node *np, ...@@ -1207,7 +1207,7 @@ static int cpm_uart_init_port(struct device_node *np,
pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize;
spin_lock_init(&pinfo->port.lock); 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) { if (pinfo->port.irq == NO_IRQ) {
ret = -EINVAL; ret = -EINVAL;
goto out_pram; goto out_pram;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment