drivers/misc/mei/bus.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/bus.c- Extension
.c- Size
- 36373 bytes
- Lines
- 1624
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/device.hlinux/kernel.hlinux/sched/signal.hlinux/init.hlinux/errno.hlinux/slab.hlinux/mutex.hlinux/interrupt.hlinux/scatterlist.hlinux/mei_cl_bus.hmei_dev.hclient.h
Detected Declarations
function Copyrightfunction __mei_cl_send_timeoutfunction __mei_cl_recvfunction mei_cldev_send_vtagfunction mei_cldev_send_vtag_timeoutfunction mei_cldev_recv_vtagfunction mei_cldev_recv_timeoutfunction mei_cldev_recv_vtag_timeoutfunction mei_cldev_sendfunction mei_cldev_send_timeoutfunction mei_cldev_recvfunction mei_cl_bus_rx_workfunction mei_cl_bus_notif_workfunction mei_cl_bus_notify_eventfunction mei_cl_bus_rx_eventfunction mei_cldev_register_rx_cbfunction mei_cldev_register_notif_cbfunction mei_cldev_set_drvdatafunction mei_cldev_verfunction mei_cldev_mtufunction mei_cldev_enabledfunction mei_cl_bus_module_getfunction mei_cl_bus_module_putfunction mei_cl_bus_vtag_allocfunction mei_cl_bus_vtag_freefunction mei_cldev_dma_unmapfunction mei_cldev_enablefunction mei_cldev_unregister_callbacksfunction mei_cldev_disablefunction mei_cldev_send_gsc_commandfunction mei_cl_device_matchfunction mei_cl_device_probefunction mei_cl_device_removefunction name_showfunction uuid_showfunction version_showfunction modalias_showfunction max_conn_showfunction fixed_showfunction vtag_showfunction max_len_showfunction mei_cl_device_ueventfunction mei_dev_bus_putfunction mei_cl_bus_dev_releasefunction mei_cl_bus_set_namefunction mei_cl_bus_dev_setupfunction mei_cl_bus_dev_addfunction mei_cl_bus_dev_stop
Annotated Snippet
static int mei_cl_device_match(struct device *dev, const struct device_driver *drv)
{
const struct mei_cl_device *cldev = to_mei_cl_device(dev);
const struct mei_cl_driver *cldrv = to_mei_cl_driver(drv);
const struct mei_cl_device_id *found_id;
if (!cldev->do_match)
return 0;
if (!cldrv || !cldrv->id_table)
return 0;
found_id = mei_cl_device_find(cldev, cldrv);
if (found_id)
return 1;
return 0;
}
/**
* mei_cl_device_probe - bus probe function
*
* @dev: device
*
* Return: 0 on success; < 0 otherwise
*/
static int mei_cl_device_probe(struct device *dev)
{
struct mei_cl_device *cldev;
struct mei_cl_driver *cldrv;
const struct mei_cl_device_id *id;
int ret;
cldev = to_mei_cl_device(dev);
cldrv = to_mei_cl_driver(dev->driver);
if (!cldrv || !cldrv->probe)
return -ENODEV;
id = mei_cl_device_find(cldev, cldrv);
if (!id)
return -ENODEV;
if (!mei_cl_bus_module_get(cldev)) {
dev_err(&cldev->dev, "get hw module failed");
return -ENODEV;
}
ret = cldrv->probe(cldev, id);
if (ret) {
mei_cl_bus_module_put(cldev);
return ret;
}
__module_get(THIS_MODULE);
return 0;
}
/**
* mei_cl_device_remove - remove device from the bus
*
* @dev: device
*
* Return: 0 on success; < 0 otherwise
*/
static void mei_cl_device_remove(struct device *dev)
{
struct mei_cl_device *cldev = to_mei_cl_device(dev);
struct mei_cl_driver *cldrv = to_mei_cl_driver(dev->driver);
if (cldrv->remove)
cldrv->remove(cldev);
mei_cldev_unregister_callbacks(cldev);
mei_cl_bus_module_put(cldev);
module_put(THIS_MODULE);
}
static ssize_t name_show(struct device *dev, struct device_attribute *a,
char *buf)
{
struct mei_cl_device *cldev = to_mei_cl_device(dev);
return sysfs_emit(buf, "%s", cldev->name);
}
static DEVICE_ATTR_RO(name);
static ssize_t uuid_show(struct device *dev, struct device_attribute *a,
char *buf)
Annotation
- Immediate include surface: `linux/module.h`, `linux/device.h`, `linux/kernel.h`, `linux/sched/signal.h`, `linux/init.h`, `linux/errno.h`, `linux/slab.h`, `linux/mutex.h`.
- Detected declarations: `function Copyright`, `function __mei_cl_send_timeout`, `function __mei_cl_recv`, `function mei_cldev_send_vtag`, `function mei_cldev_send_vtag_timeout`, `function mei_cldev_recv_vtag`, `function mei_cldev_recv_timeout`, `function mei_cldev_recv_vtag_timeout`, `function mei_cldev_send`, `function mei_cldev_send_timeout`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.