@@ -1673,9 +1673,8 @@ static int grcan_probe(struct platform_device *ofdev)
goto exit_error;
}
- irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ);
- if (!irq) {
- dev_err(&ofdev->dev, "no irq found\n");
+ irq = platform_get_irq(ofdev, GRCAN_IRQIX_IRQ);
+ if (irq < 0) {
err = -ENODEV;
goto exit_error;
}
@@ -300,9 +300,8 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
if (!base)
return dev_err_probe(&ofdev->dev, err, "couldn't ioremap\n");
- irq = irq_of_parse_and_map(np, 0);
- if (!irq) {
- dev_err(&ofdev->dev, "no irq found\n");
+ irq = platform_get_irq(ofdev, 0);
+ if (irq < 0) {
err = -ENODEV;
goto exit_unmap_mem;
}
@@ -1443,8 +1443,8 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
of_node_put(ports);
}
- priv->irq0 = irq_of_parse_and_map(dn, 0);
- priv->irq1 = irq_of_parse_and_map(dn, 1);
+ priv->irq0 = platform_get_irq(pdev, 0);
+ priv->irq1 = platform_get_irq(pdev, 1);
base = &priv->core;
for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
@@ -995,9 +995,8 @@ static int emac_probe(struct platform_device *pdev)
/* fill in parameters for net-dev structure */
ndev->base_addr = (unsigned long)db->membase;
- ndev->irq = irq_of_parse_and_map(np, 0);
- if (ndev->irq == -ENXIO) {
- netdev_err(ndev, "No irq resource\n");
+ ndev->irq = platform_get_irq(pdev, 0);
+ if (ndev->irq < 0) {
ret = ndev->irq;
goto out_iounmap;
}
@@ -859,9 +859,9 @@ static int mpc52xx_fec_probe(struct platform_device *op)
/* Get the IRQ we need one by one */
/* Control */
- ndev->irq = irq_of_parse_and_map(np, 0);
+ ndev->irq = platform_get_irq(op, 0);
- /* RX */
+ /* RX */
priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk);
/* TX */
@@ -83,8 +83,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
struct fs_platform_info *fpi = fep->fpi;
int ret = -EINVAL;
- fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
- if (!fep->interrupt)
+ fep->interrupt = platform_get_irq(ofdev, 0);
+ if (fep->interrupt < 0)
goto out;
fep->fcc.fccp = of_iomap(ofdev->dev.of_node, 0);
@@ -88,8 +88,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
{
struct platform_device *ofdev = to_platform_device(fep->dev);
- fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
- if (!fep->interrupt)
+ fep->interrupt = platform_get_irq(ofdev, 0);
+ if (fep->interrupt < 0)
return -EINVAL;
fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0);
@@ -87,8 +87,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
{
struct platform_device *ofdev = to_platform_device(fep->dev);
- fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
- if (!fep->interrupt)
+ fep->interrupt = platform_get_irq(ofdev, 0);
+ if (fep->interrupt < 0)
return -EINVAL;
fep->scc.sccp = of_iomap(ofdev->dev.of_node, 0);
@@ -3560,7 +3560,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
struct net_device *dev = NULL;
struct ucc_geth_private *ugeth = NULL;
struct ucc_geth_info *ug_info;
- struct resource res;
+ struct resource *res;
int err, ucc_num, max_speed = 0;
const unsigned int *prop;
phy_interface_t phy_interface;
@@ -3605,12 +3605,12 @@ static int ucc_geth_probe(struct platform_device* ofdev)
if (err)
return err;
- err = of_address_to_resource(np, 0, &res);
- if (err)
- return err;
+ res = platform_get_resource(ofdev, 0, IORESOURCE_MEM);
+ if (!res)
+ return -ENODEV;
- ug_info->uf_info.regs = res.start;
- ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
+ ug_info->uf_info.regs = res->start;
+ ug_info->uf_info.irq = platform_get_irq(ofdev, 0);
ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
if (!ug_info->phy_node && of_phy_is_fixed_link(np)) {
@@ -5511,8 +5511,8 @@ static int mvneta_probe(struct platform_device *pdev)
pp->neta_ac5 = true;
}
- dev->irq = irq_of_parse_and_map(dn, 0);
- if (dev->irq == 0)
+ dev->irq = platform_get_irq(pdev, 0);
+ if (dev->irq < 0)
return -EINVAL;
pp->clk = devm_clk_get(&pdev->dev, "core");
@@ -454,7 +454,6 @@ static const struct net_device_ops moxart_netdev_ops = {
static int moxart_mac_probe(struct platform_device *pdev)
{
struct device *p_dev = &pdev->dev;
- struct device_node *node = p_dev->of_node;
struct net_device *ndev;
struct moxart_mac_priv_t *priv;
struct resource *res;
@@ -465,9 +464,8 @@ static int moxart_mac_probe(struct platform_device *pdev)
if (!ndev)
return -ENOMEM;
- irq = irq_of_parse_and_map(node, 0);
- if (irq <= 0) {
- netdev_err(ndev, "irq_of_parse_and_map failed\n");
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
ret = -EINVAL;
goto irq_map_fail;
}
@@ -111,37 +111,29 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
}
/* Get the SXGBE common INT information */
- priv->irq = irq_of_parse_and_map(node, 0);
- if (priv->irq <= 0) {
- dev_err(dev, "sxgbe common irq parsing failed\n");
+ priv->irq = platform_get_irq(pdev, 0);
+ if (priv->irq < 0)
goto err_drv_remove;
- }
/* Get MAC address if available (DT) */
of_get_ethdev_address(node, priv->dev);
/* Get the TX/RX IRQ numbers */
for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) {
- priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++);
- if (priv->txq[i]->irq_no <= 0) {
- dev_err(dev, "sxgbe tx irq parsing failed\n");
+ priv->txq[i]->irq_no = platform_get_irq(pdev, chan++);
+ if (priv->txq[i]->irq_no < 0)
goto err_tx_irq_unmap;
- }
}
for (i = 0; i < SXGBE_RX_QUEUES; i++) {
- priv->rxq[i]->irq_no = irq_of_parse_and_map(node, chan++);
- if (priv->rxq[i]->irq_no <= 0) {
- dev_err(dev, "sxgbe rx irq parsing failed\n");
+ priv->rxq[i]->irq_no = platform_get_irq(pdev, chan++);
+ if (priv->rxq[i]->irq_no < 0)
goto err_rx_irq_unmap;
- }
}
- priv->lpi_irq = irq_of_parse_and_map(node, chan);
- if (priv->lpi_irq <= 0) {
- dev_err(dev, "sxgbe lpi irq parsing failed\n");
+ priv->lpi_irq = platform_get_irq(pdev, chan);
+ if (priv->lpi_irq < 0)
goto err_rx_irq_unmap;
- }
platform_set_drvdata(pdev, priv->dev);
@@ -1127,8 +1127,8 @@ static int rhine_init_one_platform(struct platform_device *pdev)
if (IS_ERR(ioaddr))
return PTR_ERR(ioaddr);
- irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
- if (!irq)
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
return -EINVAL;
return rhine_init_one_common(&pdev->dev, *quirks,
@@ -2950,8 +2950,8 @@ static int velocity_platform_probe(struct platform_device *pdev)
if (!info)
return -EINVAL;
- irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
- if (!irq)
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
return -EINVAL;
return velocity_probe(&pdev->dev, irq, info, BUS_PLATFORM);
@@ -69,7 +69,7 @@ int temac_mdio_setup(struct temac_local *lp, struct platform_device *pdev)
u32 bus_hz;
int clk_div;
int rc;
- struct resource res;
+ struct resource *res;
/* Get MDIO bus frequency (if specified) */
bus_hz = 0;
@@ -98,9 +98,9 @@ int temac_mdio_setup(struct temac_local *lp, struct platform_device *pdev)
return -ENOMEM;
if (np) {
- of_address_to_resource(np, 0, &res);
+ res = platform_get_resource(pdev, 0, IORESOURCE_MEM);
snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx",
- (unsigned long long)res.start);
+ (unsigned long long)res->start);
} else if (pdata) {
snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx",
pdata->mdio_bus_id);
@@ -98,7 +98,7 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct mdio_mux_mmioreg_state *s;
- struct resource res;
+ struct resource *res;
const __be32 *iprop;
int len, ret;
@@ -108,13 +108,15 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)
if (!s)
return -ENOMEM;
- ret = of_address_to_resource(np, 0, &res);
- if (ret)
- return dev_err_probe(&pdev->dev, ret,
- "could not obtain memory map for node %pOF\n", np);
- s->phys = res.start;
+ res = platform_get_resource(pdev, 0, IORESOURCE_MEM);
+ if (!res) {
+ dev_err(&pdev->dev,
+ "could not obtain memory map for node %pOF\n", np);
+ return -ENODEV;
+ }
+ s->phys = res->start;
- s->iosize = resource_size(&res);
+ s->iosize = resource_size(res);
if (s->iosize != sizeof(uint8_t) &&
s->iosize != sizeof(uint16_t) &&
s->iosize != sizeof(uint32_t))
@@ -1118,7 +1118,7 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
struct ucc_hdlc_private *uhdlc_priv = NULL;
struct ucc_tdm_info *ut_info;
struct ucc_tdm *utdm = NULL;
- struct resource res;
+ struct resource *res;
struct net_device *dev;
hdlc_device *hdlc;
int ucc_num;
@@ -1170,12 +1170,12 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
return -EINVAL;
}
- ret = of_address_to_resource(np, 0, &res);
- if (ret)
+ res = platform_get_resource(pdev, 0, IORESOURCE_MEM);
+ if (!res)
return -EINVAL;
- ut_info->uf_info.regs = res.start;
- ut_info->uf_info.irq = irq_of_parse_and_map(np, 0);
+ ut_info->uf_info.regs = res->start;
+ ut_info->uf_info.irq = platform_get_irq(pdev, 0);
uhdlc_priv = kzalloc(sizeof(*uhdlc_priv), GFP_KERNEL);
if (!uhdlc_priv)