Re: hardware driver <-> gadget driver interaction

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

 



On Fri, 20 Jan 2012, Alan Stern wrote:

> This is a serious problem.  The gadget API does not specify whether
> usb_ep_enable and usb_ep_disable should be able to run in interrupt
> context.  Consequently we end up with UDC drivers like your DWC thing
> in which the routines cannot run in interrupt context, together with
> gadget drivers like g_serial which do call them in interrupt context.
>
> It may be that the best solution is for the composite.c driver to 
> implement Set-Config and Set-Interface requests in a workqueue, so that 
> the calls could be made in process context.  For now, you can avoid the 
> problem by not calling dma_alloc_coherent in your endpoint-setup 
> routine.
>
> g_file_storage doesn't have this problem because it uses its own kernel
> thread for handling these requests.

Actually, dma_alloc_coherent() takes a gfp_t parameter, so you should be
able to set GFP_ATOMIC and do the allocation from interrupt context.

The problem comes from dma_free_coherent(). It unconditionally checks for
being called in process context, and gives a warning if not. This check was
added a year or two ago, for something in the ARM architecture IIRC. I keep
expecting that this will get fixed at some point, but so far it hasn't.

-- 
Paul

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