On Sat, Mar 12, 2011 at 03:00:57PM +0800, Shawn Guo wrote:
Hello all,
I'm looking at function of_device_alloc in drivers/of/platform.c, and surprisingly found that the platform device instance id is being hard-coded as -1 when calling platform_device_alloc. Does this mean that there is no support of pdev id in DT?
Correct, when generating devices from the DT, the core code has no way of knowing what the 'preferred' number of the device should be. It expects that when the driver's .probe() hook is called, the driver is smart enough to enumerate the automatically.
If yes, can anyone please help me understand why we do not have something in DT node to reflect this id and get it supported? Or this is something on TODO list?
Ideally, you shouldn't be relying on .id at all. Fix your device drivers to enumerate correctly, and use explicit phandle references when specifying connections between devices.
That said, I do understand the issue with needing to reference a specific device by name; like for specifying the console device. In those cases, the correct way to figure out what number a device is supposed to have is to add a property to the /aliases node (see ePAPR for a description of /aliases). However, even in this case the driver should be looking at the device tree data, and not depend on the value in pdev->id.
I'm asking this because I feel we still need pdev id support in DT when reviewing the patch set of 'mx51 basic DT support'.
-- Regards, Shawn
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev