drivers/hwtracing/coresight/coresight-syscfg-configfs.c
Source file repositories/reference/linux-study-clean/drivers/hwtracing/coresight/coresight-syscfg-configfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwtracing/coresight/coresight-syscfg-configfs.c- Extension
.c- Size
- 13747 bytes
- Lines
- 484
- Domain
- Driver Families
- Bucket
- drivers/hwtracing
- 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.
- 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/configfs.hcoresight-config.hcoresight-syscfg-configfs.h
Detected Declarations
function Copyrightfunction cscfg_cfg_description_showfunction cscfg_cfg_feature_refs_showfunction cscfg_cfg_values_showfunction cscfg_cfg_enable_showfunction cscfg_cfg_enable_storefunction cscfg_cfg_preset_showfunction cscfg_cfg_preset_storefunction cscfg_add_preset_groupsfunction cscfg_feat_description_showfunction cscfg_feat_matches_showfunction cscfg_feat_nr_params_showfunction cscfg_param_value_showfunction cscfg_param_value_storefunction cscfg_create_params_group_itemsfunction cscfg_configfs_add_configfunction cscfg_configfs_del_configfunction cscfg_configfs_add_featurefunction cscfg_configfs_del_featurefunction cscfg_configfs_initfunction cscfg_configfs_release
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2020 Linaro Limited, All rights reserved.
* Author: Mike Leach <mike.leach@linaro.org>
*/
#include <linux/configfs.h>
#include "coresight-config.h"
#include "coresight-syscfg-configfs.h"
/* create a default ci_type. */
static struct config_item_type *cscfg_create_ci_type(void)
{
struct config_item_type *ci_type;
ci_type = devm_kzalloc(cscfg_device(), sizeof(*ci_type), GFP_KERNEL);
if (ci_type)
ci_type->ct_owner = THIS_MODULE;
return ci_type;
}
/* configurations sub-group */
/* attributes for the config view group */
static ssize_t cscfg_cfg_description_show(struct config_item *item, char *page)
{
struct cscfg_fs_config *fs_config = container_of(to_config_group(item),
struct cscfg_fs_config, group);
return scnprintf(page, PAGE_SIZE, "%s", fs_config->config_desc->description);
}
CONFIGFS_ATTR_RO(cscfg_cfg_, description);
static ssize_t cscfg_cfg_feature_refs_show(struct config_item *item, char *page)
{
struct cscfg_fs_config *fs_config = container_of(to_config_group(item),
struct cscfg_fs_config, group);
const struct cscfg_config_desc *config_desc = fs_config->config_desc;
ssize_t ch_used = 0;
int i;
for (i = 0; i < config_desc->nr_feat_refs; i++)
ch_used += scnprintf(page + ch_used, PAGE_SIZE - ch_used,
"%s\n", config_desc->feat_ref_names[i]);
return ch_used;
}
CONFIGFS_ATTR_RO(cscfg_cfg_, feature_refs);
/* list preset values in order of features and params */
static ssize_t cscfg_cfg_values_show(struct config_item *item, char *page)
{
const struct cscfg_feature_desc *feat_desc;
const struct cscfg_config_desc *config_desc;
struct cscfg_fs_preset *fs_preset;
int i, j, val_idx, preset_idx;
ssize_t used = 0;
fs_preset = container_of(to_config_group(item), struct cscfg_fs_preset, group);
config_desc = fs_preset->config_desc;
if (!config_desc->nr_presets)
return 0;
preset_idx = fs_preset->preset_num - 1;
/* start index on the correct array line */
val_idx = config_desc->nr_total_params * preset_idx;
/*
* A set of presets is the sum of all params in used features,
* in order of declaration of features and params in the features
*/
for (i = 0; i < config_desc->nr_feat_refs; i++) {
feat_desc = cscfg_get_named_feat_desc(config_desc->feat_ref_names[i]);
for (j = 0; j < feat_desc->nr_params; j++) {
used += scnprintf(page + used, PAGE_SIZE - used,
"%s.%s = 0x%llx ",
feat_desc->name,
feat_desc->params_desc[j].name,
config_desc->presets[val_idx++]);
}
}
used += scnprintf(page + used, PAGE_SIZE - used, "\n");
return used;
}
CONFIGFS_ATTR_RO(cscfg_cfg_, values);
Annotation
- Immediate include surface: `linux/configfs.h`, `coresight-config.h`, `coresight-syscfg-configfs.h`.
- Detected declarations: `function Copyright`, `function cscfg_cfg_description_show`, `function cscfg_cfg_feature_refs_show`, `function cscfg_cfg_values_show`, `function cscfg_cfg_enable_show`, `function cscfg_cfg_enable_store`, `function cscfg_cfg_preset_show`, `function cscfg_cfg_preset_store`, `function cscfg_add_preset_groups`, `function cscfg_feat_description_show`.
- Atlas domain: Driver Families / drivers/hwtracing.
- 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.