drivers/rapidio/rio-sysfs.c
Source file repositories/reference/linux-study-clean/drivers/rapidio/rio-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rapidio/rio-sysfs.c- Extension
.c- Size
- 7960 bytes
- Lines
- 367
- Domain
- Driver Families
- Bucket
- drivers/rapidio
- 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/kernel.hlinux/rio.hlinux/rio_drv.hlinux/stat.hlinux/capability.hrio.h
Detected Declarations
function routes_showfunction lprev_showfunction lnext_showfunction modalias_showfunction rio_read_configfunction rio_write_configfunction rio_dev_is_attr_visiblefunction scan_storefunction port_destid_showfunction sys_size_show
Annotated Snippet
static ssize_t scan_store(const struct bus_type *bus, const char *buf, size_t count)
{
long val;
int rc;
if (kstrtol(buf, 0, &val) < 0)
return -EINVAL;
if (val == RIO_MPORT_ANY) {
rc = rio_init_mports();
goto exit;
}
if (val < 0 || val >= RIO_MAX_MPORTS)
return -EINVAL;
rc = rio_mport_scan((int)val);
exit:
if (!rc)
rc = count;
return rc;
}
static BUS_ATTR_WO(scan);
static struct attribute *rio_bus_attrs[] = {
&bus_attr_scan.attr,
NULL,
};
static const struct attribute_group rio_bus_group = {
.attrs = rio_bus_attrs,
};
const struct attribute_group *rio_bus_groups[] = {
&rio_bus_group,
NULL,
};
static ssize_t
port_destid_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct rio_mport *mport = to_rio_mport(dev);
if (mport)
return sprintf(buf, "0x%04x\n", mport->host_deviceid);
else
return -ENODEV;
}
static DEVICE_ATTR_RO(port_destid);
static ssize_t sys_size_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct rio_mport *mport = to_rio_mport(dev);
if (mport)
return sprintf(buf, "%u\n", mport->sys_size);
else
return -ENODEV;
}
static DEVICE_ATTR_RO(sys_size);
static struct attribute *rio_mport_attrs[] = {
&dev_attr_port_destid.attr,
&dev_attr_sys_size.attr,
NULL,
};
static const struct attribute_group rio_mport_group = {
.attrs = rio_mport_attrs,
};
const struct attribute_group *rio_mport_groups[] = {
&rio_mport_group,
NULL,
};
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/rio.h`, `linux/rio_drv.h`, `linux/stat.h`, `linux/capability.h`, `rio.h`.
- Detected declarations: `function routes_show`, `function lprev_show`, `function lnext_show`, `function modalias_show`, `function rio_read_config`, `function rio_write_config`, `function rio_dev_is_attr_visible`, `function scan_store`, `function port_destid_show`, `function sys_size_show`.
- Atlas domain: Driver Families / drivers/rapidio.
- 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.