Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29e409f0 authored by Andrew Bresticker's avatar Andrew Bresticker Committed by Greg Kroah-Hartman
Browse files

xhci: Allow xHCI drivers to be built as separate modules



Instead of building all of the xHCI code into a single module, separate
it out into the core (xhci-hcd), PCI (xhci-pci, now selected by the new
config option CONFIG_USB_XHCI_PCI), and platform (xhci-plat) drivers.
Also update the PCI/platform drivers with module descriptions/licenses
and have them register their respective drivers in their initcalls.

Signed-off-by: default avatarAndrew Bresticker <abrestic@chromium.org>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 436e8c7d
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,11 @@ config USB_XHCI_HCD


if USB_XHCI_HCD
if USB_XHCI_HCD


config USB_XHCI_PCI
       tristate
       depends on PCI
       default y

config USB_XHCI_PLATFORM
config USB_XHCI_PLATFORM
	tristate
	tristate


+6 −6
Original line number Original line Diff line number Diff line
@@ -15,22 +15,22 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o
xhci-hcd-y := xhci.o xhci-mem.o
xhci-hcd-y := xhci.o xhci-mem.o
xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o
xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o
xhci-hcd-y += xhci-trace.o
xhci-hcd-y += xhci-trace.o
xhci-hcd-$(CONFIG_PCI)	+= xhci-pci.o


ifneq ($(CONFIG_USB_XHCI_PLATFORM), )
xhci-plat-hcd-y := xhci-plat.o
	xhci-hcd-y		+= xhci-plat.o
ifneq ($(CONFIG_USB_XHCI_MVEBU), )
ifneq ($(CONFIG_USB_XHCI_MVEBU), )
	xhci-hcd-y		+= xhci-mvebu.o
	xhci-plat-hcd-y		+= xhci-mvebu.o
endif
endif
ifneq ($(CONFIG_USB_XHCI_RCAR), )
ifneq ($(CONFIG_USB_XHCI_RCAR), )
	xhci-hcd-y		+= xhci-rcar.o
	xhci-plat-hcd-y		+= xhci-rcar.o
endif
endif
endif


obj-$(CONFIG_USB_WHCI_HCD)	+= whci/
obj-$(CONFIG_USB_WHCI_HCD)	+= whci/


obj-$(CONFIG_PCI)		+= pci-quirks.o
obj-$(CONFIG_PCI)		+= pci-quirks.o


obj-$(CONFIG_USB_XHCI_PCI)	+= xhci-pci.o
obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o

obj-$(CONFIG_USB_EHCI_HCD)	+= ehci-hcd.o
obj-$(CONFIG_USB_EHCI_HCD)	+= ehci-hcd.o
obj-$(CONFIG_USB_EHCI_PCI)	+= ehci-pci.o
obj-$(CONFIG_USB_EHCI_PCI)	+= ehci-pci.o
obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)	+= ehci-platform.o
obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)	+= ehci-platform.o
+7 −2
Original line number Original line Diff line number Diff line
@@ -355,7 +355,7 @@ static struct pci_driver xhci_pci_driver = {
#endif
#endif
};
};


int __init xhci_register_pci(void)
static int __init xhci_pci_init(void)
{
{
	xhci_init_driver(&xhci_pci_hc_driver, xhci_pci_setup);
	xhci_init_driver(&xhci_pci_hc_driver, xhci_pci_setup);
#ifdef CONFIG_PM
#ifdef CONFIG_PM
@@ -364,8 +364,13 @@ int __init xhci_register_pci(void)
#endif
#endif
	return pci_register_driver(&xhci_pci_driver);
	return pci_register_driver(&xhci_pci_driver);
}
}
module_init(xhci_pci_init);


void xhci_unregister_pci(void)
static void __exit xhci_pci_exit(void)
{
{
	pci_unregister_driver(&xhci_pci_driver);
	pci_unregister_driver(&xhci_pci_driver);
}
}
module_exit(xhci_pci_exit);

MODULE_DESCRIPTION("xHCI PCI Host Controller Driver");
MODULE_LICENSE("GPL");
+7 −2
Original line number Original line Diff line number Diff line
@@ -247,14 +247,19 @@ static struct platform_driver usb_xhci_driver = {
};
};
MODULE_ALIAS("platform:xhci-hcd");
MODULE_ALIAS("platform:xhci-hcd");


int xhci_register_plat(void)
static int __init xhci_plat_init(void)
{
{
	xhci_init_driver(&xhci_plat_hc_driver, xhci_plat_setup);
	xhci_init_driver(&xhci_plat_hc_driver, xhci_plat_setup);
	xhci_plat_hc_driver.start = xhci_plat_start;
	xhci_plat_hc_driver.start = xhci_plat_start;
	return platform_driver_register(&usb_xhci_driver);
	return platform_driver_register(&usb_xhci_driver);
}
}
module_init(xhci_plat_init);


void xhci_unregister_plat(void)
static void __exit xhci_plat_exit(void)
{
{
	platform_driver_unregister(&usb_xhci_driver);
	platform_driver_unregister(&usb_xhci_driver);
}
}
module_exit(xhci_plat_exit);

MODULE_DESCRIPTION("xHCI Platform Host Controller Driver");
MODULE_LICENSE("GPL");
+0 −22
Original line number Original line Diff line number Diff line
@@ -4982,18 +4982,6 @@ MODULE_LICENSE("GPL");


static int __init xhci_hcd_init(void)
static int __init xhci_hcd_init(void)
{
{
	int retval;

	retval = xhci_register_pci();
	if (retval < 0) {
		pr_debug("Problem registering PCI driver.\n");
		return retval;
	}
	retval = xhci_register_plat();
	if (retval < 0) {
		pr_debug("Problem registering platform driver.\n");
		goto unreg_pci;
	}
	/*
	/*
	 * Check the compiler generated sizes of structures that must be laid
	 * Check the compiler generated sizes of structures that must be laid
	 * out in specific ways for hardware access.
	 * out in specific ways for hardware access.
@@ -5012,15 +5000,5 @@ static int __init xhci_hcd_init(void)
	/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
	/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
	BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
	BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
	return 0;
	return 0;
unreg_pci:
	xhci_unregister_pci();
	return retval;
}
}
module_init(xhci_hcd_init);
module_init(xhci_hcd_init);

static void __exit xhci_hcd_cleanup(void)
{
	xhci_unregister_pci();
	xhci_unregister_plat();
}
module_exit(xhci_hcd_cleanup);
Loading