drivers/fpga/dfl-fme-pr.c
Source file repositories/reference/linux-study-clean/drivers/fpga/dfl-fme-pr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/fpga/dfl-fme-pr.c- Extension
.c- Size
- 11580 bytes
- Lines
- 477
- Domain
- Driver Families
- Bucket
- drivers/fpga
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/types.hlinux/device.hlinux/vmalloc.hlinux/uaccess.hlinux/fpga/fpga-mgr.hlinux/fpga/fpga-bridge.hlinux/fpga/fpga-region.hlinux/fpga-dfl.hdfl.hdfl-fme.hdfl-fme-pr.h
Detected Declarations
function Enginefunction dfl_fme_region_matchfunction fme_prfunction dfl_fme_create_mgrfunction dfl_fme_destroy_mgrfunction dfl_fme_create_bridgefunction dfl_fme_destroy_bridgefunction dfl_fme_destroy_bridgesfunction list_for_each_entry_safefunction dfl_fme_create_regionfunction dfl_fme_destroy_regionfunction dfl_fme_destroy_regionsfunction list_for_each_entry_safefunction pr_mgmt_initfunction pr_mgmt_uinitfunction fme_pr_ioctl
Annotated Snippet
if (IS_ERR(fme_br)) {
ret = PTR_ERR(fme_br);
goto destroy_region;
}
list_add(&fme_br->node, &priv->bridge_list);
/* Create region for each port */
fme_region = dfl_fme_create_region(fdata, mgr,
fme_br->br, i);
if (IS_ERR(fme_region)) {
ret = PTR_ERR(fme_region);
goto destroy_region;
}
list_add(&fme_region->node, &priv->region_list);
}
mutex_unlock(&fdata->lock);
return 0;
destroy_region:
dfl_fme_destroy_regions(fdata);
dfl_fme_destroy_bridges(fdata);
dfl_fme_destroy_mgr(fdata);
unlock:
mutex_unlock(&fdata->lock);
return ret;
}
static void pr_mgmt_uinit(struct platform_device *pdev,
struct dfl_feature *feature)
{
struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(&pdev->dev);
mutex_lock(&fdata->lock);
dfl_fme_destroy_regions(fdata);
dfl_fme_destroy_bridges(fdata);
dfl_fme_destroy_mgr(fdata);
mutex_unlock(&fdata->lock);
}
static long fme_pr_ioctl(struct platform_device *pdev,
struct dfl_feature *feature,
unsigned int cmd, unsigned long arg)
{
long ret;
switch (cmd) {
case DFL_FPGA_FME_PORT_PR:
ret = fme_pr(pdev, arg);
break;
default:
ret = -ENODEV;
}
return ret;
}
const struct dfl_feature_id fme_pr_mgmt_id_table[] = {
{.id = FME_FEATURE_ID_PR_MGMT,},
{0}
};
const struct dfl_feature_ops fme_pr_mgmt_ops = {
.init = pr_mgmt_init,
.uinit = pr_mgmt_uinit,
.ioctl = fme_pr_ioctl,
};
Annotation
- Immediate include surface: `linux/types.h`, `linux/device.h`, `linux/vmalloc.h`, `linux/uaccess.h`, `linux/fpga/fpga-mgr.h`, `linux/fpga/fpga-bridge.h`, `linux/fpga/fpga-region.h`, `linux/fpga-dfl.h`.
- Detected declarations: `function Engine`, `function dfl_fme_region_match`, `function fme_pr`, `function dfl_fme_create_mgr`, `function dfl_fme_destroy_mgr`, `function dfl_fme_create_bridge`, `function dfl_fme_destroy_bridge`, `function dfl_fme_destroy_bridges`, `function list_for_each_entry_safe`, `function dfl_fme_create_region`.
- Atlas domain: Driver Families / drivers/fpga.
- Implementation status: source 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.