drivers/s390/cio/css.c
Source file repositories/reference/linux-study-clean/drivers/s390/cio/css.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/cio/css.c- Extension
.c- Size
- 33368 bytes
- Lines
- 1424
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/export.hlinux/init.hlinux/device.hlinux/slab.hlinux/errno.hlinux/list.hlinux/reboot.hlinux/proc_fs.hlinux/genalloc.hlinux/dma-mapping.hasm/isc.hasm/crw.hcss.hcio.hblacklist.hcio_debug.hioasm.hchsc.hdevice.hidset.hchp.h
Detected Declarations
struct cb_datafunction for_each_subchannelfunction call_fn_known_schfunction call_fn_unknown_schfunction call_fn_all_schfunction for_each_subchannel_stagedfunction css_sch_create_locksfunction css_subchannel_releasefunction css_validate_subchannelfunction css_sch_device_registerfunction css_sch_device_unregisterfunction ssd_from_pmcwfunction ssd_register_chpidsfunction css_update_ssd_infofunction type_showfunction modalias_showfunction chpids_showfunction pimpampom_showfunction dev_busid_showfunction css_register_subchannelfunction css_probe_devicefunction check_subchannelfunction get_subchannel_by_schidfunction css_sch_is_validfunction css_evaluate_new_subchannelfunction css_evaluate_known_subchannelfunction css_evaluate_subchannelfunction css_sched_sch_todofunction css_sch_todofunction slow_subchannel_initfunction slow_eval_known_fnfunction slow_eval_unknown_fnfunction css_slow_path_funcfunction css_schedule_evalfunction css_schedule_eval_allfunction __unset_validpathfunction __unset_onlinefunction css_schedule_eval_condfunction css_wait_for_slow_pathfunction css_schedule_reprobefunction css_process_crwfunction css_generate_pgidfunction channel_subsystem_releasefunction real_cssid_showfunction rescan_storefunction cm_enable_showfunction cm_enable_storefunction cm_enable_mode
Annotated Snippet
static const struct bus_type css_bus_type;
int
for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *data)
{
struct subchannel_id schid;
int ret;
init_subchannel_id(&schid);
do {
do {
ret = fn(schid, data);
if (ret)
break;
} while (schid.sch_no++ < __MAX_SUBCHANNEL);
schid.sch_no = 0;
} while (schid.ssid++ < max_ssid);
return ret;
}
struct cb_data {
void *data;
struct idset *set;
int (*fn_known_sch)(struct subchannel *, void *);
int (*fn_unknown_sch)(struct subchannel_id, void *);
};
static int call_fn_known_sch(struct device *dev, void *data)
{
struct subchannel *sch = to_subchannel(dev);
struct cb_data *cb = data;
int rc = 0;
if (cb->set)
idset_sch_del(cb->set, sch->schid);
if (cb->fn_known_sch)
rc = cb->fn_known_sch(sch, cb->data);
return rc;
}
static int call_fn_unknown_sch(struct subchannel_id schid, void *data)
{
struct cb_data *cb = data;
int rc = 0;
if (idset_sch_contains(cb->set, schid))
rc = cb->fn_unknown_sch(schid, cb->data);
return rc;
}
static int call_fn_all_sch(struct subchannel_id schid, void *data)
{
struct cb_data *cb = data;
struct subchannel *sch;
int rc = 0;
sch = get_subchannel_by_schid(schid);
if (sch) {
if (cb->fn_known_sch)
rc = cb->fn_known_sch(sch, cb->data);
put_device(&sch->dev);
} else {
if (cb->fn_unknown_sch)
rc = cb->fn_unknown_sch(schid, cb->data);
}
return rc;
}
int for_each_subchannel_staged(int (*fn_known)(struct subchannel *, void *),
int (*fn_unknown)(struct subchannel_id,
void *), void *data)
{
struct cb_data cb;
int rc;
cb.data = data;
cb.fn_known_sch = fn_known;
cb.fn_unknown_sch = fn_unknown;
if (fn_known && !fn_unknown) {
/* Skip idset allocation in case of known-only loop. */
cb.set = NULL;
return bus_for_each_dev(&css_bus_type, NULL, &cb,
call_fn_known_sch);
}
cb.set = idset_sch_new();
if (!cb.set)
/* fall back to brute force scanning in case of oom */
Annotation
- Immediate include surface: `linux/export.h`, `linux/init.h`, `linux/device.h`, `linux/slab.h`, `linux/errno.h`, `linux/list.h`, `linux/reboot.h`, `linux/proc_fs.h`.
- Detected declarations: `struct cb_data`, `function for_each_subchannel`, `function call_fn_known_sch`, `function call_fn_unknown_sch`, `function call_fn_all_sch`, `function for_each_subchannel_staged`, `function css_sch_create_locks`, `function css_subchannel_release`, `function css_validate_subchannel`, `function css_sch_device_register`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.