Re: [PATCH 1/2] USB: Allow HCDs to specifiy their DMA alignment requirements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 31, 2010 at 07:27:29PM +0200, Martin Fuzzey wrote:
> Oliver Neukum wrote:
> > You are not handling the case of drivers mapping buffers
> > themselves. You need to export this attribute to the drivers.
> >
> >   
> This is true.
> 
> Actually I think it is possible for the driver to obtain the value
> (albeit in a rather roundabout way):
> given a struct usb_device *:
> 
>     bus_to_hcd(usb_device->bus)->driver->dma_align_shift
> 
> Granted that is very ugly. I'm also not sure if bus_to_hcd() is intended for
> driver use or just the usb core.

Just the core.

> The last pointer dereference could be avoided by adding the shift to
> struct usb_hcd.
> However that would mean either making a copy there (which I don't like
> much as it  violates the Dont Repeat Yourself principle) or using that
> instead of struct hc_driver
> 
> I prefer using struct  hc_driver since that allows a declarative style
> definition in the HCD.
> 
> Or were you thinking of another way entirely of exporting this to the
> drivers?

How about a simple function that returns the alignment if you need/want
it?

	int usb_device_align_shift(struct usb_device *);
It would just do pretty much what you say above, but not force
individual drivers to try to figure out the pointer chain themselves.

thanks,

greg k-h
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux