Message ID | 1370287290-21579-4-git-send-email-swarren@wwwdotorg.org |
---|---|
State | Superseded, archived |
Headers | show |
On Mon, 3 Jun 2013, Stephen Warren wrote: > From: Manjunath Goudar <manjunath.goudar@linaro.org> > > Some EHCI HCD drivers may need to override additional fields in struct > hc_driver, such as map_urb_for_dma, unmap_urb_for_dma, hub_control. Add > fields to struct ehci_driver_overrides to allow them to do so. > > These new overrides will be used at least by the Tegra EHCI driver. This is not a good approach. ehci-tegra is the only driver that needs to muck around with these things, so they should not be part of a standardized override structure. Indeed, so strong is my feeling that platforms shouldn't have to do this sort of thing that I want to make it difficult, not easy. Instead of adding extra fields to ehci_driver_overrides, let's force ehci-tegra to manually insert its own values into the tegra_ehci_hc_driver structure. Then this patch won't be necessary at all. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 246e124..da1c224 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1211,6 +1211,12 @@ void ehci_init_driver(struct hc_driver *drv, drv->hcd_priv_size += over->extra_priv_size; if (over->reset) drv->reset = over->reset; + if (over->map_urb_for_dma) + drv->map_urb_for_dma = over->map_urb_for_dma; + if (over->unmap_urb_for_dma) + drv->unmap_urb_for_dma = over->unmap_urb_for_dma; + if (over->hub_control) + drv->hub_control = over->hub_control; } } EXPORT_SYMBOL_GPL(ehci_init_driver); diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 7c978b2..918008a 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -795,6 +795,12 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x) struct ehci_driver_overrides { size_t extra_priv_size; int (*reset)(struct usb_hcd *hcd); + int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb, + gfp_t mem_flags); + void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb); + int (*hub_control)(struct usb_hcd *hcd, + u16 typeReq, u16 wValue, u16 wIndex, + char *buf, u16 wLength); }; extern void ehci_init_driver(struct hc_driver *drv,