Re: [PATCH 4/9] usb-core: Free bulk streams on interface release

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

 



On Sun, 6 Oct 2013, Hans de Goede wrote:

> >> I was wondering about this myself when I wrote this. What do you suggest
> >> as an alternative, kmalloc an array with intf->cur_altsetting->desc.bNumEndpoints
> >> pointers ?
> >
> > Or simply do 30 pointers every time.  240 bytes isn't all that much for
> > kmalloc.
> 
> Right, the allocating intf->cur_altsetting->desc.bNumEndpoints versus 30
> pointers is just an optimization. I was wondering more if it would be
> ok here to do a kmalloc(..., GPF_KERNEL), or if this code path is
> ever called under interrupt, or some such ?

GFP_KERNEL will be okay.  This code always runs in process context with 
interrupts enabled.

> Also do we allow C-99 style variable length arrays in the kernel ?
> Then we could just put what ever we need on the stack (which almost always
> will be way less then 240 bytes).

I think people try to avoid variable-length arrays.  Certainly such 
arrays in structures are frowned upon.

Alan Stern

--
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