diff options
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 1c958eb33ef4..4e45ac21d672 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -127,7 +127,20 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) | |||
127 | irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS); | 127 | irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS); |
128 | } | 128 | } |
129 | 129 | ||
130 | return r ? r->start : -ENXIO; | 130 | if (r) |
131 | return r->start; | ||
132 | |||
133 | /* | ||
134 | * For the index 0 interrupt, allow falling back to GpioInt | ||
135 | * resources. While a device could have both Interrupt and GpioInt | ||
136 | * resources, making this fallback ambiguous, in many common cases | ||
137 | * the device will only expose one IRQ, and this fallback | ||
138 | * allows a common code path across either kind of resource. | ||
139 | */ | ||
140 | if (num == 0 && has_acpi_companion(&dev->dev)) | ||
141 | return acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num); | ||
142 | |||
143 | return -ENXIO; | ||
131 | #endif | 144 | #endif |
132 | } | 145 | } |
133 | EXPORT_SYMBOL_GPL(platform_get_irq); | 146 | EXPORT_SYMBOL_GPL(platform_get_irq); |
@@ -508,10 +521,12 @@ struct platform_device *platform_device_register_full( | |||
508 | 521 | ||
509 | pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id); | 522 | pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id); |
510 | if (!pdev) | 523 | if (!pdev) |
511 | goto err_alloc; | 524 | return ERR_PTR(-ENOMEM); |
512 | 525 | ||
513 | pdev->dev.parent = pdevinfo->parent; | 526 | pdev->dev.parent = pdevinfo->parent; |
514 | pdev->dev.fwnode = pdevinfo->fwnode; | 527 | pdev->dev.fwnode = pdevinfo->fwnode; |
528 | pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode)); | ||
529 | pdev->dev.of_node_reused = pdevinfo->of_node_reused; | ||
515 | 530 | ||
516 | if (pdevinfo->dma_mask) { | 531 | if (pdevinfo->dma_mask) { |
517 | /* | 532 | /* |
@@ -553,8 +568,6 @@ struct platform_device *platform_device_register_full( | |||
553 | err: | 568 | err: |
554 | ACPI_COMPANION_SET(&pdev->dev, NULL); | 569 | ACPI_COMPANION_SET(&pdev->dev, NULL); |
555 | kfree(pdev->dev.dma_mask); | 570 | kfree(pdev->dev.dma_mask); |
556 | |||
557 | err_alloc: | ||
558 | platform_device_put(pdev); | 571 | platform_device_put(pdev); |
559 | return ERR_PTR(ret); | 572 | return ERR_PTR(ret); |
560 | } | 573 | } |