Patch fixes the following errors:
ld: drivers/usb/cdns3/cdnsp-pci.o: in function `cdnsp_pci_remove':
cdnsp-pci.c:(.text+0x80): undefined reference to `cdns_remove'
ld: drivers/usb/cdns3/cdnsp-pci.o: in function `cdnsp_pci_probe':
cdnsp-pci.c:(.text+0x34c): undefined reference to `cdns_init'

Issue occurs for USB/CDNS3/CDNSP kernel configuration:
CONFIG_USB=m
CONFIG_USB_CDNS_SUPPORT=y
CONFIG_USB_CDNS3=m
CONFIG_USB_CDNS3_PCI_WRAP=m
CONFIG_USB_CDNSP_PCI=y

Reported-by: Randy Dunlap <rdun...@infradead.org>
Signed-off-by: Pawel Laszczak <paw...@cadence.com>
---
changelog:
v2
- added missing condition

 drivers/usb/cdns3/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/cdns3/Makefile b/drivers/usb/cdns3/Makefile
index 3f9b7fa8a594..61edb2f89276 100644
--- a/drivers/usb/cdns3/Makefile
+++ b/drivers/usb/cdns3/Makefile
@@ -26,7 +26,15 @@ obj-$(CONFIG_USB_CDNS3_TI)                   += cdns3-ti.o
 obj-$(CONFIG_USB_CDNS3_IMX)                    += cdns3-imx.o
 
 cdnsp-udc-pci-y                                        := cdnsp-pci.o
+
+ifdef CONFIG_USB_CDNSP_PCI
+ifeq ($(CONFIG_USB),m)
+obj-m                                          += cdnsp-udc-pci.o
+else
 obj-$(CONFIG_USB_CDNSP_PCI)                    += cdnsp-udc-pci.o
+endif
+endif
+
 cdnsp-udc-pci-$(CONFIG_USB_CDNSP_GADGET)       += cdnsp-ring.o cdnsp-gadget.o \
                                                   cdnsp-mem.o cdnsp-ep0.o
 
-- 
2.17.1

Reply via email to