On Thu, 5 Apr 2012 10:42:58 +0200, Thierry Reding <thierry.red...@avionic-design.de> wrote: > Hi, > > I have a device tree where I have a GART device and a DRM device which uses > the GART. The GART is implemented by an IOMMU driver (tegra-gart) and > requires the user device to be a child of the GART device (it explicitly > checks for this when the user device is attached). > > I've tried two alternatives to achieve this: create the GART device in the > user driver's .probe() function and explicitly set the DRM device's parent > to the resulting platform device like so: > > gart = platform_device_alloc(...); > ... > pdev->dev.parent = &gart->dev;
Yeah, don't *ever* try to do this. The device hierarchy is a complex data structure which must never be directly manipulated. > > The alternative is to use the device tree to look up the GART device node and > resolve it to the corresponding struct device: > > gart_node = of_parse_phandle(drm->dev->of_node, "gart-parent", 0); > gart = bus_find_device(drm->dev->bus, NULL, gart_node, match_of_node); > > Where match_of_node matches each struct device's .of_node field to the > gart_node. > > Both of these variants seem to work, and the DRM device can be properly > attached to the GART device. However, after the DRM driver's .probe() exits, > I get the following error: I don't understand what you're trying to describe here as the 2nd option. Regardless, reparenting should not ben the solution at all. What does the device tree that you envision look like for this? What devices are created, and what drivers bind to them? g. _______________________________________________ devicetree-discuss mailing list devicetree-discuss@lists.ozlabs.org https://lists.ozlabs.org/listinfo/devicetree-discuss