USB: of: fix root-hub device-tree node handling
authorJohan Hovold <johan@kernel.org>
Tue, 6 Jun 2017 15:59:02 +0000 (17:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Jun 2017 09:07:32 +0000 (11:07 +0200)
commit2bf698671205bb6f898db348b788d16f6976e086
tree92d198fc5e5799954aff6b266c3df3ecd28333cb
parented032c1bede83ec9bd5f7e803e663cb7f76e5947
USB: of: fix root-hub device-tree node handling

In an attempt to work around a pinmux over-allocation issue in driver
core, commit dc5878abf49c ("usb: core: move root hub's device node
assignment after it is added to bus") moved the device-tree node
assignment until after the root hub had been registered.

This not only makes the device-tree node unavailable to the usb driver
during probe, but also prevents the of_node from being linked to in
sysfs and causes a race with user-space for the (recently added) devspec
attribute.

Use the new device_set_of_node_from_dev() helper to reuse the node of
the sysdev device, something which now prevents driver core from trying
to reclaim any pinctrl pins during probe.

Fixes: dc5878abf49c ("usb: core: move root hub's device node assignment after it is added to bus")
Fixes: 51fa91475e43 ("usb/core: Added devspec sysfs entry for devices behind the usb hub")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c
drivers/usb/core/usb.c