static int hwc_tty_write (struct tty_struct *tty, int from_user, const unsigned char *buf, int count) { int retval; if (hwc_tty_data.buf_count > 0) { hwc_write (0, hwc_tty_data.buf, hwc_tty_data.buf_count); hwc_tty_data.buf_count = 0; } retval = hwc_write (from_user, buf, count); return retval; }
static void hwc_tty_flush_chars (struct tty_struct *tty) { unsigned long flags; spin_lock_irqsave (&hwc_tty_data.lock, flags); hwc_write (0, hwc_tty_data.buf, hwc_tty_data.buf_count); hwc_tty_data.buf_count = 0; spin_unlock_irqrestore (&hwc_tty_data.lock, flags); }
static void hwc_tty_put_char (struct tty_struct *tty, unsigned char ch) { unsigned long flags; spin_lock_irqsave (&hwc_tty_data.lock, flags); if (hwc_tty_data.buf_count >= HWC_TTY_BUF_SIZE) { hwc_write (0, hwc_tty_data.buf, hwc_tty_data.buf_count); hwc_tty_data.buf_count = 0; } hwc_tty_data.buf[hwc_tty_data.buf_count] = ch; hwc_tty_data.buf_count++; spin_unlock_irqrestore (&hwc_tty_data.lock, flags); }
void hwc_console_write ( struct console *console, const char *message, unsigned int count) { if (console->device (console) != hwc_console.device (&hwc_console)) { hwc_printk (KERN_WARNING HWC_CON_PRINT_HEADER "hwc_console_write() called with wrong " "device number"); return; } hwc_write (0, message, count); }