drivers/peci/sysfs.c
Source file repositories/reference/linux-study-clean/drivers/peci/sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/peci/sysfs.c- Extension
.c- Size
- 1620 bytes
- Lines
- 83
- Domain
- Driver Families
- Bucket
- drivers/peci
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/kernel.hlinux/peci.hinternal.h
Detected Declarations
function rescan_controllerfunction rescan_storefunction remove_store
Annotated Snippet
static ssize_t rescan_store(const struct bus_type *bus, const char *buf, size_t count)
{
bool res;
int ret;
ret = kstrtobool(buf, &res);
if (ret)
return ret;
if (!res)
return count;
ret = bus_for_each_dev(&peci_bus_type, NULL, NULL, rescan_controller);
if (ret)
return ret;
return count;
}
static BUS_ATTR_WO(rescan);
static struct attribute *peci_bus_attrs[] = {
&bus_attr_rescan.attr,
NULL
};
static const struct attribute_group peci_bus_group = {
.attrs = peci_bus_attrs,
};
const struct attribute_group *peci_bus_groups[] = {
&peci_bus_group,
NULL
};
static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct peci_device *device = to_peci_device(dev);
bool res;
int ret;
ret = kstrtobool(buf, &res);
if (ret)
return ret;
if (res && device_remove_file_self(dev, attr))
peci_device_destroy(device);
return count;
}
static DEVICE_ATTR_IGNORE_LOCKDEP(remove, 0200, NULL, remove_store);
static struct attribute *peci_device_attrs[] = {
&dev_attr_remove.attr,
NULL
};
static const struct attribute_group peci_device_group = {
.attrs = peci_device_attrs,
};
const struct attribute_group *peci_device_groups[] = {
&peci_device_group,
NULL
};
Annotation
- Immediate include surface: `linux/device.h`, `linux/kernel.h`, `linux/peci.h`, `internal.h`.
- Detected declarations: `function rescan_controller`, `function rescan_store`, `function remove_store`.
- Atlas domain: Driver Families / drivers/peci.
- Implementation status: pattern 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.