drivers/base/regmap/regmap-slimbus.c
Source file repositories/reference/linux-study-clean/drivers/base/regmap/regmap-slimbus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/base/regmap/regmap-slimbus.c- Extension
.c- Size
- 1990 bytes
- Lines
- 71
- Domain
- Driver Families
- Bucket
- drivers/base
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/regmap.hlinux/slimbus.hlinux/module.hinternal.h
Detected Declarations
function regmap_slimbus_writefunction regmap_slimbus_readexport __regmap_init_slimbusexport __devm_regmap_init_slimbus
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017, Linaro Ltd.
#include <linux/regmap.h>
#include <linux/slimbus.h>
#include <linux/module.h>
#include "internal.h"
static int regmap_slimbus_write(void *context, const void *data, size_t count)
{
struct slim_device *sdev = context;
return slim_write(sdev, *(u16 *)data, count - 2, (u8 *)data + 2);
}
static int regmap_slimbus_read(void *context, const void *reg, size_t reg_size,
void *val, size_t val_size)
{
struct slim_device *sdev = context;
return slim_read(sdev, *(u16 *)reg, val_size, val);
}
static const struct regmap_bus regmap_slimbus_bus = {
.write = regmap_slimbus_write,
.read = regmap_slimbus_read,
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
.val_format_endian_default = REGMAP_ENDIAN_LITTLE,
};
static const struct regmap_bus *regmap_get_slimbus(struct slim_device *slim,
const struct regmap_config *config)
{
if (config->val_bits == 8 && config->reg_bits == 16)
return ®map_slimbus_bus;
return ERR_PTR(-ENOTSUPP);
}
struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
const struct regmap_config *config,
struct lock_class_key *lock_key,
const char *lock_name)
{
const struct regmap_bus *bus = regmap_get_slimbus(slimbus, config);
if (IS_ERR(bus))
return ERR_CAST(bus);
return __regmap_init(&slimbus->dev, bus, slimbus, config, lock_key, lock_name);
}
EXPORT_SYMBOL_GPL(__regmap_init_slimbus);
struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
const struct regmap_config *config,
struct lock_class_key *lock_key,
const char *lock_name)
{
const struct regmap_bus *bus = regmap_get_slimbus(slimbus, config);
if (IS_ERR(bus))
return ERR_CAST(bus);
return __devm_regmap_init(&slimbus->dev, bus, slimbus, config, lock_key, lock_name);
}
EXPORT_SYMBOL_GPL(__devm_regmap_init_slimbus);
MODULE_DESCRIPTION("Register map access API - SLIMbus support");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/regmap.h`, `linux/slimbus.h`, `linux/module.h`, `internal.h`.
- Detected declarations: `function regmap_slimbus_write`, `function regmap_slimbus_read`, `export __regmap_init_slimbus`, `export __devm_regmap_init_slimbus`.
- Atlas domain: Driver Families / drivers/base.
- Implementation status: integration 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.