drivers/hwtracing/intel_th/core.c
Source file repositories/reference/linux-study-clean/drivers/hwtracing/intel_th/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwtracing/intel_th/core.c- Extension
.c- Size
- 24580 bytes
- Lines
- 1111
- Domain
- Driver Families
- Bucket
- drivers/hwtracing
- 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 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/types.hlinux/module.hlinux/device.hlinux/sysfs.hlinux/kdev_t.hlinux/debugfs.hlinux/idr.hlinux/pci.hlinux/pm_runtime.hlinux/dma-mapping.hintel_th.hdebug.h
Detected Declarations
function intel_th_matchfunction intel_th_child_removefunction intel_th_probefunction intel_th_removefunction intel_th_device_releasefunction port_showfunction intel_th_trace_preparefunction intel_th_output_activatefunction intel_th_output_deactivatefunction active_showfunction active_storefunction intel_th_driver_registerfunction intel_th_driver_unregisterfunction intel_th_device_allocfunction intel_th_device_add_resourcesfunction intel_th_device_removefunction intel_th_device_freefunction __intel_th_request_hub_modulefunction intel_th_request_hub_modulefunction intel_th_request_hub_module_flushfunction intel_th_request_hub_modulefunction intel_th_request_hub_module_flushfunction intel_th_output_enablefunction intel_th_populatefunction intel_th_output_openfunction intel_th_output_releasefunction intel_th_irqfunction intel_th_allocfunction intel_th_freefunction intel_th_trace_enablefunction intel_th_trace_switchfunction intel_th_trace_disablefunction intel_th_set_outputfunction intel_th_initfunction intel_th_exitmodule init intel_th_initexport intel_th_driver_registerexport intel_th_driver_unregisterexport intel_th_output_enableexport intel_th_allocexport intel_th_freeexport intel_th_trace_enableexport intel_th_trace_switchexport intel_th_trace_disableexport intel_th_set_output
Annotated Snippet
static int intel_th_match(struct device *dev, const struct device_driver *driver)
{
const struct intel_th_driver *thdrv = to_intel_th_driver(driver);
struct intel_th_device *thdev = to_intel_th_device(dev);
if (thdev->type == INTEL_TH_SWITCH &&
(!thdrv->enable || !thdrv->disable))
return 0;
return !strcmp(thdev->name, driver->name);
}
static int intel_th_child_remove(struct device *dev, void *data)
{
device_release_driver(dev);
return 0;
}
static int intel_th_probe(struct device *dev)
{
struct intel_th_driver *thdrv = to_intel_th_driver(dev->driver);
struct intel_th_device *thdev = to_intel_th_device(dev);
struct intel_th_driver *hubdrv;
struct intel_th_device *hub = NULL;
int ret;
if (thdev->type == INTEL_TH_SWITCH)
hub = thdev;
else if (dev->parent)
hub = to_intel_th_device(dev->parent);
if (!hub || !hub->dev.driver)
return -EPROBE_DEFER;
hubdrv = to_intel_th_driver(hub->dev.driver);
pm_runtime_set_active(dev);
pm_runtime_no_callbacks(dev);
pm_runtime_enable(dev);
ret = thdrv->probe(to_intel_th_device(dev));
if (ret)
goto out_pm;
if (thdrv->attr_group) {
ret = sysfs_create_group(&thdev->dev.kobj, thdrv->attr_group);
if (ret)
goto out;
}
if (thdev->type == INTEL_TH_OUTPUT &&
!intel_th_output_assigned(thdev))
/* does not talk to hardware */
ret = hubdrv->assign(hub, thdev);
out:
if (ret)
thdrv->remove(thdev);
out_pm:
if (ret)
pm_runtime_disable(dev);
return ret;
}
static void intel_th_device_remove(struct intel_th_device *thdev);
static void intel_th_remove(struct device *dev)
{
struct intel_th_driver *thdrv = to_intel_th_driver(dev->driver);
struct intel_th_device *thdev = to_intel_th_device(dev);
struct intel_th_device *hub = to_intel_th_hub(thdev);
if (thdev->type == INTEL_TH_SWITCH) {
struct intel_th *th = to_intel_th(hub);
int i, lowest;
/*
* disconnect outputs
*
* intel_th_child_remove returns 0 unconditionally, so there is
* no need to check the return value of device_for_each_child.
*/
device_for_each_child(dev, thdev, intel_th_child_remove);
/*
* Remove outputs, that is, hub's children: they are created
* at hub's probe time by having the hub call
Annotation
- Immediate include surface: `linux/types.h`, `linux/module.h`, `linux/device.h`, `linux/sysfs.h`, `linux/kdev_t.h`, `linux/debugfs.h`, `linux/idr.h`, `linux/pci.h`.
- Detected declarations: `function intel_th_match`, `function intel_th_child_remove`, `function intel_th_probe`, `function intel_th_remove`, `function intel_th_device_release`, `function port_show`, `function intel_th_trace_prepare`, `function intel_th_output_activate`, `function intel_th_output_deactivate`, `function active_show`.
- Atlas domain: Driver Families / drivers/hwtracing.
- Implementation status: pattern implementation candidate.
- 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.