linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules
@ 2014-08-19 17:01 Andrew Bresticker
  2014-08-19 17:01 ` [PATCH v3 1/4] xhci: Introduce xhci_init_driver() Andrew Bresticker
       [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Bresticker @ 2014-08-19 17:01 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Andrew Bresticker

It was suggested in the review of the Tegra xHCI driver [1] that we
allow xHCI drivers to be built as individual modules (like EHCI) instead
of building them all into the single xhci-hcd module as they are today.

Patches 1-3 prepare for making the xHCI PCI and platform drivers able
to be built as individual modules and patch 4 actually creates the 3
separate modules (core, platform, PCI).

Based on 3.17-rc1.

Changes from v2:
 - fixed typo in xhci_register_plat
 - exported another symbol needed by xhci-pci module
Changes from v1:
 - rebased on changes introduced by xhci-rcar driver

[1] http://patchwork.ozlabs.org/patch/361265/

Andrew Bresticker (4):
  xhci: Introduce xhci_init_driver()
  xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold
  xhci: Export symbols used by host-controller drivers
  xhci: Allow xHCI drivers to be built as separate modules

 drivers/usb/host/Kconfig      |  5 +++
 drivers/usb/host/Makefile     | 12 +++---
 drivers/usb/host/xhci-dbg.c   |  1 +
 drivers/usb/host/xhci-pci.c   | 80 +++++++----------------------------
 drivers/usb/host/xhci-plat.c  | 68 ++++++------------------------
 drivers/usb/host/xhci-trace.c |  2 +
 drivers/usb/host/xhci.c       | 97 +++++++++++++++++++++++++++++++++----------
 drivers/usb/host/xhci.h       | 23 +---------
 8 files changed, 116 insertions(+), 172 deletions(-)

-- 
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/4] xhci: Introduce xhci_init_driver()
  2014-08-19 17:01 [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules Andrew Bresticker
@ 2014-08-19 17:01 ` Andrew Bresticker
       [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Bresticker @ 2014-08-19 17:01 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, linux-usb
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding, linux-kernel, linux-tegra,
	Andrew Bresticker

Since the struct hc_driver is mostly the same across the xhci-pci,
xhci-plat, and the upcoming xhci-tegra driver, introduce the function
xhci_init_driver() which will populate the hc_driver with the default
xHCI operations.  The caller must supply a setup function which will
be used as the hc_driver's reset callback.

Note that xhci-plat also overrides the default ->start() callback so
that it can do rcar-specific initialization.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
---
Changes from v2:
 - fixed typo in xhci_register_plat
Changes from v1:
 - rebased on changes introduced by xhci-rcar driver
---
 drivers/usb/host/xhci-pci.c  | 69 +++++---------------------------------------
 drivers/usb/host/xhci-plat.c | 59 ++++---------------------------------
 drivers/usb/host/xhci.c      | 69 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/xhci.h      |  1 +
 4 files changed, 82 insertions(+), 116 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 687d366..88d4553 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -40,6 +40,8 @@
 
 static const char hcd_name[] = "xhci_hcd";
 
+static struct hc_driver __read_mostly xhci_pci_hc_driver;
+
 /* called after powerup, by probe or system-pm "wakeup" */
 static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
 {
@@ -315,68 +317,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
 }
 #endif /* CONFIG_PM */
 
-static const struct hc_driver xhci_pci_hc_driver = {
-	.description =		hcd_name,
-	.product_desc =		"xHCI Host Controller",
-	.hcd_priv_size =	sizeof(struct xhci_hcd *),
-
-	/*
-	 * generic hardware linkage
-	 */
-	.irq =			xhci_irq,
-	.flags =		HCD_MEMORY | HCD_USB3 | HCD_SHARED,
-
-	/*
-	 * basic lifecycle operations
-	 */
-	.reset =		xhci_pci_setup,
-	.start =		xhci_run,
-#ifdef CONFIG_PM
-	.pci_suspend =          xhci_pci_suspend,
-	.pci_resume =           xhci_pci_resume,
-#endif
-	.stop =			xhci_stop,
-	.shutdown =		xhci_shutdown,
-
-	/*
-	 * managing i/o requests and associated device resources
-	 */
-	.urb_enqueue =		xhci_urb_enqueue,
-	.urb_dequeue =		xhci_urb_dequeue,
-	.alloc_dev =		xhci_alloc_dev,
-	.free_dev =		xhci_free_dev,
-	.alloc_streams =	xhci_alloc_streams,
-	.free_streams =		xhci_free_streams,
-	.add_endpoint =		xhci_add_endpoint,
-	.drop_endpoint =	xhci_drop_endpoint,
-	.endpoint_reset =	xhci_endpoint_reset,
-	.check_bandwidth =	xhci_check_bandwidth,
-	.reset_bandwidth =	xhci_reset_bandwidth,
-	.address_device =	xhci_address_device,
-	.enable_device =	xhci_enable_device,
-	.update_hub_device =	xhci_update_hub_device,
-	.reset_device =		xhci_discover_or_reset_device,
-
-	/*
-	 * scheduling support
-	 */
-	.get_frame_number =	xhci_get_frame,
-
-	/* Root hub support */
-	.hub_control =		xhci_hub_control,
-	.hub_status_data =	xhci_hub_status_data,
-	.bus_suspend =		xhci_bus_suspend,
-	.bus_resume =		xhci_bus_resume,
-	/*
-	 * call back when device connected and addressed
-	 */
-	.update_device =        xhci_update_device,
-	.set_usb2_hw_lpm =	xhci_set_usb2_hardware_lpm,
-	.enable_usb3_lpm_timeout =	xhci_enable_usb3_lpm_timeout,
-	.disable_usb3_lpm_timeout =	xhci_disable_usb3_lpm_timeout,
-	.find_raw_port_number =	xhci_find_raw_port_number,
-};
-
 /*-------------------------------------------------------------------------*/
 
 /* PCI driver selection metadata; PCI hotplugging uses this */
@@ -408,6 +348,11 @@ static struct pci_driver xhci_pci_driver = {
 
 int __init xhci_register_pci(void)
 {
+	xhci_init_driver(&xhci_pci_hc_driver, xhci_pci_setup);
+#ifdef CONFIG_PM
+	xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
+	xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
+#endif
 	return pci_register_driver(&xhci_pci_driver);
 }
 
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 1a0cf9f..f352368 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -23,6 +23,8 @@
 #include "xhci-mvebu.h"
 #include "xhci-rcar.h"
 
+static struct hc_driver __read_mostly xhci_plat_hc_driver;
+
 static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
 {
 	/*
@@ -60,59 +62,6 @@ static int xhci_plat_start(struct usb_hcd *hcd)
 	return xhci_run(hcd);
 }
 
-static const struct hc_driver xhci_plat_xhci_driver = {
-	.description =		"xhci-hcd",
-	.product_desc =		"xHCI Host Controller",
-	.hcd_priv_size =	sizeof(struct xhci_hcd *),
-
-	/*
-	 * generic hardware linkage
-	 */
-	.irq =			xhci_irq,
-	.flags =		HCD_MEMORY | HCD_USB3 | HCD_SHARED,
-
-	/*
-	 * basic lifecycle operations
-	 */
-	.reset =		xhci_plat_setup,
-	.start =		xhci_plat_start,
-	.stop =			xhci_stop,
-	.shutdown =		xhci_shutdown,
-
-	/*
-	 * managing i/o requests and associated device resources
-	 */
-	.urb_enqueue =		xhci_urb_enqueue,
-	.urb_dequeue =		xhci_urb_dequeue,
-	.alloc_dev =		xhci_alloc_dev,
-	.free_dev =		xhci_free_dev,
-	.alloc_streams =	xhci_alloc_streams,
-	.free_streams =		xhci_free_streams,
-	.add_endpoint =		xhci_add_endpoint,
-	.drop_endpoint =	xhci_drop_endpoint,
-	.endpoint_reset =	xhci_endpoint_reset,
-	.check_bandwidth =	xhci_check_bandwidth,
-	.reset_bandwidth =	xhci_reset_bandwidth,
-	.address_device =	xhci_address_device,
-	.enable_device =	xhci_enable_device,
-	.update_hub_device =	xhci_update_hub_device,
-	.reset_device =		xhci_discover_or_reset_device,
-
-	/*
-	 * scheduling support
-	 */
-	.get_frame_number =	xhci_get_frame,
-
-	/* Root hub support */
-	.hub_control =		xhci_hub_control,
-	.hub_status_data =	xhci_hub_status_data,
-	.bus_suspend =		xhci_bus_suspend,
-	.bus_resume =		xhci_bus_resume,
-
-	.enable_usb3_lpm_timeout =	xhci_enable_usb3_lpm_timeout,
-	.disable_usb3_lpm_timeout =	xhci_disable_usb3_lpm_timeout,
-};
-
 static int xhci_plat_probe(struct platform_device *pdev)
 {
 	struct device_node	*node = pdev->dev.of_node;
@@ -128,7 +77,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	if (usb_disabled())
 		return -ENODEV;
 
-	driver = &xhci_plat_xhci_driver;
+	driver = &xhci_plat_hc_driver;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -300,6 +249,8 @@ MODULE_ALIAS("platform:xhci-hcd");
 
 int xhci_register_plat(void)
 {
+	xhci_init_driver(&xhci_plat_hc_driver, xhci_plat_setup);
+	xhci_plat_hc_driver.start = xhci_plat_start;
 	return platform_driver_register(&usb_xhci_driver);
 }
 
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b6f2117..f94530a 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4893,6 +4893,75 @@ error:
 	return retval;
 }
 
+static const struct hc_driver xhci_hc_driver = {
+	.description =		"xhci-hcd",
+	.product_desc =		"xHCI Host Controller",
+	.hcd_priv_size =	sizeof(struct xhci_hcd *),
+
+	/*
+	 * generic hardware linkage
+	 */
+	.irq =			xhci_irq,
+	.flags =		HCD_MEMORY | HCD_USB3 | HCD_SHARED,
+
+	/*
+	 * basic lifecycle operations
+	 */
+	.reset =		NULL, /* set in xhci_init_driver() */
+	.start =		xhci_run,
+	.stop =			xhci_stop,
+	.shutdown =		xhci_shutdown,
+
+	/*
+	 * managing i/o requests and associated device resources
+	 */
+	.urb_enqueue =		xhci_urb_enqueue,
+	.urb_dequeue =		xhci_urb_dequeue,
+	.alloc_dev =		xhci_alloc_dev,
+	.free_dev =		xhci_free_dev,
+	.alloc_streams =	xhci_alloc_streams,
+	.free_streams =		xhci_free_streams,
+	.add_endpoint =		xhci_add_endpoint,
+	.drop_endpoint =	xhci_drop_endpoint,
+	.endpoint_reset =	xhci_endpoint_reset,
+	.check_bandwidth =	xhci_check_bandwidth,
+	.reset_bandwidth =	xhci_reset_bandwidth,
+	.address_device =	xhci_address_device,
+	.enable_device =	xhci_enable_device,
+	.update_hub_device =	xhci_update_hub_device,
+	.reset_device =		xhci_discover_or_reset_device,
+
+	/*
+	 * scheduling support
+	 */
+	.get_frame_number =	xhci_get_frame,
+
+	/*
+	 * root hub support
+	 */
+	.hub_control =		xhci_hub_control,
+	.hub_status_data =	xhci_hub_status_data,
+	.bus_suspend =		xhci_bus_suspend,
+	.bus_resume =		xhci_bus_resume,
+
+	/*
+	 * call back when device connected and addressed
+	 */
+	.update_device =        xhci_update_device,
+	.set_usb2_hw_lpm =	xhci_set_usb2_hardware_lpm,
+	.enable_usb3_lpm_timeout =	xhci_enable_usb3_lpm_timeout,
+	.disable_usb3_lpm_timeout =	xhci_disable_usb3_lpm_timeout,
+	.find_raw_port_number =	xhci_find_raw_port_number,
+};
+
+void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *))
+{
+	BUG_ON(!setup_fn);
+	*drv = xhci_hc_driver;
+	drv->reset = setup_fn;
+}
+EXPORT_SYMBOL_GPL(xhci_init_driver);
+
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index dace515..194dbd3 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1762,6 +1762,7 @@ int xhci_run(struct usb_hcd *hcd);
 void xhci_stop(struct usb_hcd *hcd);
 void xhci_shutdown(struct usb_hcd *hcd);
 int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks);
+void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *));
 
 #ifdef	CONFIG_PM
 int xhci_suspend(struct xhci_hcd *xhci);
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/4] xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold
       [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-08-19 17:01   ` Andrew Bresticker
  2014-08-19 17:01   ` [PATCH v3 3/4] xhci: Export symbols used by host-controller drivers Andrew Bresticker
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Andrew Bresticker @ 2014-08-19 17:01 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Andrew Bresticker

Instead of calling xhci_compliance_mode_recovery_timer_quirk_check() again
in the PCI suspend path, just check for XHCI_COMP_MODE_QUIRK which will
have been set based on xhci_compliance_mode_recovery_timer_quirk_check()
in xhci_init().

Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
No change from v1/v2.
---
 drivers/usb/host/xhci-pci.c | 2 +-
 drivers/usb/host/xhci.c     | 2 +-
 drivers/usb/host/xhci.h     | 3 ---
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 88d4553..8093ad6 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -279,7 +279,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	 * Systems with the TI redriver that loses port status change events
 	 * need to have the registers polled during D3, so avoid D3cold.
 	 */
-	if (xhci_compliance_mode_recovery_timer_quirk_check())
+	if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
 		pdev->no_d3cold = true;
 
 	return xhci_suspend(xhci);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index f94530a..a5cd831 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -491,7 +491,7 @@ static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci)
  * Systems:
  * Vendor: Hewlett-Packard -> System Models: Z420, Z620 and Z820
  */
-bool xhci_compliance_mode_recovery_timer_quirk_check(void)
+static bool xhci_compliance_mode_recovery_timer_quirk_check(void)
 {
 	const char *dmi_product_name, *dmi_sys_vendor;
 
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 194dbd3..71400b3 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1888,7 +1888,4 @@ struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci,
 struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx);
 struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index);
 
-/* xHCI quirks */
-bool xhci_compliance_mode_recovery_timer_quirk_check(void);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 3/4] xhci: Export symbols used by host-controller drivers
       [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2014-08-19 17:01   ` [PATCH v3 2/4] xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold Andrew Bresticker
@ 2014-08-19 17:01   ` Andrew Bresticker
  2014-08-19 17:01   ` [PATCH v3 4/4] xhci: Allow xHCI drivers to be built as separate modules Andrew Bresticker
  2014-09-03 19:51   ` [PATCH v3 0/4] " Andrew Bresticker
  3 siblings, 0 replies; 9+ messages in thread
From: Andrew Bresticker @ 2014-08-19 17:01 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Andrew Bresticker

In preparation for allowing the xHCI host controller drivers to be built
as separate modules, export symbols from the xHCI core that may be used
by the host controller drivers.

Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes from v2:
 - exported xhci_dbg_quirks tracepoint
Changes from v1:
 - exported xhci_run()
---
 drivers/usb/host/xhci-dbg.c   | 1 +
 drivers/usb/host/xhci-trace.c | 2 ++
 drivers/usb/host/xhci.c       | 4 ++++
 3 files changed, 7 insertions(+)

diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index eb009a4..bb89175 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -594,3 +594,4 @@ void xhci_dbg_trace(struct xhci_hcd *xhci, void (*trace)(struct va_format *),
 	trace(&vaf);
 	va_end(args);
 }
+EXPORT_SYMBOL_GPL(xhci_dbg_trace);
diff --git a/drivers/usb/host/xhci-trace.c b/drivers/usb/host/xhci-trace.c
index 7cf30c8..367b630 100644
--- a/drivers/usb/host/xhci-trace.c
+++ b/drivers/usb/host/xhci-trace.c
@@ -13,3 +13,5 @@
 
 #define CREATE_TRACE_POINTS
 #include "xhci-trace.h"
+
+EXPORT_TRACEPOINT_SYMBOL_GPL(xhci_dbg_quirks);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index a5cd831..edfc96f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -653,6 +653,7 @@ int xhci_run(struct usb_hcd *hcd)
 			"Finished xhci_run for USB2 roothub");
 	return 0;
 }
+EXPORT_SYMBOL_GPL(xhci_run);
 
 static void xhci_only_stop_hcd(struct usb_hcd *hcd)
 {
@@ -927,6 +928,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
 
 	return rc;
 }
+EXPORT_SYMBOL_GPL(xhci_suspend);
 
 /*
  * start xHC (not bus-specific)
@@ -1078,6 +1080,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 
 	return retval;
 }
+EXPORT_SYMBOL_GPL(xhci_resume);
 #endif	/* CONFIG_PM */
 
 /*-------------------------------------------------------------------------*/
@@ -4892,6 +4895,7 @@ error:
 	kfree(xhci);
 	return retval;
 }
+EXPORT_SYMBOL_GPL(xhci_gen_setup);
 
 static const struct hc_driver xhci_hc_driver = {
 	.description =		"xhci-hcd",
-- 
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 4/4] xhci: Allow xHCI drivers to be built as separate modules
       [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2014-08-19 17:01   ` [PATCH v3 2/4] xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold Andrew Bresticker
  2014-08-19 17:01   ` [PATCH v3 3/4] xhci: Export symbols used by host-controller drivers Andrew Bresticker
@ 2014-08-19 17:01   ` Andrew Bresticker
  2014-09-03 19:51   ` [PATCH v3 0/4] " Andrew Bresticker
  3 siblings, 0 replies; 9+ messages in thread
From: Andrew Bresticker @ 2014-08-19 17:01 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Andrew Bresticker

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: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
No change from v2.
Changes from v1:
 - rebased on changes introduced by xhci-rcar driver
---
 drivers/usb/host/Kconfig     |  5 +++++
 drivers/usb/host/Makefile    | 12 ++++++------
 drivers/usb/host/xhci-pci.c  |  9 +++++++--
 drivers/usb/host/xhci-plat.c |  9 +++++++--
 drivers/usb/host/xhci.c      | 22 ----------------------
 drivers/usb/host/xhci.h      | 19 -------------------
 6 files changed, 25 insertions(+), 51 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 82800a7..f5a5831 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -26,6 +26,11 @@ config USB_XHCI_HCD
 
 if USB_XHCI_HCD
 
+config USB_XHCI_PCI
+       tristate
+       depends on PCI
+       default y
+
 config USB_XHCI_PLATFORM
 	tristate
 
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 144c038..702d9b7 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -15,22 +15,22 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.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-trace.o
-xhci-hcd-$(CONFIG_PCI)	+= xhci-pci.o
 
-ifneq ($(CONFIG_USB_XHCI_PLATFORM), )
-	xhci-hcd-y		+= xhci-plat.o
+xhci-plat-hcd-y := xhci-plat.o
 ifneq ($(CONFIG_USB_XHCI_MVEBU), )
-	xhci-hcd-y		+= xhci-mvebu.o
+	xhci-plat-hcd-y		+= xhci-mvebu.o
 endif
 ifneq ($(CONFIG_USB_XHCI_RCAR), )
-	xhci-hcd-y		+= xhci-rcar.o
-endif
+	xhci-plat-hcd-y		+= xhci-rcar.o
 endif
 
 obj-$(CONFIG_USB_WHCI_HCD)	+= whci/
 
 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_PCI)	+= ehci-pci.o
 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)	+= ehci-platform.o
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 8093ad6..f97d27c 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -346,7 +346,7 @@ static struct pci_driver xhci_pci_driver = {
 #endif
 };
 
-int __init xhci_register_pci(void)
+static int __init xhci_pci_init(void)
 {
 	xhci_init_driver(&xhci_pci_hc_driver, xhci_pci_setup);
 #ifdef CONFIG_PM
@@ -355,8 +355,13 @@ int __init xhci_register_pci(void)
 #endif
 	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);
 }
+module_exit(xhci_pci_exit);
+
+MODULE_DESCRIPTION("xHCI PCI Host Controller Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index f352368..3d78b0c 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -247,14 +247,19 @@ static struct platform_driver usb_xhci_driver = {
 };
 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_plat_hc_driver.start = xhci_plat_start;
 	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);
 }
+module_exit(xhci_plat_exit);
+
+MODULE_DESCRIPTION("xHCI Platform Host Controller Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index edfc96f..a29cd7d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4972,18 +4972,6 @@ MODULE_LICENSE("GPL");
 
 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
 	 * out in specific ways for hardware access.
@@ -5002,15 +4990,5 @@ static int __init xhci_hcd_init(void)
 	/* 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);
 	return 0;
-unreg_pci:
-	xhci_unregister_pci();
-	return retval;
 }
 module_init(xhci_hcd_init);
-
-static void __exit xhci_hcd_cleanup(void)
-{
-	xhci_unregister_pci();
-	xhci_unregister_plat();
-}
-module_exit(xhci_hcd_cleanup);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 71400b3..d9c9e0a 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1731,25 +1731,6 @@ void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv);
 void xhci_free_command(struct xhci_hcd *xhci,
 		struct xhci_command *command);
 
-#ifdef CONFIG_PCI
-/* xHCI PCI glue */
-int xhci_register_pci(void);
-void xhci_unregister_pci(void);
-#else
-static inline int xhci_register_pci(void) { return 0; }
-static inline void xhci_unregister_pci(void) {}
-#endif
-
-#if IS_ENABLED(CONFIG_USB_XHCI_PLATFORM)
-int xhci_register_plat(void);
-void xhci_unregister_plat(void);
-#else
-static inline int xhci_register_plat(void)
-{ return 0; }
-static inline void xhci_unregister_plat(void)
-{  }
-#endif

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules
       [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
                     ` (2 preceding siblings ...)
  2014-08-19 17:01   ` [PATCH v3 4/4] xhci: Allow xHCI drivers to be built as separate modules Andrew Bresticker
@ 2014-09-03 19:51   ` Andrew Bresticker
  2014-09-09 14:27     ` Mathias Nyman
  3 siblings, 1 reply; 9+ messages in thread
From: Andrew Bresticker @ 2014-09-03 19:51 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrew Bresticker, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Mathias,

On Tue, Aug 19, 2014 at 10:01 AM, Andrew Bresticker
<abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote:
> It was suggested in the review of the Tegra xHCI driver [1] that we
> allow xHCI drivers to be built as individual modules (like EHCI) instead
> of building them all into the single xhci-hcd module as they are today.
>
> Patches 1-3 prepare for making the xHCI PCI and platform drivers able
> to be built as individual modules and patch 4 actually creates the 3
> separate modules (core, platform, PCI).
>
> Based on 3.17-rc1.
>
> Changes from v2:
>  - fixed typo in xhci_register_plat
>  - exported another symbol needed by xhci-pci module
> Changes from v1:
>  - rebased on changes introduced by xhci-rcar driver
>
> [1] http://patchwork.ozlabs.org/patch/361265/
>
> Andrew Bresticker (4):
>   xhci: Introduce xhci_init_driver()
>   xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold
>   xhci: Export symbols used by host-controller drivers
>   xhci: Allow xHCI drivers to be built as separate modules

Any thoughts/comments on this series?

Thanks,
Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules
  2014-09-03 19:51   ` [PATCH v3 0/4] " Andrew Bresticker
@ 2014-09-09 14:27     ` Mathias Nyman
  2014-10-02 16:31       ` Mathias Nyman
  0 siblings, 1 reply; 9+ messages in thread
From: Mathias Nyman @ 2014-09-09 14:27 UTC (permalink / raw)
  To: Andrew Bresticker, Mathias Nyman
  Cc: Alan Stern, Julius Werner, Gregory CLEMENT, Yoshihiro Shimoda,
	Stephen Warren, Thierry Reding, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org, Greg Kroah-Hartman,
	linux-usb@vger.kernel.org

On 09/03/2014 10:51 PM, Andrew Bresticker wrote:
> Mathias,
> 
> On Tue, Aug 19, 2014 at 10:01 AM, Andrew Bresticker
> <abrestic@chromium.org> wrote:
>> It was suggested in the review of the Tegra xHCI driver [1] that we
>> allow xHCI drivers to be built as individual modules (like EHCI) instead
>> of building them all into the single xhci-hcd module as they are today.
>>
>> Patches 1-3 prepare for making the xHCI PCI and platform drivers able
>> to be built as individual modules and patch 4 actually creates the 3
>> separate modules (core, platform, PCI).
>>
>> Based on 3.17-rc1.
>>
>> Changes from v2:
>>  - fixed typo in xhci_register_plat
>>  - exported another symbol needed by xhci-pci module
>> Changes from v1:
>>  - rebased on changes introduced by xhci-rcar driver
>>
>> [1] http://patchwork.ozlabs.org/patch/361265/
>>
>> Andrew Bresticker (4):
>>   xhci: Introduce xhci_init_driver()
>>   xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold
>>   xhci: Export symbols used by host-controller drivers
>>   xhci: Allow xHCI drivers to be built as separate modules
> 
> Any thoughts/comments on this series?
> 
> 

Sorry about the delay.
When I start looking at this I always get interrupted by some fire that needs to be put out.

I still need some more time to go through it

-Mathias

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules
  2014-10-02 16:31       ` Mathias Nyman
@ 2014-10-02 16:23         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2014-10-02 16:23 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Andrew Bresticker, Mathias Nyman, Alan Stern, Julius Werner,
	Gregory CLEMENT, Yoshihiro Shimoda, Stephen Warren,
	Thierry Reding, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org

On Thu, Oct 02, 2014 at 07:31:03PM +0300, Mathias Nyman wrote:
> On 09/09/2014 05:27 PM, Mathias Nyman wrote:
> > On 09/03/2014 10:51 PM, Andrew Bresticker wrote:
> >> Mathias,
> >>
> >> On Tue, Aug 19, 2014 at 10:01 AM, Andrew Bresticker
> >> <abrestic@chromium.org> wrote:
> >>> It was suggested in the review of the Tegra xHCI driver [1] that we
> >>> allow xHCI drivers to be built as individual modules (like EHCI) instead
> >>> of building them all into the single xhci-hcd module as they are today.
> >>>
> >>> Patches 1-3 prepare for making the xHCI PCI and platform drivers able
> >>> to be built as individual modules and patch 4 actually creates the 3
> >>> separate modules (core, platform, PCI).
> >>>
> >>> Based on 3.17-rc1.
> >>>
> >>> Changes from v2:
> >>>  - fixed typo in xhci_register_plat
> >>>  - exported another symbol needed by xhci-pci module
> >>> Changes from v1:
> >>>  - rebased on changes introduced by xhci-rcar driver
> >>>
> >>> [1] http://patchwork.ozlabs.org/patch/361265/
> >>>
> >>> Andrew Bresticker (4):
> >>>   xhci: Introduce xhci_init_driver()
> >>>   xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold
> >>>   xhci: Export symbols used by host-controller drivers
> >>>   xhci: Allow xHCI drivers to be built as separate modules
> >>
> >> Any thoughts/comments on this series?
> >>
> >>
> > 
> > Sorry about the delay.
> > When I start looking at this I always get interrupted by some fire that needs to be put out.
> > 
> > I still need some more time to go through it
> > 
> > -Mathias
> > 
> > --
> >
> 
> Ok, finally found the time to look through it. Sorry about the long wait
> 
> The whole series look good, and its now more in line with how ehci does things (like using *hci_init_driver())
> 
> Series still apply nicely on usb-next.
> 
> Greg, any chance this still can get to your usb-next and to the 3.18 merge window?
> Tegra developers seem eager to get it in, and I feel bad for not reviewing it earlier. 

They aren't in my patch queue anymore, so please send them, with your
signed-off-by, and I will try to get them in.

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules
  2014-09-09 14:27     ` Mathias Nyman
@ 2014-10-02 16:31       ` Mathias Nyman
  2014-10-02 16:23         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Mathias Nyman @ 2014-10-02 16:31 UTC (permalink / raw)
  To: Andrew Bresticker, Greg Kroah-Hartman
  Cc: Mathias Nyman, Alan Stern, Julius Werner, Gregory CLEMENT,
	Yoshihiro Shimoda, Stephen Warren, Thierry Reding,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-usb@vger.kernel.org

On 09/09/2014 05:27 PM, Mathias Nyman wrote:
> On 09/03/2014 10:51 PM, Andrew Bresticker wrote:
>> Mathias,
>>
>> On Tue, Aug 19, 2014 at 10:01 AM, Andrew Bresticker
>> <abrestic@chromium.org> wrote:
>>> It was suggested in the review of the Tegra xHCI driver [1] that we
>>> allow xHCI drivers to be built as individual modules (like EHCI) instead
>>> of building them all into the single xhci-hcd module as they are today.
>>>
>>> Patches 1-3 prepare for making the xHCI PCI and platform drivers able
>>> to be built as individual modules and patch 4 actually creates the 3
>>> separate modules (core, platform, PCI).
>>>
>>> Based on 3.17-rc1.
>>>
>>> Changes from v2:
>>>  - fixed typo in xhci_register_plat
>>>  - exported another symbol needed by xhci-pci module
>>> Changes from v1:
>>>  - rebased on changes introduced by xhci-rcar driver
>>>
>>> [1] http://patchwork.ozlabs.org/patch/361265/
>>>
>>> Andrew Bresticker (4):
>>>   xhci: Introduce xhci_init_driver()
>>>   xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold
>>>   xhci: Export symbols used by host-controller drivers
>>>   xhci: Allow xHCI drivers to be built as separate modules
>>
>> Any thoughts/comments on this series?
>>
>>
> 
> Sorry about the delay.
> When I start looking at this I always get interrupted by some fire that needs to be put out.
> 
> I still need some more time to go through it
> 
> -Mathias
> 
> --
>

Ok, finally found the time to look through it. Sorry about the long wait

The whole series look good, and its now more in line with how ehci does things (like using *hci_init_driver())

Series still apply nicely on usb-next.

Greg, any chance this still can get to your usb-next and to the 3.18 merge window?
Tegra developers seem eager to get it in, and I feel bad for not reviewing it earlier. 

-Mathias

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-02 16:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-19 17:01 [PATCH v3 0/4] Allow xHCI drivers to be built as separate modules Andrew Bresticker
2014-08-19 17:01 ` [PATCH v3 1/4] xhci: Introduce xhci_init_driver() Andrew Bresticker
     [not found] ` <1408467712-27497-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-08-19 17:01   ` [PATCH v3 2/4] xhci: Check for XHCI_COMP_MODE_QUIRK when disabling D3cold Andrew Bresticker
2014-08-19 17:01   ` [PATCH v3 3/4] xhci: Export symbols used by host-controller drivers Andrew Bresticker
2014-08-19 17:01   ` [PATCH v3 4/4] xhci: Allow xHCI drivers to be built as separate modules Andrew Bresticker
2014-09-03 19:51   ` [PATCH v3 0/4] " Andrew Bresticker
2014-09-09 14:27     ` Mathias Nyman
2014-10-02 16:31       ` Mathias Nyman
2014-10-02 16:23         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).