This introduces a new functions which directly calls usb_add_hcd_init() and passes the new one-time-init call backs Signed-off-by: Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx> --- drivers/usb/host/ehci-platform.c | 59 ++++++++++++++++++++++++++++++++++++-- drivers/usb/host/ehci.h | 3 ++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 696bf8b..f7c7f60 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -3,8 +3,49 @@ #include <linux/io.h> #include "ehci.h" -struct usb_hcd *ehci_hcd_plat_add(struct platform_device *pdev, - const struct hc_driver *hc_drv) +static const struct hc_driver ehci_plat_hc_driver = { + .description = "ehci_hcd", + .product_desc = "EHCI Host Controller", + .hcd_priv_size = sizeof(struct ehci_hcd), + /* + * generic hardware linkage + */ + .irq = ehci_irq, + .flags = HCD_USB2 | HCD_MEMORY, + /* + * basic lifecycle operations + */ + .start = ehci_run, + .stop = ehci_stop, + .shutdown = ehci_shutdown, + /* + * managing i/o requests and associated device resources + */ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + .endpoint_reset = ehci_endpoint_reset, + /* + * scheduling support + */ + .get_frame_number = ehci_get_frame, + /* + * root hub support + */ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, +#ifdef CONFIG_PM + .bus_suspend = ehci_bus_suspend, + .bus_resume = ehci_bus_resume, +#endif + .relinquish_port = ehci_relinquish_port, + .port_handed_over = ehci_port_handed_over, + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, +}; + +struct usb_hcd *ehci_hcd_plat_add_init(struct platform_device *pdev, + const struct hc_driver *hc_drv, hcd_ot_init ot_init, + void *ot_priv) { struct usb_hcd *hcd; struct resource *res; @@ -14,6 +55,12 @@ struct usb_hcd *ehci_hcd_plat_add(struct platform_device *pdev, if (usb_disabled()) return ERR_PTR(-ENODEV); + if (!hc_drv) { + if (!ot_init) + return ERR_PTR(-EINVAL); + hc_drv = &ehci_plat_hc_driver; + } + irq = platform_get_irq(pdev, 0); if (irq < 0) return ERR_PTR(irq); @@ -45,7 +92,7 @@ struct usb_hcd *ehci_hcd_plat_add(struct platform_device *pdev, goto err_iomap; } - ret = usb_add_hcd(hcd, irq, IRQF_SHARED); + ret = usb_add_hcd_init(hcd, irq, IRQF_SHARED, ot_init, ot_priv); if (ret) goto err_add_hcd; @@ -61,6 +108,12 @@ err_create_hcd: return ERR_PTR(ret); } +struct usb_hcd *ehci_hcd_plat_add(struct platform_device *pdev, + const struct hc_driver *hc_drv) +{ + return ehci_hcd_plat_add_init(pdev, hc_drv, NULL, NULL); +} + void ehci_hcd_plat_cleanup(struct platform_device *pdev, struct usb_hcd *hcd) { usb_remove_hcd(hcd); diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 50cc09d..4bb0ef8c 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -789,6 +789,9 @@ void ehci_work(struct ehci_hcd *ehci); int ehci_lpm_set_da(struct ehci_hcd *ehci, int dev_addr, int port_num); int ehci_lpm_check(struct ehci_hcd *ehci, int port); +struct usb_hcd *ehci_hcd_plat_add_init(struct platform_device *pdev, + const struct hc_driver *hc_drv, hcd_ot_init ot_init, + void *ot_priv); struct usb_hcd *ehci_hcd_plat_add(struct platform_device *pdev, const struct hc_driver *hc_drv); void ehci_hcd_plat_cleanup(struct platform_device *pdev, struct usb_hcd *hcd); -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html