USB: UDC: Implement udc_async_callbacks in dummy-hcd
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 20 May 2021 20:21:52 +0000 (16:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Jun 2021 11:52:02 +0000 (13:52 +0200)
commit04145a03db9d78469e0817ab3a767c76c0fb0947
treed4878810fc3f69be3c982af74c736e8fc431ad3b
parent7dc0c55e9f302e7048e040ee4437437bbea1e2cd
USB: UDC: Implement udc_async_callbacks in dummy-hcd

This patch adds a udc_async_callbacks handler to the dummy-hcd UDC
driver, which will prevent a theoretical race during gadget unbinding.

The implementation is simple, since dummy-hcd already has a flag to
keep track of whether emulated IRQs are enabled.  All the handler has
to do is store the enable value in the flag, and avoid setting the
flag prematurely.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20210520202152.GD1216852@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/dummy_hcd.c