drivers/hid/intel-ish-hid/ishtp/client.c
Source file repositories/reference/linux-study-clean/drivers/hid/intel-ish-hid/ishtp/client.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/intel-ish-hid/ishtp/client.c- Extension
.c- Size
- 33338 bytes
- Lines
- 1275
- 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.
- 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/slab.hlinux/sched.hlinux/wait.hlinux/delay.hlinux/dma-mapping.hasm/cacheflush.hhbm.hclient.h
Detected Declarations
function Copyrightfunction ishtp_cl_flush_queuesfunction ishtp_cl_initfunction ishtp_cl_allocatefunction ishtp_cl_freefunction ishtp_cl_linkfunction ishtp_cl_unlinkfunction ishtp_cl_disconnectfunction ishtp_cl_is_other_connectingfunction ishtp_cl_connect_to_fwfunction ishtp_cl_connectfunction ishtp_cl_establish_connectionfunction ishtp_cl_connectfunction ishtp_cl_destroy_connectionfunction ishtp_cl_read_startfunction ishtp_cl_sendfunction ishtp_cl_read_completefunction ipc_tx_sendfunction ishtp_cl_send_msg_ipcfunction ishtp_cl_send_msg_dmafunction ishtp_cl_send_msgfunction recv_ishtp_cl_msgfunction overflownfunction recv_ishtp_cl_msg_dmafunction list_for_each_entryfunction overflownfunction ishtp_set_client_datafunction ishtp_set_tx_ring_sizefunction ishtp_set_rx_ring_sizefunction ishtp_set_connection_statefunction ishtp_get_connection_statefunction ishtp_cl_set_fw_client_idexport ishtp_cl_flush_queuesexport ishtp_cl_allocateexport ishtp_cl_freeexport ishtp_cl_linkexport ishtp_cl_unlinkexport ishtp_cl_disconnectexport ishtp_cl_connectexport ishtp_cl_establish_connectionexport ishtp_cl_destroy_connectionexport ishtp_cl_sendexport ishtp_get_client_dataexport ishtp_set_client_dataexport ishtp_get_ishtp_deviceexport ishtp_set_tx_ring_sizeexport ishtp_set_rx_ring_sizeexport ishtp_set_connection_state
Annotated Snippet
if (rb->cl && ishtp_cl_cmp_id(cl, rb->cl)) {
list_del(&rb->list);
spin_lock(&cl->free_list_spinlock);
list_add_tail(&rb->list, &cl->free_rb_list.list);
spin_unlock(&cl->free_list_spinlock);
}
spin_unlock_irqrestore(&cl->dev->read_list_spinlock, flags);
}
/**
* ishtp_cl_flush_queues() - Flush all queues for a client
* @cl: ishtp client instance
*
* Used to remove all queues for a client. This is called when a client device
* needs reset due to error, S3 resume or during module removal
*
* Return: 0 on success else -EINVAL if device is NULL
*/
int ishtp_cl_flush_queues(struct ishtp_cl *cl)
{
if (WARN_ON(!cl || !cl->dev))
return -EINVAL;
ishtp_read_list_flush(cl);
return 0;
}
EXPORT_SYMBOL(ishtp_cl_flush_queues);
/**
* ishtp_cl_init() - Initialize all fields of a client device
* @cl: ishtp client instance
* @dev: ishtp device
*
* Initializes a client device fields: Init spinlocks, init queues etc.
* This function is called during new client creation
*/
static void ishtp_cl_init(struct ishtp_cl *cl, struct ishtp_device *dev)
{
memset(cl, 0, sizeof(struct ishtp_cl));
init_waitqueue_head(&cl->wait_ctrl_res);
spin_lock_init(&cl->free_list_spinlock);
spin_lock_init(&cl->in_process_spinlock);
spin_lock_init(&cl->tx_list_spinlock);
spin_lock_init(&cl->tx_free_list_spinlock);
spin_lock_init(&cl->fc_spinlock);
INIT_LIST_HEAD(&cl->link);
cl->dev = dev;
INIT_LIST_HEAD(&cl->free_rb_list.list);
INIT_LIST_HEAD(&cl->tx_list.list);
INIT_LIST_HEAD(&cl->tx_free_list.list);
INIT_LIST_HEAD(&cl->in_process_list.list);
cl->rx_ring_size = CL_DEF_RX_RING_SIZE;
cl->tx_ring_size = CL_DEF_TX_RING_SIZE;
cl->tx_ring_free_size = cl->tx_ring_size;
/* dma */
cl->last_tx_path = CL_TX_PATH_IPC;
cl->last_dma_acked = 1;
cl->last_dma_addr = NULL;
cl->last_ipc_acked = 1;
}
/**
* ishtp_cl_allocate() - allocates client structure and sets it up.
* @cl_device: ishtp client device
*
* Allocate memory for new client device and call to initialize each field.
*
* Return: The allocated client instance or NULL on failure
*/
struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device)
{
struct ishtp_cl *cl;
cl = kmalloc_obj(struct ishtp_cl);
if (!cl)
return NULL;
ishtp_cl_init(cl, cl_device->ishtp_dev);
return cl;
}
EXPORT_SYMBOL(ishtp_cl_allocate);
/**
* ishtp_cl_free() - Frees a client device
* @cl: client device instance
*
Annotation
- Immediate include surface: `linux/slab.h`, `linux/sched.h`, `linux/wait.h`, `linux/delay.h`, `linux/dma-mapping.h`, `asm/cacheflush.h`, `hbm.h`, `client.h`.
- Detected declarations: `function Copyright`, `function ishtp_cl_flush_queues`, `function ishtp_cl_init`, `function ishtp_cl_allocate`, `function ishtp_cl_free`, `function ishtp_cl_link`, `function ishtp_cl_unlink`, `function ishtp_cl_disconnect`, `function ishtp_cl_is_other_connecting`, `function ishtp_cl_connect_to_fw`.
- 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.
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.