platform: set of_node in platform_device_register_full()
If the provided fwnode is an OF node, set dev.of_node as well.
Also add an of_node_reused flag to struct platform_device_info and copy
this to the new device. This is needed to avoid pinctrl settings being
requested twice. See
4e75e1d7dac9 ("driver core: add helper to reuse a
device-tree node") for a longer explanation.
Some drivers are just shims that create extra "glue" devices with the
DT device as parent and have the real driver bind to these. In these
cases, the glue device needs to get a reference to the original DT node
in order for the main driver to access properties and child nodes.
For example, the sunxi-musb driver creates such a glue device using
platform_device_register_full(). Consequently, devices attached to
this USB interface don't get associated with DT nodes, if present,
the way they do with EHCI.
This change will allow sunxi-musb and similar drivers to easily
propagate the DT node to child devices as required.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>