include/linux/mfd/ocelot.h
Source file repositories/reference/linux-study-clean/include/linux/mfd/ocelot.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mfd/ocelot.h- Extension
.h- Size
- 1536 bytes
- Lines
- 63
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/errno.hlinux/ioport.hlinux/platform_device.hlinux/regmap.hlinux/types.h
Detected Declarations
struct resourcefunction ocelot_regmap_from_resource_optionalfunction ocelot_regmap_from_resource
Annotated Snippet
#ifndef _LINUX_MFD_OCELOT_H
#define _LINUX_MFD_OCELOT_H
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/types.h>
struct resource;
static inline struct regmap *
ocelot_regmap_from_resource_optional(struct platform_device *pdev,
unsigned int index,
const struct regmap_config *config)
{
struct device *dev = &pdev->dev;
struct resource *res;
void __iomem *regs;
/*
* Don't use _get_and_ioremap_resource() here, since that will invoke
* prints of "invalid resource" which will simply add confusion.
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, index);
if (res) {
regs = devm_ioremap_resource(dev, res);
if (IS_ERR(regs))
return ERR_CAST(regs);
return devm_regmap_init_mmio(dev, regs, config);
}
/*
* Fall back to using REG and getting the resource from the parent
* device, which is possible in an MFD configuration
*/
if (dev->parent) {
res = platform_get_resource(pdev, IORESOURCE_REG, index);
if (!res)
return NULL;
return dev_get_regmap(dev->parent, res->name);
}
return NULL;
}
static inline struct regmap *
ocelot_regmap_from_resource(struct platform_device *pdev, unsigned int index,
const struct regmap_config *config)
{
struct regmap *map;
map = ocelot_regmap_from_resource_optional(pdev, index, config);
return map ?: ERR_PTR(-ENOENT);
}
#endif
Annotation
- Immediate include surface: `linux/err.h`, `linux/errno.h`, `linux/ioport.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/types.h`.
- Detected declarations: `struct resource`, `function ocelot_regmap_from_resource_optional`, `function ocelot_regmap_from_resource`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.