Skip to content

Commit

Permalink
of/irq: Use irq_of_parse_and_map()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Reding authored and Grant Likely committed Oct 24, 2013
1 parent 3da5278 commit f757849
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 39 deletions.
9 changes: 4 additions & 5 deletions arch/arm/mach-u300/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions arch/powerpc/platforms/cell/celleb_scc_pciex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/platforms/cell/spider-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions arch/powerpc/sysdev/fsl_gtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 2 additions & 4 deletions arch/powerpc/sysdev/mpic_msgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/caam/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/caam/jr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/omap-sham.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-cpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 4 additions & 3 deletions drivers/input/serio/xilinx_ps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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;
}
Expand All @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/arc/emac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/freescale/fs_enet/mac-fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/freescale/fs_enet/mac-scc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions drivers/spi/spi-fsl-espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/cpm_uart/cpm_uart_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f757849

Please sign in to comment.