drivers/hid/intel-ish-hid/ishtp/hbm.c
Source file repositories/reference/linux-study-clean/drivers/hid/intel-ish-hid/ishtp/hbm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/intel-ish-hid/ishtp/hbm.c- Extension
.c- Size
- 27577 bytes
- Lines
- 1011
- Domain
- Driver Families
- Bucket
- drivers/hid
- 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.
- 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/export.hlinux/slab.hlinux/sched.hlinux/wait.hlinux/spinlock.hishtp-dev.hhbm.hclient.hloader.h
Detected Declarations
function Copyrightfunction ishtp_hbm_cl_hdrfunction ishtp_hbm_cl_addr_equalfunction ishtp_hbm_start_waitfunction ishtp_hbm_start_reqfunction ishtp_hbm_enum_clients_reqfunction ishtp_hbm_prop_reqfunction ishtp_hbm_stop_reqfunction ishtp_hbm_cl_flow_control_reqfunction ishtp_hbm_cl_disconnect_reqfunction ishtp_hbm_cl_disconnect_resfunction ishtp_hbm_cl_connect_reqfunction ishtp_hbm_cl_connect_resfunction ishtp_hbm_fw_disconnect_reqfunction ishtp_hbm_dma_xfer_ackfunction list_for_each_entryfunction ishtp_hbm_dma_xferfunction ishtp_hbm_dispatchfunction bh_hbm_work_fnfunction recv_hbmfunction list_for_each_entryfunction ishtp_loader_recv_msgfunction recv_fixed_cl_msgfunction fix_cl_hdrfunction ishtp_send_suspendfunction ishtp_send_resumefunction ishtp_query_subscribersexport ishtp_send_suspendexport ishtp_send_resume
Annotated Snippet
if (cl->ts_rx) {
ktime_t ts_diff = ktime_sub(cl->ts_out_fc, cl->ts_rx);
if (ktime_after(ts_diff, cl->ts_max_fc_delay))
cl->ts_max_fc_delay = ts_diff;
}
} else {
++cl->err_send_fc;
}
spin_unlock_irqrestore(&cl->fc_spinlock, flags);
return rv;
}
/**
* ishtp_hbm_cl_disconnect_req() - Send disconnect request
* @dev: ISHTP device instance
* @cl: ISHTP client instance
*
* Send disconnect message to fw
*
* Return: 0 if success else error code
*/
int ishtp_hbm_cl_disconnect_req(struct ishtp_device *dev, struct ishtp_cl *cl)
{
struct ishtp_msg_hdr hdr;
struct hbm_client_connect_request disconn_req;
const size_t len = sizeof(disconn_req);
ishtp_hbm_hdr(&hdr, len);
ishtp_hbm_cl_hdr(cl, CLIENT_DISCONNECT_REQ_CMD, &disconn_req, len);
return ishtp_write_message(dev, &hdr, &disconn_req);
}
/**
* ishtp_hbm_cl_disconnect_res() - Get disconnect response
* @dev: ISHTP device instance
* @rs: Response message
*
* Received disconnect response from fw
*/
static void ishtp_hbm_cl_disconnect_res(struct ishtp_device *dev,
struct hbm_client_connect_response *rs)
{
struct ishtp_cl *cl = NULL;
unsigned long flags;
spin_lock_irqsave(&dev->cl_list_lock, flags);
list_for_each_entry(cl, &dev->cl_list, link) {
if (!rs->status && ishtp_hbm_cl_addr_equal(cl, rs)) {
cl->state = ISHTP_CL_DISCONNECTED;
wake_up_interruptible(&cl->wait_ctrl_res);
break;
}
}
spin_unlock_irqrestore(&dev->cl_list_lock, flags);
}
/**
* ishtp_hbm_cl_connect_req() - Send connect request
* @dev: ISHTP device instance
* @cl: client device instance
*
* Send connection request to specific fw client
*
* Return: 0 if success else error code
*/
int ishtp_hbm_cl_connect_req(struct ishtp_device *dev, struct ishtp_cl *cl)
{
struct ishtp_msg_hdr hdr;
struct hbm_client_connect_request conn_req;
const size_t len = sizeof(conn_req);
ishtp_hbm_hdr(&hdr, len);
ishtp_hbm_cl_hdr(cl, CLIENT_CONNECT_REQ_CMD, &conn_req, len);
return ishtp_write_message(dev, &hdr, &conn_req);
}
/**
* ishtp_hbm_cl_connect_res() - Get connect response
* @dev: ISHTP device instance
* @rs: Response message
*
* Received connect response from fw
*/
static void ishtp_hbm_cl_connect_res(struct ishtp_device *dev,
struct hbm_client_connect_response *rs)
{
struct ishtp_cl *cl = NULL;
Annotation
- Immediate include surface: `linux/export.h`, `linux/slab.h`, `linux/sched.h`, `linux/wait.h`, `linux/spinlock.h`, `ishtp-dev.h`, `hbm.h`, `client.h`.
- Detected declarations: `function Copyright`, `function ishtp_hbm_cl_hdr`, `function ishtp_hbm_cl_addr_equal`, `function ishtp_hbm_start_wait`, `function ishtp_hbm_start_req`, `function ishtp_hbm_enum_clients_req`, `function ishtp_hbm_prop_req`, `function ishtp_hbm_stop_req`, `function ishtp_hbm_cl_flow_control_req`, `function ishtp_hbm_cl_disconnect_req`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: integration 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.