drivers/hid/intel-ish-hid/ishtp/init.c
Source file repositories/reference/linux-study-clean/drivers/hid/intel-ish-hid/ishtp/init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/intel-ish-hid/ishtp/init.c- Extension
.c- Size
- 2188 bytes
- Lines
- 85
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/devm-helpers.hlinux/export.hlinux/slab.hlinux/sched.hishtp-dev.hhbm.hclient.hloader.h
Detected Declarations
function Copyrightfunction ishtp_startexport ishtp_device_initexport ishtp_start
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Initialization protocol for ISHTP driver
*
* Copyright (c) 2003-2016, Intel Corporation.
*/
#include <linux/devm-helpers.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include "ishtp-dev.h"
#include "hbm.h"
#include "client.h"
#include "loader.h"
/**
* ishtp_device_init() - ishtp device init
* @dev: ISHTP device instance
*
* After ISHTP device is alloacted, this function is used to initialize
* each field which includes spin lock, work struct and lists
*/
void ishtp_device_init(struct ishtp_device *dev)
{
int ret;
dev->dev_state = ISHTP_DEV_INITIALIZING;
INIT_LIST_HEAD(&dev->cl_list);
INIT_LIST_HEAD(&dev->device_list);
dev->rd_msg_fifo_head = 0;
dev->rd_msg_fifo_tail = 0;
spin_lock_init(&dev->rd_msg_spinlock);
init_waitqueue_head(&dev->wait_hbm_recvd_msg);
init_waitqueue_head(&dev->wait_loader_recvd_msg);
spin_lock_init(&dev->read_list_spinlock);
spin_lock_init(&dev->device_lock);
spin_lock_init(&dev->device_list_lock);
spin_lock_init(&dev->cl_list_lock);
spin_lock_init(&dev->fw_clients_lock);
INIT_WORK(&dev->bh_hbm_work, bh_hbm_work_fn);
bitmap_zero(dev->host_clients_map, ISHTP_CLIENTS_MAX);
dev->open_handle_count = 0;
/*
* Reserving client ID 0 for ISHTP Bus Message communications
*/
bitmap_set(dev->host_clients_map, 0, 1);
INIT_LIST_HEAD(&dev->read_list.list);
ret = devm_work_autocancel(dev->devc, &dev->work_fw_loader, ishtp_loader_work);
if (ret)
dev_err_probe(dev->devc, ret, "Failed to initialise FW loader work\n");
}
EXPORT_SYMBOL(ishtp_device_init);
/**
* ishtp_start() - Start ISH processing
* @dev: ISHTP device instance
*
* Start ISHTP processing by sending query subscriber message
*
* Return: 0 on success else -ENODEV
*/
int ishtp_start(struct ishtp_device *dev)
{
if (ishtp_hbm_start_wait(dev)) {
dev_err(dev->devc, "HBM haven't started");
goto err;
}
/* suspend & resume notification - send QUERY_SUBSCRIBERS msg */
ishtp_query_subscribers(dev);
return 0;
err:
dev_err(dev->devc, "link layer initialization failed.\n");
dev->dev_state = ISHTP_DEV_DISABLED;
return -ENODEV;
}
EXPORT_SYMBOL(ishtp_start);
Annotation
- Immediate include surface: `linux/devm-helpers.h`, `linux/export.h`, `linux/slab.h`, `linux/sched.h`, `ishtp-dev.h`, `hbm.h`, `client.h`, `loader.h`.
- Detected declarations: `function Copyright`, `function ishtp_start`, `export ishtp_device_init`, `export ishtp_start`.
- 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.