drivers/s390/char/sclp_con.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/sclp_con.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/sclp_con.c- Extension
.c- Size
- 7950 bytes
- Lines
- 315
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/kmod.hlinux/console.hlinux/init.hlinux/panic_notifier.hlinux/timer.hlinux/jiffies.hlinux/termios.hlinux/err.hlinux/reboot.hlinux/gfp.hsclp.hsclp_rw.hsclp_tty.h
Detected Declarations
function sclp_conbuf_callbackfunction sclp_conbuf_emitfunction sclp_console_sync_queuefunction sclp_console_timeoutfunction sclp_console_drop_bufferfunction sclp_console_writefunction sclp_console_devicefunction sclp_console_notifyfunction __sclp_console_free_pagesfunction list_for_each_safefunction console_init
Annotated Snippet
if (!buffer) {
sclp_con_queue_running = 0;
spin_unlock_irqrestore(&sclp_con_lock, flags);
break;
}
spin_unlock_irqrestore(&sclp_con_lock, flags);
} while (sclp_emit_buffer(buffer, sclp_conbuf_callback));
}
/*
* Finalize and emit first pending buffer.
*/
static void sclp_conbuf_emit(void)
{
struct sclp_buffer* buffer;
unsigned long flags;
int rc;
spin_lock_irqsave(&sclp_con_lock, flags);
if (sclp_conbuf)
list_add_tail(&sclp_conbuf->list, &sclp_con_outqueue);
sclp_conbuf = NULL;
if (sclp_con_queue_running)
goto out_unlock;
if (list_empty(&sclp_con_outqueue))
goto out_unlock;
buffer = list_first_entry(&sclp_con_outqueue, struct sclp_buffer,
list);
sclp_con_queue_running = 1;
spin_unlock_irqrestore(&sclp_con_lock, flags);
rc = sclp_emit_buffer(buffer, sclp_conbuf_callback);
if (rc)
sclp_conbuf_callback(buffer, rc);
return;
out_unlock:
spin_unlock_irqrestore(&sclp_con_lock, flags);
}
/*
* Wait until out queue is empty
*/
static void sclp_console_sync_queue(void)
{
unsigned long flags;
spin_lock_irqsave(&sclp_con_lock, flags);
timer_delete(&sclp_con_timer);
while (sclp_con_queue_running) {
spin_unlock_irqrestore(&sclp_con_lock, flags);
sclp_sync_wait();
spin_lock_irqsave(&sclp_con_lock, flags);
}
spin_unlock_irqrestore(&sclp_con_lock, flags);
}
/*
* When this routine is called from the timer then we flush the
* temporary write buffer without further waiting on a final new line.
*/
static void
sclp_console_timeout(struct timer_list *unused)
{
sclp_conbuf_emit();
}
/*
* Drop oldest console buffer if sclp_con_drop is set
*/
static int
sclp_console_drop_buffer(void)
{
struct list_head *list;
struct sclp_buffer *buffer;
void *page;
if (!sclp_console_drop)
return 0;
list = sclp_con_outqueue.next;
if (sclp_con_queue_running)
/* The first element is in I/O */
list = list->next;
if (list == &sclp_con_outqueue)
return 0;
list_del(list);
buffer = list_entry(list, struct sclp_buffer, list);
page = sclp_unmake_buffer(buffer);
list_add_tail((struct list_head *) page, &sclp_con_pages);
return 1;
}
Annotation
- Immediate include surface: `linux/kmod.h`, `linux/console.h`, `linux/init.h`, `linux/panic_notifier.h`, `linux/timer.h`, `linux/jiffies.h`, `linux/termios.h`, `linux/err.h`.
- Detected declarations: `function sclp_conbuf_callback`, `function sclp_conbuf_emit`, `function sclp_console_sync_queue`, `function sclp_console_timeout`, `function sclp_console_drop_buffer`, `function sclp_console_write`, `function sclp_console_device`, `function sclp_console_notify`, `function __sclp_console_free_pages`, `function list_for_each_safe`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source 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.