drivers/comedi/comedi_usb.c
Source file repositories/reference/linux-study-clean/drivers/comedi/comedi_usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/comedi_usb.c- Extension
.c- Size
- 4646 bytes
- Lines
- 140
- Domain
- Driver Families
- Bucket
- drivers/comedi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/comedi/comedi_usb.h
Detected Declarations
function Copyrightfunction comedi_to_usb_devfunction comedi_usb_auto_configfunction comedi_usb_auto_unconfigfunction comedi_usb_driver_registerfunction comedi_usb_driver_unregisterexport comedi_to_usb_interfaceexport comedi_to_usb_devexport comedi_usb_auto_configexport comedi_usb_auto_unconfigexport comedi_usb_driver_registerexport comedi_usb_driver_unregister
Annotated Snippet
* This function is called from the module_init() of USB COMEDI driver modules
* to register the COMEDI driver and the USB driver. Do not call it directly,
* use the module_comedi_usb_driver() helper macro instead.
*
* Return: %0 on success, or a negative error number on failure.
*/
int comedi_usb_driver_register(struct comedi_driver *comedi_driver,
struct usb_driver *usb_driver)
{
int ret;
ret = comedi_driver_register(comedi_driver);
if (ret < 0)
return ret;
ret = usb_register(usb_driver);
if (ret < 0) {
comedi_driver_unregister(comedi_driver);
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(comedi_usb_driver_register);
/**
* comedi_usb_driver_unregister() - Unregister a USB COMEDI driver
* @comedi_driver: COMEDI driver to be registered.
* @usb_driver: USB driver to be registered.
*
* This function is called from the module_exit() of USB COMEDI driver modules
* to unregister the USB driver and the COMEDI driver. Do not call it
* directly, use the module_comedi_usb_driver() helper macro instead.
*/
void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
struct usb_driver *usb_driver)
{
usb_deregister(usb_driver);
comedi_driver_unregister(comedi_driver);
}
EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
MODULE_AUTHOR("https://www.comedi.org");
MODULE_DESCRIPTION("Comedi USB interface module");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/module.h`, `linux/comedi/comedi_usb.h`.
- Detected declarations: `function Copyright`, `function comedi_to_usb_dev`, `function comedi_usb_auto_config`, `function comedi_usb_auto_unconfig`, `function comedi_usb_driver_register`, `function comedi_usb_driver_unregister`, `export comedi_to_usb_interface`, `export comedi_to_usb_dev`, `export comedi_usb_auto_config`, `export comedi_usb_auto_unconfig`.
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: integration 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.