drivers/usb/gadget/legacy/multi.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/legacy/multi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/legacy/multi.c- Extension
.c- Size
- 11390 bytes
- Lines
- 494
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/netdevice.hu_serial.hf_mass_storage.hu_ecm.hu_rndis.hrndis.hu_ether.h
Detected Declarations
function rndis_do_configfunction rndis_config_registerfunction rndis_config_registerfunction cdc_do_configfunction cdc_config_registerfunction cdc_config_registerfunction multi_bindfunction multi_unbind
Annotated Snippet
if (!usb_desc) {
status = -ENOMEM;
goto fail_string_ids;
}
usb_otg_descriptor_init(gadget, usb_desc);
otg_desc[0] = usb_desc;
otg_desc[1] = NULL;
}
/* register configurations */
status = rndis_config_register(cdev);
if (unlikely(status < 0))
goto fail_otg_desc;
status = cdc_config_register(cdev);
if (unlikely(status < 0))
goto fail_otg_desc;
usb_composite_overwrite_options(cdev, &coverwrite);
/* we're done */
dev_info(&gadget->dev, DRIVER_DESC "\n");
return 0;
/* error recovery */
fail_otg_desc:
kfree(otg_desc[0]);
otg_desc[0] = NULL;
fail_string_ids:
fsg_common_remove_luns(fsg_opts->common);
fail_set_cdev:
fsg_common_free_buffers(fsg_opts->common);
fail2:
usb_put_function_instance(fi_msg);
fail1:
usb_put_function_instance(fi_acm);
fail0:
#ifdef USB_ETH_RNDIS
usb_put_function_instance(fi_rndis);
fail:
#endif
#ifdef CONFIG_USB_G_MULTI_CDC
usb_put_function_instance(fi_ecm);
#endif
return status;
}
static int multi_unbind(struct usb_composite_dev *cdev)
{
#ifdef CONFIG_USB_G_MULTI_CDC
usb_put_function(f_msg_multi);
#endif
#ifdef USB_ETH_RNDIS
usb_put_function(f_msg_rndis);
#endif
usb_put_function_instance(fi_msg);
#ifdef CONFIG_USB_G_MULTI_CDC
usb_put_function(f_acm_multi);
#endif
#ifdef USB_ETH_RNDIS
usb_put_function(f_acm_rndis);
#endif
usb_put_function_instance(fi_acm);
#ifdef USB_ETH_RNDIS
usb_put_function(f_rndis);
usb_put_function_instance(fi_rndis);
#endif
#ifdef CONFIG_USB_G_MULTI_CDC
usb_put_function(f_ecm);
usb_put_function_instance(fi_ecm);
#endif
kfree(otg_desc[0]);
otg_desc[0] = NULL;
return 0;
}
/****************************** Some noise ******************************/
static struct usb_composite_driver multi_driver = {
.name = "g_multi",
.dev = &device_desc,
.strings = dev_strings,
.max_speed = USB_SPEED_SUPER,
.bind = multi_bind,
.unbind = multi_unbind,
.needs_serial = 1,
};
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/netdevice.h`, `u_serial.h`, `f_mass_storage.h`, `u_ecm.h`, `u_rndis.h`, `rndis.h`.
- Detected declarations: `function rndis_do_config`, `function rndis_config_register`, `function rndis_config_register`, `function cdc_do_config`, `function cdc_config_register`, `function cdc_config_register`, `function multi_bind`, `function multi_unbind`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.