Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev

Alan Stern
2016-04-27T17:59:17Z

On Wed, 27 Apr 2016, Arnd Bergmann wrote:

> I've looked at the usb HCD code now and see this:
>
> struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
> struct device *dev, const char *bus_name,
> struct usb_hcd *primary_hcd)
> {
> ...
> hcd->self.controller = dev;
> hcd->self.uses_dma = (dev->dma_mask != NULL);
> ...
> }
>
> What I think we need to do here is ensure that the device that gets
> passed here and assigned to hcd->self.controller is the actual DMA
> master device, i.e. the pci_device or platform_device that was created
> from outside of the xhci stack. This is after all the pointer that
> gets passed into all the dma_map_*/dma_sync_*/dma_alloc_*/...
> functions.

It would be better to add a new field, since self.controller is also
used for lots of other purposes. Something like hcd->self.dma_dev.

Alan Stern