drivers/platform/x86/intel/speed_select_if/isst_if_common.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/speed_select_if/isst_if_common.c- Extension
.c- Size
- 19973 bytes
- Lines
- 827
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/cpufeature.hlinux/cpuhotplug.hlinux/fs.hlinux/hashtable.hlinux/miscdevice.hlinux/module.hlinux/pci.hlinux/sched/signal.hlinux/slab.hlinux/uaccess.huapi/linux/isst_if.hasm/cpu_device_id.hasm/intel-family.hasm/msr.hisst_if_common.h
Detected Declarations
struct isst_valid_cmd_rangesstruct isst_cmd_set_req_typestruct isst_cmdstruct isst_if_cpu_infostruct isst_if_pkg_infofunction isst_store_new_cmdfunction isst_delete_hashfunction hash_for_each_safefunction isst_store_cmdfunction isst_mbox_resume_commandfunction isst_resume_commonfunction hash_for_eachfunction isst_if_mbox_cmd_invalidfunction isst_if_mbox_cmd_set_reqfunction isst_if_get_platform_infofunction for_each_pci_devfunction isst_if_get_pci_devfunction isst_if_cpu_onlinefunction isst_if_cpu_info_initfunction isst_if_cpu_info_exitfunction isst_if_proc_phyid_reqfunction match_punit_msr_white_listfunction isst_if_msr_cmd_reqfunction isst_if_exec_multi_cmdfunction isst_if_def_ioctlfunction isst_if_openfunction isst_if_relasefunction isst_misc_regfunction isst_misc_unregfunction isst_if_cdev_registerfunction isst_if_cdev_unregisterfunction isst_if_common_initfunction isst_if_common_exitmodule init isst_if_common_initexport isst_store_cmdexport isst_resume_commonexport isst_if_mbox_cmd_invalidexport isst_if_mbox_cmd_set_reqexport isst_if_get_pci_devexport isst_if_cdev_registerexport isst_if_cdev_unregister
Annotated Snippet
static const struct file_operations isst_if_char_driver_ops = {
.open = isst_if_open,
.unlocked_ioctl = isst_if_def_ioctl,
.release = isst_if_relase,
};
static struct miscdevice isst_if_char_driver = {
.minor = MISC_DYNAMIC_MINOR,
.name = "isst_interface",
.fops = &isst_if_char_driver_ops,
};
static int isst_misc_reg(void)
{
int ret;
ret = isst_if_cpu_info_init();
if (ret)
return ret;
ret = misc_register(&isst_if_char_driver);
if (ret)
isst_if_cpu_info_exit();
return ret;
}
static void isst_misc_unreg(void)
{
misc_deregister(&isst_if_char_driver);
isst_if_cpu_info_exit();
}
/**
* isst_if_cdev_register() - Register callback for IOCTL
* @device_type: The device type this callback handling.
* @cb: Callback structure.
*
* This function registers a callback to device type. On very first call
* it will register a misc device, which is used for user kernel interface.
* Other calls simply increment ref count. Registry will fail, if the user
* already opened misc device for operation. Also if the misc device
* creation failed, then it will not try again and all callers will get
* failure code.
*
* Return: Return the return value from the misc creation device or -EINVAL
* for unsupported device type.
*/
int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
{
if (device_type >= ISST_IF_DEV_MAX)
return -EINVAL;
if (device_type < ISST_IF_DEV_TPMI && isst_hpm_support)
return -ENODEV;
mutex_lock(&punit_misc_dev_open_lock);
/* Device is already open, we don't want to add new callbacks */
if (misc_device_open) {
mutex_unlock(&punit_misc_dev_open_lock);
return -EAGAIN;
}
if (!cb->api_version)
cb->api_version = ISST_IF_API_VERSION;
if (cb->api_version > isst_if_api_version)
isst_if_api_version = cb->api_version;
memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));
punit_callbacks[device_type].registered = 1;
mutex_unlock(&punit_misc_dev_open_lock);
return 0;
}
EXPORT_SYMBOL_GPL(isst_if_cdev_register);
/**
* isst_if_cdev_unregister() - Unregister callback for IOCTL
* @device_type: The device type to unregister.
*
* This function unregisters the previously registered callback. If this
* is the last callback unregistering, then misc device is removed.
*
* Return: None.
*/
void isst_if_cdev_unregister(int device_type)
{
mutex_lock(&punit_misc_dev_open_lock);
punit_callbacks[device_type].def_ioctl = NULL;
punit_callbacks[device_type].registered = 0;
if (device_type == ISST_IF_DEV_MBOX)
isst_delete_hash();
Annotation
- Immediate include surface: `linux/cpufeature.h`, `linux/cpuhotplug.h`, `linux/fs.h`, `linux/hashtable.h`, `linux/miscdevice.h`, `linux/module.h`, `linux/pci.h`, `linux/sched/signal.h`.
- Detected declarations: `struct isst_valid_cmd_ranges`, `struct isst_cmd_set_req_type`, `struct isst_cmd`, `struct isst_if_cpu_info`, `struct isst_if_pkg_info`, `function isst_store_new_cmd`, `function isst_delete_hash`, `function hash_for_each_safe`, `function isst_store_cmd`, `function isst_mbox_resume_command`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.