drivers/siox/siox-core.c
Source file repositories/reference/linux-study-clean/drivers/siox/siox-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/siox/siox-core.c- Extension
.c- Size
- 22675 bytes
- Lines
- 981
- Domain
- Driver Families
- Bucket
- drivers/siox
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/kernel.hlinux/device.hlinux/module.hlinux/slab.hlinux/sysfs.hsiox.htrace/events/siox.h
Detected Declarations
function siox_master_lockfunction siox_master_unlockfunction siox_status_cleanfunction siox_device_counter_errorfunction siox_device_type_errorfunction siox_device_wdg_errorfunction siox_device_syncedfunction siox_device_connectedfunction siox_pollfunction siox_poll_threadfunction __siox_startfunction siox_startfunction __siox_stopfunction list_for_each_entryfunction siox_stopfunction type_showfunction inbytes_showfunction outbytes_showfunction status_errors_showfunction connected_showfunction watchdog_showfunction watchdog_errors_showfunction siox_device_releasefunction siox_matchfunction siox_probefunction siox_removefunction siox_shutdownfunction active_showfunction active_storefunction device_add_storefunction device_remove_storefunction poll_interval_ns_showfunction poll_interval_ns_storefunction siox_master_releasefunction devm_siox_master_putfunction siox_master_registerfunction siox_master_unregisterfunction devm_siox_master_unregisterfunction devm_siox_master_registerfunction siox_device_removefunction __siox_driver_registerfunction siox_initfunction siox_exitmodule init siox_initexport siox_device_syncedexport siox_device_connectedexport siox_master_allocexport devm_siox_master_alloc
Annotated Snippet
static int siox_match(struct device *dev, const struct device_driver *drv)
{
if (dev->type != &siox_device_type)
return 0;
/* up to now there is only a single driver so keeping this simple */
return 1;
}
static int siox_probe(struct device *dev)
{
struct siox_driver *sdriver = to_siox_driver(dev->driver);
struct siox_device *sdevice = to_siox_device(dev);
return sdriver->probe(sdevice);
}
static void siox_remove(struct device *dev)
{
struct siox_driver *sdriver =
container_of(dev->driver, struct siox_driver, driver);
struct siox_device *sdevice = to_siox_device(dev);
if (sdriver->remove)
sdriver->remove(sdevice);
}
static void siox_shutdown(struct device *dev)
{
struct siox_device *sdevice = to_siox_device(dev);
struct siox_driver *sdriver;
if (!dev->driver)
return;
sdriver = container_of(dev->driver, struct siox_driver, driver);
if (sdriver->shutdown)
sdriver->shutdown(sdevice);
}
static const struct bus_type siox_bus_type = {
.name = "siox",
.match = siox_match,
.probe = siox_probe,
.remove = siox_remove,
.shutdown = siox_shutdown,
};
static ssize_t active_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct siox_master *smaster = to_siox_master(dev);
return sprintf(buf, "%d\n", smaster->active);
}
static ssize_t active_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct siox_master *smaster = to_siox_master(dev);
int ret;
int active;
ret = kstrtoint(buf, 0, &active);
if (ret < 0)
return ret;
if (active)
ret = siox_start(smaster);
else
ret = siox_stop(smaster);
if (ret < 0)
return ret;
return count;
}
static DEVICE_ATTR_RW(active);
static struct siox_device *siox_device_add(struct siox_master *smaster,
const char *type, size_t inbytes,
size_t outbytes, u8 statustype);
static ssize_t device_add_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct siox_master *smaster = to_siox_master(dev);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/device.h`, `linux/module.h`, `linux/slab.h`, `linux/sysfs.h`, `siox.h`, `trace/events/siox.h`.
- Detected declarations: `function siox_master_lock`, `function siox_master_unlock`, `function siox_status_clean`, `function siox_device_counter_error`, `function siox_device_type_error`, `function siox_device_wdg_error`, `function siox_device_synced`, `function siox_device_connected`, `function siox_poll`, `function siox_poll_thread`.
- Atlas domain: Driver Families / drivers/siox.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.