Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1255594 > unrolled thread
| Started by | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| First post | 2015-10-26 01:30 +0100 |
| Last post | 2015-10-30 10:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH -next] sparc: Populate 'device' for platform device devicetree nodes Guenter Roeck <linux@roeck-us.net> - 2015-10-26 01:30 +0100
Re: [PATCH -next] sparc: Populate 'device' for platform device devicetree nodes David Miller <davem@davemloft.net> - 2015-10-30 10:20 +0100
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2015-10-26 01:30 +0100 |
| Subject | [PATCH -next] sparc: Populate 'device' for platform device devicetree nodes |
| Message-ID | <qnDPH-1kC-1@gated-at.bofh.it> |
Since commit 61e82530d80f ("of/platform: Point to struct device from device
node"), the 'device' pointer in devicetree nodes for platform devices must
be set for of_find_device_by_node to succeed. This is not the case unless
the platform device was created using of_platform_device_create(), which
is not always the case. This causes all sparc images to crash with "Unable
to handle NULL pointer reference" in functions such as iommu_init(), which
don't expect of_find_device_by_node() to return NULL.
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
This patch depends on the patch causing the problem (which can not be easily
reverted). It should probably go through the same tree as that patch,
or the patches should be merged.
arch/sparc/kernel/of_device_32.c | 1 +
arch/sparc/kernel/of_device_64.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 185aa96fa5be..18a3506ead38 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -350,6 +350,7 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,
sd->op = op;
op->dev.of_node = dp;
+ dp->device = &op->dev;
intr = of_get_property(dp, "intr", &len);
if (intr) {
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 7bbdc26d9512..e7a7f3c8733e 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -647,6 +647,7 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,
sd->op = op;
op->dev.of_node = dp;
+ dp->device = &op->dev;
irq = of_get_property(dp, "interrupts", &len);
if (irq) {
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-10-30 10:20 +0100 |
| Subject | Re: [PATCH -next] sparc: Populate 'device' for platform device devicetree nodes |
| Message-ID | <qpe0O-3Z0-5@gated-at.bofh.it> |
| In reply to | #1255594 |
From: Guenter Roeck <linux@roeck-us.net>
Date: Sun, 25 Oct 2015 17:26:38 -0700
> Since commit 61e82530d80f ("of/platform: Point to struct device from device
> node"), the 'device' pointer in devicetree nodes for platform devices must
> be set for of_find_device_by_node to succeed. This is not the case unless
> the platform device was created using of_platform_device_create(), which
> is not always the case. This causes all sparc images to crash with "Unable
> to handle NULL pointer reference" in functions such as iommu_init(), which
> don't expect of_find_device_by_node() to return NULL.
>
> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> This patch depends on the patch causing the problem (which can not be easily
> reverted). It should probably go through the same tree as that patch,
> or the patches should be merged.
Indeed, please merge this into the tree that added the change in
question:
Acked-by: David S. Miller <davem@davemloft.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web