drivers/hte/hte.c
Source file repositories/reference/linux-study-clean/drivers/hte/hte.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hte/hte.c- Extension
.c- Size
- 21845 bytes
- Lines
- 943
- Domain
- Driver Families
- Bucket
- drivers/hte
- 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/kernel.hlinux/module.hlinux/err.hlinux/slab.hlinux/of.hlinux/mutex.hlinux/uaccess.hlinux/hte.hlinux/delay.hlinux/debugfs.hlinux/device.h
Detected Declarations
struct hte_ts_infostruct hte_devicefunction hte_subsys_dbgfs_initfunction hte_chip_dbgfs_initfunction hte_ts_dbgfs_initfunction hte_chip_dbgfs_initfunction hte_ts_dis_en_commonfunction hte_disable_tsfunction hte_enable_tsfunction hte_do_cb_workfunction __hte_req_tsfunction hte_bind_ts_info_lockedfunction list_for_each_entryfunction list_for_each_entryfunction of_hte_req_countfunction hte_ts_getfunction __devm_hte_release_tsfunction hte_request_ts_nsfunction devm_hte_request_ts_nsfunction hte_init_line_attrfunction hte_get_clk_src_infofunction hte_push_ts_nsfunction hte_register_chipfunction hte_unregister_chipfunction _hte_devm_unregister_chipfunction devm_hte_register_chipmodule init hte_subsys_dbgfs_initexport hte_ts_putexport hte_disable_tsexport hte_enable_tsexport of_hte_req_countexport hte_ts_getexport hte_request_ts_nsexport devm_hte_request_ts_nsexport hte_init_line_attrexport hte_get_clk_src_infoexport hte_push_ts_nsexport devm_hte_register_chip
Annotated Snippet
subsys_initcall(hte_subsys_dbgfs_init);
static void hte_chip_dbgfs_init(struct hte_device *gdev)
{
const struct hte_chip *chip = gdev->chip;
const char *name = chip->name ? chip->name : dev_name(chip->dev);
gdev->dbg_root = debugfs_create_dir(name, hte_root);
debugfs_create_atomic_t("ts_requested", 0444, gdev->dbg_root,
&gdev->ts_req);
debugfs_create_u32("total_ts", 0444, gdev->dbg_root,
&gdev->nlines);
}
static void hte_ts_dbgfs_init(const char *name, struct hte_ts_info *ei)
{
if (!ei->gdev->dbg_root || !name)
return;
ei->ts_dbg_root = debugfs_create_dir(name, ei->gdev->dbg_root);
debugfs_create_atomic_t("dropped_timestamps", 0444, ei->ts_dbg_root,
&ei->dropped_ts);
}
#else
static void hte_chip_dbgfs_init(struct hte_device *gdev)
{
}
static void hte_ts_dbgfs_init(const char *name, struct hte_ts_info *ei)
{
}
#endif
/**
* hte_ts_put() - Release and disable timestamp for the given desc.
*
* @desc: timestamp descriptor.
*
* Context: debugfs_remove_recursive() function call may use sleeping locks,
* not suitable from atomic context.
* Returns: 0 on success or a negative error code on failure.
*/
int hte_ts_put(struct hte_ts_desc *desc)
{
int ret = 0;
unsigned long flag;
struct hte_device *gdev;
struct hte_ts_info *ei;
if (!desc)
return -EINVAL;
ei = desc->hte_data;
if (!ei || !ei->gdev)
return -EINVAL;
gdev = ei->gdev;
mutex_lock(&ei->req_mlock);
if (unlikely(!test_bit(HTE_TS_REQ, &ei->flags) &&
!test_bit(HTE_TS_REGISTERED, &ei->flags))) {
dev_info(gdev->sdev, "id:%d is not requested\n",
desc->attr.line_id);
ret = -EINVAL;
goto unlock;
}
if (unlikely(!test_bit(HTE_TS_REQ, &ei->flags) &&
test_bit(HTE_TS_REGISTERED, &ei->flags))) {
dev_info(gdev->sdev, "id:%d is registered but not requested\n",
desc->attr.line_id);
ret = -EINVAL;
goto unlock;
}
if (test_bit(HTE_TS_REQ, &ei->flags) &&
!test_bit(HTE_TS_REGISTERED, &ei->flags)) {
clear_bit(HTE_TS_REQ, &ei->flags);
desc->hte_data = NULL;
ret = 0;
goto mod_put;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/err.h`, `linux/slab.h`, `linux/of.h`, `linux/mutex.h`, `linux/uaccess.h`, `linux/hte.h`.
- Detected declarations: `struct hte_ts_info`, `struct hte_device`, `function hte_subsys_dbgfs_init`, `function hte_chip_dbgfs_init`, `function hte_ts_dbgfs_init`, `function hte_chip_dbgfs_init`, `function hte_ts_dis_en_common`, `function hte_disable_ts`, `function hte_enable_ts`, `function hte_do_cb_work`.
- Atlas domain: Driver Families / drivers/hte.
- 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.