diff options
author | David S. Miller <davem@davemloft.net> | 2018-09-18 19:33:27 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-18 19:33:27 +0300 |
commit | e366fa435032db1ce1538a2c029714666985dd48 (patch) | |
tree | d08bab02ba212339e4cfc0f2e3666435dd795b90 /drivers/usb/common/common.c | |
parent | cf7d97e1e54d71679a8b11716dad9d21deb0e1e2 (diff) | |
parent | 5211da9ca526a5adddee1ccd078e6e33a583ab36 (diff) | |
download | linux-e366fa435032db1ce1538a2c029714666985dd48.tar.xz |
Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
Two new tls tests added in parallel in both net and net-next.
Used Stephen Rothwell's linux-next resolution.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/common/common.c')
-rw-r--r-- | drivers/usb/common/common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 50a2362ed3ea..48277bbc15e4 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -246,6 +246,31 @@ int of_usb_update_otg_caps(struct device_node *np, } EXPORT_SYMBOL_GPL(of_usb_update_otg_caps); +/** + * usb_of_get_companion_dev - Find the companion device + * @dev: the device pointer to find a companion + * + * Find the companion device from platform bus. + * + * Takes a reference to the returned struct device which needs to be dropped + * after use. + * + * Return: On success, a pointer to the companion device, %NULL on failure. + */ +struct device *usb_of_get_companion_dev(struct device *dev) +{ + struct device_node *node; + struct platform_device *pdev = NULL; + + node = of_parse_phandle(dev->of_node, "companion", 0); + if (node) + pdev = of_find_device_by_node(node); + + of_node_put(node); + + return pdev ? &pdev->dev : NULL; +} +EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); #endif MODULE_LICENSE("GPL"); |