drivers/s390/cio/device_fsm.c
Source file repositories/reference/linux-study-clean/drivers/s390/cio/device_fsm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/cio/device_fsm.c- Extension
.c- Size
- 31450 bytes
- Lines
- 1130
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/module.hlinux/init.hlinux/io.hlinux/jiffies.hlinux/string.hasm/ccwdev.hasm/cio.hasm/chpid.hcio.hcio_debug.hcss.hdevice.hchsc.hioasm.hchp.h
Detected Declarations
function ccw_timeout_log_setupfunction ccw_timeout_logfunction ccw_device_timeoutfunction ccw_device_set_timeoutfunction ccw_device_cancel_halt_clearfunction ccw_device_update_sense_datafunction ccw_device_test_sense_datafunction magicfunction ccw_device_recog_donefunction ccw_device_sense_id_donefunction ccw_device_notifyfunction ccw_device_oper_notifyfunction ccw_device_donefunction ccw_device_recognitionfunction ccw_device_request_eventfunction ccw_device_report_path_eventsfunction ccw_device_reset_path_eventsfunction create_fake_irbfunction ccw_device_handle_broken_pathsfunction ccw_device_verify_donefunction ccw_device_onlinefunction ccw_device_disband_donefunction ccw_device_offlinefunction ccw_device_generic_notoperfunction ccw_device_offline_verifyfunction ccw_device_online_verifyfunction ccw_device_boxed_verifyfunction ccw_device_call_handlerfunction iofunction ccw_device_online_timeoutfunction ccw_device_w4sensefunction ccw_device_killing_irqfunction ccw_device_killing_timeoutfunction ccw_device_kill_iofunction ccw_device_delay_verifyfunction ccw_device_start_idfunction ccw_device_trigger_reprobefunction ccw_device_disabled_irqfunction ccw_device_change_cmfstatefunction ccw_device_update_cmfblockfunction ccw_device_quiesce_donefunction ccw_device_quiesce_timeoutfunction ccw_device_nopexport ccw_device_set_timeout
Annotated Snippet
if (!cdev->online) {
ccw_device_update_sense_data(cdev);
break;
}
cdev->private->state = DEV_STATE_OFFLINE;
cdev->private->flags.recog_done = 1;
if (ccw_device_test_sense_data(cdev)) {
cdev->private->flags.donotify = 1;
ccw_device_online(cdev);
wake_up(&cdev->private->wait_q);
} else {
ccw_device_update_sense_data(cdev);
ccw_device_sched_todo(cdev, CDEV_TODO_REBIND);
}
return;
case DEV_STATE_BOXED:
if (cdev->id.cu_type != 0) { /* device was recognized before */
cdev->private->flags.recog_done = 1;
cdev->private->state = DEV_STATE_BOXED;
wake_up(&cdev->private->wait_q);
return;
}
break;
}
cdev->private->state = state;
io_subchannel_recog_done(cdev);
wake_up(&cdev->private->wait_q);
}
/*
* Function called from device_id.c after sense id has completed.
*/
void
ccw_device_sense_id_done(struct ccw_device *cdev, int err)
{
switch (err) {
case 0:
ccw_device_recog_done(cdev, DEV_STATE_OFFLINE);
break;
case -ETIME: /* Sense id stopped by timeout. */
ccw_device_recog_done(cdev, DEV_STATE_BOXED);
break;
default:
ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER);
break;
}
}
/**
* ccw_device_notify() - inform the device's driver about an event
* @cdev: device for which an event occurred
* @event: event that occurred
*
* Returns:
* -%EINVAL if the device is offline or has no driver.
* -%EOPNOTSUPP if the device's driver has no notifier registered.
* %NOTIFY_OK if the driver wants to keep the device.
* %NOTIFY_BAD if the driver doesn't want to keep the device.
*/
int ccw_device_notify(struct ccw_device *cdev, int event)
{
int ret = -EINVAL;
if (!cdev->drv)
goto out;
if (!cdev->online)
goto out;
CIO_MSG_EVENT(2, "notify called for 0.%x.%04x, event=%d\n",
cdev->private->dev_id.ssid, cdev->private->dev_id.devno,
event);
if (!cdev->drv->notify) {
ret = -EOPNOTSUPP;
goto out;
}
if (cdev->drv->notify(cdev, event))
ret = NOTIFY_OK;
else
ret = NOTIFY_BAD;
out:
return ret;
}
static void ccw_device_oper_notify(struct ccw_device *cdev)
{
struct subchannel *sch = to_subchannel(cdev->dev.parent);
if (ccw_device_notify(cdev, CIO_OPER) == NOTIFY_OK) {
/* Re-enable channel measurements, if needed. */
ccw_device_sched_todo(cdev, CDEV_TODO_ENABLE_CMF);
/* Save indication for new paths. */
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/init.h`, `linux/io.h`, `linux/jiffies.h`, `linux/string.h`, `asm/ccwdev.h`, `asm/cio.h`.
- Detected declarations: `function ccw_timeout_log_setup`, `function ccw_timeout_log`, `function ccw_device_timeout`, `function ccw_device_set_timeout`, `function ccw_device_cancel_halt_clear`, `function ccw_device_update_sense_data`, `function ccw_device_test_sense_data`, `function magic`, `function ccw_device_recog_done`, `function ccw_device_sense_id_done`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: integration 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.