mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00:00
usb: Change usb_of_get_companion_dev() place to usb/common
Since renesas_usb3 udc driver calls usb_of_get_companion_dev()
which is on usb/core/of.c, build error like below happens if we
disable CONFIG_USB because the usb/core/ needs CONFIG_USB:
ERROR: "usb_of_get_companion_dev" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined!
According to the usb/gadget/Kconfig, "NOTE: Gadget support
** DOES NOT ** depend on host-side CONFIG_USB !!".
So, to fix the issue, this patch changes the usb_of_get_companion_dev()
place from usb/core/of.c to usb/common/common.c to be called by both
host and gadget.
Reported-by: John Garry <john.garry@huawei.com>
Fixes: 39facfa01c
("usb: gadget: udc: renesas_usb3: Add register of usb role switch")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0a3b53305c
commit
fa82796609
@ -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");
|
||||
|
@ -105,29 +105,3 @@ usb_of_get_interface_node(struct usb_device *udev, u8 config, u8 ifnum)
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_of_get_interface_node);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user