static void tpk_close(struct tty_struct *tty, struct file *filp) { struct ttyprintk_port *tpkp = tty->driver_data; mutex_lock(&tpkp->port_write_mutex); tpk_printk(NULL, 0); mutex_unlock(&tpkp->port_write_mutex); tty_port_close(&tpkp->port, tty, filp); }
static int tpk_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct ttyprintk_port *tpkp = tty->driver_data; int ret; mutex_lock(&tpkp->port_write_mutex); ret = tpk_printk(buf, count); mutex_unlock(&tpkp->port_write_mutex); return ret; }
/* * TTY operations close function. */ static void tpk_close(struct tty_struct *tty, struct file *filp) { struct ttyprintk_port *tpkp = tty->driver_data; mutex_lock(&tpkp->port_write_mutex); /* flush tpk_printk buffer */ #ifdef CONFIG_DEBUG_PRINTK tpk_printk(NULL, 0); #else tpk_; #endif mutex_unlock(&tpkp->port_write_mutex); tty_port_close(&tpkp->port, tty, filp); }
/* * TTY operations write function. */ static int tpk_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct ttyprintk_port *tpkp = tty->driver_data; int ret; /* exclusive use of tpk_printk within this tty */ mutex_lock(&tpkp->port_write_mutex); #ifdef CONFIG_DEBUG_PRINTK ret = tpk_printk(buf, count); #else ret = tpk_; #endif mutex_unlock(&tpkp->port_write_mutex); return ret; }