]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/usb/phy/phy.c
usb: phy: Restore deferred probing path
authorThierry Reding <treding@nvidia.com>
Thu, 4 Dec 2014 12:06:07 +0000 (13:06 +0100)
committerFelipe Balbi <balbi@ti.com>
Tue, 23 Dec 2014 18:37:16 +0000 (12:37 -0600)
commitc818a94c77a9980709197c53368aa83451fd659f
tree7c639a1f42158507af5f7eeb2b1397129ce0c467
parent6785a1034461c2d2c205215f63a50a740896e55b
usb: phy: Restore deferred probing path

Commit 1290a958d48e ("usb: phy: propagate __of_usb_find_phy()'s error on
failure") broke platforms that rely on deferred probing to order probing
of PHY and host controller drivers. The reason is that the commit simply
propagates errors from __of_usb_find_phy(), which returns -ENODEV if no
PHY has been registered yet for a given device tree node. The only case
in which -EPROBE_DEFER would now be returned is if try_module_get() did
fail, which does not make sense.

The correct thing to do is to return -EPROBE_DEFER if a PHY hasn't been
registered yet. The only condition under which it makes sense to return
-ENODEV is if the device tree node representing the PHY has been
disabled (via the status property) because in that case the PHY will
never be registered.

This patch addresses the problem by making __of_usb_find_phy() return an
appropriate error code while keeping in line with the above-mentioned
commit to propagate error codes rather than overwriting them. At the
same time the check for a valid PHY is decoupled from the check for the
try_module_get() call and a separate error code is returned if the
latter fails.

Fixes: 1290a95 (usb: phy: propagate __of_usb_find_phy()'s error on failure)
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/phy/phy.c