aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/common/common.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-09-26 21:06:46 -0400
committerDave Airlie <airlied@redhat.com>2018-09-26 21:06:46 -0400
commitbf78296ab1cb215d0609ac6cff4e43e941e51265 (patch)
treea193615b327d9ee538e71ca5f13bbfb4f3db4e6b /drivers/usb/common/common.c
parent18eb2f6e19d77900695987e3a2b775cccbe5b84e (diff)
parent6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84 (diff)
BackMerge v4.19-rc5 into drm-next
Sean Paul requested an -rc5 backmerge from some sun4i fixes. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/usb/common/common.c')
-rw-r--r--drivers/usb/common/common.c25
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,
246} 246}
247EXPORT_SYMBOL_GPL(of_usb_update_otg_caps); 247EXPORT_SYMBOL_GPL(of_usb_update_otg_caps);
248 248
249/**
250 * usb_of_get_companion_dev - Find the companion device
251 * @dev: the device pointer to find a companion
252 *
253 * Find the companion device from platform bus.
254 *
255 * Takes a reference to the returned struct device which needs to be dropped
256 * after use.
257 *
258 * Return: On success, a pointer to the companion device, %NULL on failure.
259 */
260struct device *usb_of_get_companion_dev(struct device *dev)
261{
262 struct device_node *node;
263 struct platform_device *pdev = NULL;
264
265 node = of_parse_phandle(dev->of_node, "companion", 0);
266 if (node)
267 pdev = of_find_device_by_node(node);
268
269 of_node_put(node);
270
271 return pdev ? &pdev->dev : NULL;
272}
273EXPORT_SYMBOL_GPL(usb_of_get_companion_dev);
249#endif 274#endif
250 275
251MODULE_LICENSE("GPL"); 276MODULE_LICENSE("GPL");