• Alan Stern's avatar
    USB: gadget: Add a new bus for gadgets · fc274c1e
    Alan Stern authored
    This patch adds a "gadget" bus and uses it for registering gadgets and
    their drivers.  From now on, bindings will be managed by the driver
    core rather than through ad-hoc manipulations in the UDC core.
    
    As part of this change, the driver_pending_list is removed.  The UDC
    core won't need to keep track of unbound drivers for later binding,
    because the driver core handles all of that for us.
    
    However, we do need one new feature: a way to prevent gadget drivers
    from being bound to more than one gadget at a time.  The existing code
    does this automatically, but the driver core doesn't -- it's perfectly
    happy to bind a single driver to all the matching devices on the bus.
    The patch adds a new bitflag to the usb_gadget_driver structure for
    this purpose.
    
    A nice side effect of this change is a reduction in the total lines of
    code, since now the driver core will do part of the work that the UDC
    used to do.
    
    A possible future patch could add udc devices to the gadget bus, say
    as a separate device type.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/YmSpdxaDNeC2BBOf@rowland.harvard.eduSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    fc274c1e
core.c 48.4 KB