diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2018-08-19 23:10:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-10 14:40:29 -0400 |
commit | fa827966090e2a6fc07b437d0d2ffae748ec6e28 (patch) | |
tree | b415fe1dd8e8574cc4f8cf45391b325556a990d4 | |
parent | 0a3b53305c8ff427bbc1d9d5bd78524007f19600 (diff) |
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: 39facfa01c9f ("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>
-rw-r--r-- | drivers/usb/common/common.c | 25 | ||||
-rw-r--r-- | drivers/usb/core/of.c | 26 |
2 files changed, 25 insertions, 26 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 | } |
247 | EXPORT_SYMBOL_GPL(of_usb_update_otg_caps); | 247 | EXPORT_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 | */ | ||
260 | struct 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 | } | ||
273 | EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); | ||
249 | #endif | 274 | #endif |
250 | 275 | ||
251 | MODULE_LICENSE("GPL"); | 276 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c index fd77442c2d12..651708d8c908 100644 --- a/drivers/usb/core/of.c +++ b/drivers/usb/core/of.c | |||
@@ -105,29 +105,3 @@ usb_of_get_interface_node(struct usb_device *udev, u8 config, u8 ifnum) | |||
105 | return NULL; | 105 | return NULL; |
106 | } | 106 | } |
107 | EXPORT_SYMBOL_GPL(usb_of_get_interface_node); | 107 | EXPORT_SYMBOL_GPL(usb_of_get_interface_node); |
108 | |||
109 | /** | ||
110 | * usb_of_get_companion_dev - Find the companion device | ||
111 | * @dev: the device pointer to find a companion | ||
112 | * | ||
113 | * Find the companion device from platform bus. | ||
114 | * | ||
115 | * Takes a reference to the returned struct device which needs to be dropped | ||
116 | * after use. | ||
117 | * | ||
118 | * Return: On success, a pointer to the companion device, %NULL on failure. | ||
119 | */ | ||
120 | struct device *usb_of_get_companion_dev(struct device *dev) | ||
121 | { | ||
122 | struct device_node *node; | ||
123 | struct platform_device *pdev = NULL; | ||
124 | |||
125 | node = of_parse_phandle(dev->of_node, "companion", 0); | ||
126 | if (node) | ||
127 | pdev = of_find_device_by_node(node); | ||
128 | |||
129 | of_node_put(node); | ||
130 | |||
131 | return pdev ? &pdev->dev : NULL; | ||
132 | } | ||
133 | EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); | ||