drivers/media/platform/renesas/rcar-fcp.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/rcar-fcp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/rcar-fcp.c- Extension
.c- Size
- 5111 bytes
- Lines
- 217
- Domain
- Driver Families
- Bucket
- drivers/media
- 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/device.hlinux/dma-mapping.hlinux/io.hlinux/iopoll.hlinux/list.hlinux/module.hlinux/mod_devicetable.hlinux/mutex.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hmedia/rcar-fcp.h
Detected Declarations
struct rcar_fcp_devicefunction rcar_fcp_writefunction list_for_each_entryfunction rcar_fcp_getfunction rcar_fcp_enablefunction rcar_fcp_enablefunction rcar_fcp_soft_resetfunction rcar_fcp_probefunction rcar_fcp_removeexport rcar_fcp_getexport rcar_fcp_putexport rcar_fcp_get_deviceexport rcar_fcp_enableexport rcar_fcp_disableexport rcar_fcp_soft_reset
Annotated Snippet
struct rcar_fcp_device {
struct list_head list;
struct device *dev;
void __iomem *base;
};
static LIST_HEAD(fcp_devices);
static DEFINE_MUTEX(fcp_lock);
static inline void rcar_fcp_write(struct rcar_fcp_device *fcp, u32 reg, u32 val)
{
iowrite32(val, fcp->base + reg);
}
/* -----------------------------------------------------------------------------
* Public API
*/
/**
* rcar_fcp_get - Find and acquire a reference to an FCP instance
* @np: Device node of the FCP instance
*
* Search the list of registered FCP instances for the instance corresponding to
* the given device node.
*
* Return a pointer to the FCP instance, or an ERR_PTR if the instance can't be
* found.
*/
struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
{
struct rcar_fcp_device *fcp;
mutex_lock(&fcp_lock);
list_for_each_entry(fcp, &fcp_devices, list) {
if (fcp->dev->of_node != np)
continue;
get_device(fcp->dev);
goto done;
}
fcp = ERR_PTR(-EPROBE_DEFER);
done:
mutex_unlock(&fcp_lock);
return fcp;
}
EXPORT_SYMBOL_GPL(rcar_fcp_get);
/**
* rcar_fcp_put - Release a reference to an FCP instance
* @fcp: The FCP instance
*
* Release the FCP instance acquired by a call to rcar_fcp_get().
*/
void rcar_fcp_put(struct rcar_fcp_device *fcp)
{
if (fcp)
put_device(fcp->dev);
}
EXPORT_SYMBOL_GPL(rcar_fcp_put);
struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp)
{
return fcp->dev;
}
EXPORT_SYMBOL_GPL(rcar_fcp_get_device);
/**
* rcar_fcp_enable - Enable an FCP
* @fcp: The FCP instance
*
* Before any memory access through an FCP is performed by a module, the FCP
* must be enabled by a call to this function. The enable calls are reference
* counted, each successful call must be followed by one rcar_fcp_disable()
* call when no more memory transfer can occur through the FCP.
*
* Return 0 on success or a negative error code if an error occurs. The enable
* reference count isn't increased when this function returns an error.
*/
int rcar_fcp_enable(struct rcar_fcp_device *fcp)
{
if (!fcp)
return 0;
return pm_runtime_resume_and_get(fcp->dev);
}
EXPORT_SYMBOL_GPL(rcar_fcp_enable);
Annotation
- Immediate include surface: `linux/device.h`, `linux/dma-mapping.h`, `linux/io.h`, `linux/iopoll.h`, `linux/list.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/mutex.h`.
- Detected declarations: `struct rcar_fcp_device`, `function rcar_fcp_write`, `function list_for_each_entry`, `function rcar_fcp_get`, `function rcar_fcp_enable`, `function rcar_fcp_enable`, `function rcar_fcp_soft_reset`, `function rcar_fcp_probe`, `function rcar_fcp_remove`, `export rcar_fcp_get`.
- Atlas domain: Driver Families / drivers/media.
- 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.