static int __devinit ulite_probe(struct platform_device *pdev) { struct resource *res, *res2; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res2) return -ENODEV; return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start); }
static int __devinit ulite_of_probe(struct of_device *op, const struct of_device_id *match) { struct resource res; const unsigned int *id; int irq, rc; dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match); rc = of_address_to_resource(op->node, 0, &res); if (rc) { dev_err(&op->dev, "invalid address\n"); return rc; } irq = irq_of_parse_and_map(op->node, 0); id = of_get_property(op->node, "port-number", NULL); return ulite_assign(&op->dev, id ? *id : -1, res.start+3, irq); }
static int ulite_probe(struct platform_device *pdev) { struct resource *res, *res2; int id = pdev->id; #ifdef CONFIG_OF const __be32 *prop; /* Look for a serialN alias */ id = of_alias_get_id(pdev->dev.of_node, "serial"); if (id < 0) { dev_warn(&pdev->dev, "failed to get alias id, errno %d\n", id); /* Fall back to old port-number property */ prop = of_get_property(pdev->dev.of_node, "port-number", NULL); if (!prop) { dev_warn(&pdev->dev, "failed to get port-number\n"); id = -1; } else id = be32_to_cpup(prop); } /* we can't register ids which are greater than number of uartlites */ if (id >= ULITE_NR_UARTS) { dev_warn(&pdev->dev, "Extern number of allocated uartlite entries " "ULITE_NR_UARTS, id %d\n", id); return -ENODEV; } #endif res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res2) return -ENODEV; return ulite_assign(&pdev->dev, id, res->start, res2->start); }
static int __devinit ulite_probe(struct platform_device *pdev) { struct resource *res, *res2; int id = pdev->id; #ifdef CONFIG_OF const __be32 *prop; prop = of_get_property(pdev->dev.of_node, "port-number", NULL); if (prop) id = be32_to_cpup(prop); #endif res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res2) return -ENODEV; return ulite_assign(&pdev->dev, id, res->start, res2->start); }