drivers/hid/intel-ish-hid/ishtp/bus.c
Source file repositories/reference/linux-study-clean/drivers/hid/intel-ish-hid/ishtp/bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/intel-ish-hid/ishtp/bus.c- Extension
.c- Size
- 24775 bytes
- Lines
- 958
- Domain
- Driver Families
- Bucket
- drivers/hid
- 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.
- 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/init.hlinux/kernel.hlinux/device.hlinux/sched.hlinux/slab.hbus.hishtp-dev.hclient.hhbm.h
Detected Declarations
function ishtp_recvfunction ishtp_send_msgfunction ishtp_write_messagefunction ishtp_fw_cl_by_uuidfunction ishtp_fw_cl_get_clientfunction ishtp_get_fw_client_idfunction ishtp_fw_cl_by_idfunction ishtp_cl_device_probefunction ishtp_cl_bus_matchfunction ishtp_cl_device_removefunction ishtp_cl_device_suspendfunction ishtp_cl_device_resumefunction ishtp_cl_device_resetfunction modalias_showfunction ishtp_cl_ueventfunction ishtp_cl_dev_releasefunction ishtp_bus_add_devicefunction ishtp_bus_remove_devicefunction ishtp_cl_driver_registerfunction ishtp_cl_driver_unregisterfunction ishtp_bus_event_workfunction ishtp_cl_bus_rx_eventfunction ishtp_register_event_cbfunction ishtp_get_devicefunction ishtp_put_devicefunction ishtp_set_drvdatafunction ishtp_get_drvdatafunction ishtp_dev_to_cl_devicefunction ishtp_bus_new_clientfunction ishtp_cl_device_bindfunction ishtp_bus_remove_all_clientsfunction ishtp_reset_handlerfunction ishtp_reset_compl_handlerfunction ishtp_use_dma_transferfunction ishtp_devicefunction ishtp_wait_resumefunction ishtp_get_pci_devicefunction pointerfunction ishtp_trace_callbackfunction ish_hw_resetfunction ishtp_bus_registerfunction ishtp_bus_unregistermodule init ishtp_bus_registerexport ishtp_recvexport ishtp_fw_cl_by_uuidexport ishtp_fw_cl_get_clientexport ishtp_get_fw_client_idexport ishtp_cl_driver_register
Annotated Snippet
static int ishtp_cl_bus_match(struct device *dev, const struct device_driver *drv)
{
struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv);
struct ishtp_fw_client *client = device->fw_client;
const struct ishtp_device_id *id;
if (client) {
for (id = driver->id; !guid_is_null(&id->guid); id++) {
if (guid_equal(&id->guid, &client->props.protocol_name))
return 1;
}
}
return 0;
}
/**
* ishtp_cl_device_remove() - Bus remove() callback
* @dev: the device structure
*
* This is a bus remove callback and calls the drive remove function.
* Since the ISH driver model supports only built in, this is
* primarily can be called during pci driver init failure.
*
* Return: Return value from driver remove() call.
*/
static void ishtp_cl_device_remove(struct device *dev)
{
struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
struct ishtp_cl_driver *driver = to_ishtp_cl_driver(dev->driver);
if (device->event_cb) {
device->event_cb = NULL;
cancel_work_sync(&device->event_work);
}
if (driver->remove)
driver->remove(device);
}
/**
* ishtp_cl_device_suspend() - Bus suspend callback
* @dev: device
*
* Called during device suspend process.
*
* Return: Return value from driver suspend() call.
*/
static int ishtp_cl_device_suspend(struct device *dev)
{
struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
struct ishtp_cl_driver *driver;
int ret = 0;
if (!device)
return 0;
driver = to_ishtp_cl_driver(dev->driver);
if (driver && driver->driver.pm) {
if (driver->driver.pm->suspend)
ret = driver->driver.pm->suspend(dev);
}
return ret;
}
/**
* ishtp_cl_device_resume() - Bus resume callback
* @dev: device
*
* Called during device resume process.
*
* Return: Return value from driver resume() call.
*/
static int ishtp_cl_device_resume(struct device *dev)
{
struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
struct ishtp_cl_driver *driver;
int ret = 0;
if (!device)
return 0;
driver = to_ishtp_cl_driver(dev->driver);
if (driver && driver->driver.pm) {
if (driver->driver.pm->resume)
ret = driver->driver.pm->resume(dev);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/device.h`, `linux/sched.h`, `linux/slab.h`, `bus.h`, `ishtp-dev.h`.
- Detected declarations: `function ishtp_recv`, `function ishtp_send_msg`, `function ishtp_write_message`, `function ishtp_fw_cl_by_uuid`, `function ishtp_fw_cl_get_client`, `function ishtp_get_fw_client_id`, `function ishtp_fw_cl_by_id`, `function ishtp_cl_device_probe`, `function ishtp_cl_bus_match`, `function ishtp_cl_device_remove`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.