コード例 #1
0
ファイル: ser_a2232.c プロジェクト: patrick-ken/kernel_808l
static int  a2232_open(struct tty_struct * tty, struct file * filp)
{
/* More or less stolen from other drivers. */
	int line;
	int retval;
	struct a2232_port *port;

	line = tty->index;
	port = &a2232_ports[line];
	
	tty->driver_data = port;
	port->gs.port.tty = tty;
	port->gs.port.count++;
	retval = gs_init_port(&port->gs);
	if (retval) {
		port->gs.port.count--;
		return retval;
	}
	port->gs.port.flags |= GS_ACTIVE;
	retval = gs_block_til_ready(port, filp);

	if (retval) {
		port->gs.port.count--;
		return retval;
	}

	a2232_enable_rx_interrupts(port);
	
	return 0;
}
コード例 #2
0
static int  a2232_open(struct tty_struct * tty, struct file * filp)
{
/* More or less stolen from other drivers. */
	int line;
	int retval;
	struct a2232_port *port;

	line = MINOR(tty->device);
	port = &a2232_ports[line];
	
	tty->driver_data = port;
	port->gs.tty = tty;
	port->gs.count++;
	retval = gs_init_port(&port->gs);
	if (retval) {
		port->gs.count--;
		return retval;
	}
	port->gs.flags |= GS_ACTIVE;
	if (port->gs.count == 1) {
		MOD_INC_USE_COUNT;
	}
	retval = gs_block_til_ready(port, filp);

	if (retval) {
		MOD_DEC_USE_COUNT;
		port->gs.count--;
		return retval;
	}

	if ((port->gs.count == 1) && (port->gs.flags & ASYNC_SPLIT_TERMIOS)){
		if (tty->driver.subtype == A2232_TTY_SUBTYPE_NORMAL)
			*tty->termios = port->gs.normal_termios;
		else 
			*tty->termios = port->gs.callout_termios;
		a2232_set_real_termios (port);
	}

	port->gs.session = current->session;
	port->gs.pgrp = current->pgrp;

	a2232_enable_rx_interrupts(port);
	
	return 0;
}