drivers/s390/cio/scm.c
Source file repositories/reference/linux-study-clean/drivers/s390/cio/scm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/cio/scm.c- Extension
.c- Size
- 6790 bytes
- Lines
- 292
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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.
- 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/device.hlinux/export.hlinux/module.hlinux/mutex.hlinux/slab.hlinux/init.hlinux/err.hasm/eadm.hchsc.h
Detected Declarations
function scmdev_probefunction scmdev_removefunction scmdev_ueventfunction scm_driver_registerfunction scm_driver_unregisterfunction scm_irq_handlerfunction scmdev_releasefunction scmdev_setupfunction scmdev_updatefunction check_addressfunction scm_addfunction scm_update_informationfunction scm_dev_availfunction scm_process_availability_informationfunction scm_initexport scm_driver_registerexport scm_driver_unregisterexport scm_irq_handler
Annotated Snippet
static const struct bus_type scm_bus_type = {
.name = "scm",
.probe = scmdev_probe,
.remove = scmdev_remove,
.uevent = scmdev_uevent,
};
/**
* scm_driver_register() - register a scm driver
* @scmdrv: driver to be registered
*/
int scm_driver_register(struct scm_driver *scmdrv)
{
struct device_driver *drv = &scmdrv->drv;
drv->bus = &scm_bus_type;
return driver_register(drv);
}
EXPORT_SYMBOL_GPL(scm_driver_register);
/**
* scm_driver_unregister() - deregister a scm driver
* @scmdrv: driver to be deregistered
*/
void scm_driver_unregister(struct scm_driver *scmdrv)
{
driver_unregister(&scmdrv->drv);
}
EXPORT_SYMBOL_GPL(scm_driver_unregister);
void scm_irq_handler(struct aob *aob, blk_status_t error)
{
struct aob_rq_header *aobrq = (void *) aob->request.data;
struct scm_device *scmdev = aobrq->scmdev;
struct scm_driver *scmdrv = to_scm_drv(scmdev->dev.driver);
scmdrv->handler(scmdev, aobrq->data, error);
}
EXPORT_SYMBOL_GPL(scm_irq_handler);
#define scm_attr(name) \
static ssize_t show_##name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct scm_device *scmdev = to_scm_dev(dev); \
int ret; \
\
device_lock(dev); \
ret = sysfs_emit(buf, "%u\n", scmdev->attrs.name); \
device_unlock(dev); \
\
return ret; \
} \
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
scm_attr(persistence);
scm_attr(oper_state);
scm_attr(data_state);
scm_attr(rank);
scm_attr(release);
scm_attr(res_id);
static struct attribute *scmdev_attrs[] = {
&dev_attr_persistence.attr,
&dev_attr_oper_state.attr,
&dev_attr_data_state.attr,
&dev_attr_rank.attr,
&dev_attr_release.attr,
&dev_attr_res_id.attr,
NULL,
};
static struct attribute_group scmdev_attr_group = {
.attrs = scmdev_attrs,
};
static const struct attribute_group *scmdev_attr_groups[] = {
&scmdev_attr_group,
NULL,
};
static void scmdev_release(struct device *dev)
{
struct scm_device *scmdev = to_scm_dev(dev);
kfree(scmdev);
}
static void scmdev_setup(struct scm_device *scmdev, struct sale *sale,
Annotation
- Immediate include surface: `linux/device.h`, `linux/export.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`, `linux/init.h`, `linux/err.h`, `asm/eadm.h`.
- Detected declarations: `function scmdev_probe`, `function scmdev_remove`, `function scmdev_uevent`, `function scm_driver_register`, `function scm_driver_unregister`, `function scm_irq_handler`, `function scmdev_release`, `function scmdev_setup`, `function scmdev_update`, `function check_address`.
- Atlas domain: Driver Families / drivers/s390.
- 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.