drivers/s390/char/con3215.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/con3215.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/con3215.c- Extension
.c- Size
- 30361 bytes
- Lines
- 1191
- 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.
- 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/types.hlinux/kdev_t.hlinux/tty.hlinux/tty_flip.hlinux/vt_kern.hlinux/init.hlinux/console.hlinux/interrupt.hlinux/err.hlinux/panic_notifier.hlinux/reboot.hlinux/serial.hlinux/slab.hasm/machine.hasm/ccwdev.hasm/cio.hlinux/io.hasm/ebcdic.hlinux/uaccess.hasm/delay.hasm/cpcmd.hasm/setup.hctrlchar.h
Detected Declarations
struct raw3215_reqstruct raw3215_infoenum raw3215_typefunction raw3215_free_reqfunction raw3215_mk_read_reqfunction raw3215_mk_write_reqfunction raw3215_start_iofunction raw3215_timeoutfunction raw3215_try_iofunction raw3215_next_iofunction raw3215_irqfunction raw3215_dropfunction raw3215_make_roomfunction raw3215_addtextfunction raw3215_writefunction raw3215_putcharfunction raw3215_flush_bufferfunction raw3215_startupfunction raw3215_shutdownfunction raw3215_free_infofunction raw3215_probefunction raw3215_removefunction raw3215_set_onlinefunction raw3215_set_offlinefunction con_drop_storefunction con_drop_showfunction handle_writefunction con3215_writefunction spin_trylockfunction console_initfunction tty3215_installfunction tty3215_openfunction tty3215_closefunction tty3215_write_roomfunction tty3215_writefunction tty3215_put_charfunction tty3215_flush_charsfunction tty3215_flush_bufferfunction tty3215_throttlefunction tty3215_unthrottlefunction tty3215_stopfunction tty3215_startfunction con3215_setup_dropfunction tty_initmodule init tty3215_init
Annotated Snippet
static ssize_t con_drop_store(struct device_driver *dev, const char *buf, size_t count)
{
bool drop;
int rc;
rc = kstrtobool(buf, &drop);
if (!rc)
con3215_drop = drop;
return rc ?: count;
}
static ssize_t con_drop_show(struct device_driver *dev, char *buf)
{
return sysfs_emit(buf, "%d\n", con3215_drop ? 1 : 0);
}
static DRIVER_ATTR_RW(con_drop);
static struct attribute *con3215_drv_attrs[] = {
&driver_attr_con_drop.attr,
NULL,
};
static struct attribute_group con3215_drv_attr_group = {
.attrs = con3215_drv_attrs,
};
static const struct attribute_group *con3215_drv_attr_groups[] = {
&con3215_drv_attr_group,
NULL,
};
static struct ccw_driver raw3215_ccw_driver = {
.driver = {
.name = "3215",
.groups = con3215_drv_attr_groups,
.owner = THIS_MODULE,
},
.ids = raw3215_id,
.probe = &raw3215_probe,
.remove = &raw3215_remove,
.set_online = &raw3215_set_online,
.set_offline = &raw3215_set_offline,
.int_class = IRQIO_C15,
};
static void handle_write(struct raw3215_info *raw, const u8 *str, size_t count)
{
while (count > 0) {
size_t i = min_t(size_t, count, RAW3215_BUFFER_SIZE - 1);
raw3215_write(raw, str, i);
count -= i;
str += i;
}
}
#ifdef CONFIG_TN3215_CONSOLE
/*
* Write a string to the 3215 console
*/
static void con3215_write(struct console *co, const char *str, unsigned int count)
{
handle_write(raw3215[0], str, count);
}
static struct tty_driver *con3215_device(struct console *c, int *index)
{
*index = c->index;
return tty3215_driver;
}
/*
* The below function is called as a panic/reboot notifier before the
* system enters a disabled, endless loop.
*
* Notice we must use the spin_trylock() alternative, to prevent lockups
* in atomic context (panic routine runs with secondary CPUs, local IRQs
* and preemption disabled).
*/
static int con3215_notify(struct notifier_block *self,
unsigned long event, void *data)
{
struct raw3215_info *raw;
unsigned long flags;
raw = raw3215[0]; /* console 3215 is the first one */
if (!spin_trylock_irqsave(get_ccwdev_lock(raw->cdev), flags))
return NOTIFY_DONE;
raw3215_make_room(raw, RAW3215_BUFFER_SIZE, false);
spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
Annotation
- Immediate include surface: `linux/types.h`, `linux/kdev_t.h`, `linux/tty.h`, `linux/tty_flip.h`, `linux/vt_kern.h`, `linux/init.h`, `linux/console.h`, `linux/interrupt.h`.
- Detected declarations: `struct raw3215_req`, `struct raw3215_info`, `enum raw3215_type`, `function raw3215_free_req`, `function raw3215_mk_read_req`, `function raw3215_mk_write_req`, `function raw3215_start_io`, `function raw3215_timeout`, `function raw3215_try_io`, `function raw3215_next_io`.
- 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.
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.