On Thu, 31 Jul 2003, Bertin Philippe wrote:

> 'Llo All,
> 
> I have a (kernel reader newbie) question :
> In kernel version's 2.4.20's usb.c, function usb_get_configuration(), one
> sees buffer be kmalloc'ed. Is there a reason why not to just have it
> declared on the stack (as a char[8]) ? Maybe hardware alignment ? If that
> last is not the case, then this kmalloc looks overkill, doesn't it ? Or is
> there another good reason ?
> Thanks,

There is another good reason.  Since buffer is used for I/O, it needs to
be addressable via DMA.  On some architectures, stack-based and statically
allocated memory cannot be used for DMA.  Only dynamically allocated
memory is suitable.

Alan Stern



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to