diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2012-08-23 09:54:09 -0400 |
---|---|---|
committer | Benoit Cousson <b-cousson@ti.com> | 2012-09-06 08:21:16 -0400 |
commit | 3956a1a0d1e072c321fcf1b1136e35a22be12af5 (patch) | |
tree | 8931d206ebaaad50a72380d78d984ebf8bd72e40 /arch/arm | |
parent | a06ceff6f29e34edff5d6b082885c1c4139a0362 (diff) |
ARM: OMAP: omap_device: Fix up resource names when booted with devicetree
When booted with some resource will have their name set to NULL. This can
cause later kernel crash since this is not expected by the platform code.
When we boot without DT the devices are created with platform_device_add()
which itself fixes up the missing resource names:
if (r->name == NULL)
r->name = dev_name(&pdev->dev);
The of core also fixes up the resource names when taking the information
from DT data - in __of_address_to_resource():
r->name = name ? name : dev->full_name;
When we boot OMAP with devicetree: of will create the devices based on the
DT data so the resource names are guarantied to be not NULL. Since we have
the 'ti,hwmod' tag, we remove the of created resources from the device and
re-create them based on hwmod data. If the hwmod data does not specify a
name for a resource it will be NULL.
This can cause kernel crash if the driver uses
platform_get_resource_byname() to get any resource.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
[b-cousson@ti.com: Change omap_hwmod to omap_device in subject]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-omap/omap_device.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index c490240bb82c..ff57b5aeba4e 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c | |||
@@ -370,6 +370,14 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
370 | goto odbfd_exit1; | 370 | goto odbfd_exit1; |
371 | } | 371 | } |
372 | 372 | ||
373 | /* Fix up missing resource names */ | ||
374 | for (i = 0; i < pdev->num_resources; i++) { | ||
375 | struct resource *r = &pdev->resource[i]; | ||
376 | |||
377 | if (r->name == NULL) | ||
378 | r->name = dev_name(&pdev->dev); | ||
379 | } | ||
380 | |||
373 | if (of_get_property(node, "ti,no_idle_on_suspend", NULL)) | 381 | if (of_get_property(node, "ti,no_idle_on_suspend", NULL)) |
374 | omap_device_disable_idle_on_suspend(pdev); | 382 | omap_device_disable_idle_on_suspend(pdev); |
375 | 383 | ||