kernels/linux-2.4.0/drivers/s390/char/con3215.c
/*
 * tty3215_open
 *
 * This routine is called whenever a 3215 tty is opened.
 */
tty3215_open
This routine is called whenever a 3215 tty is opened.
tty3215_open This routine is called whenever a 3215 tty is opened .
static int tty3215_open(struct tty_struct *tty, struct file * filp)
{
	raw3215_info *raw;
	int retval, line;
	line = MINOR(tty->device) - tty->driver.minor_start;
	if ((line < 0) || (line >= NR_3215))
		return -ENODEV;
	raw = raw3215[line];
	if (raw == NULL) {
		raw = kmalloc(sizeof(raw3215_info) +
			      RAW3215_INBUF_SIZE, GFP_KERNEL);
		if (raw == NULL)
			return -ENOMEM;
		raw->irq = raw3215_find_dev(line);
		if (raw->irq == -1) {
			kfree(raw);
			return -ENODEV;
		}
		raw->inbuf = (char *) raw + sizeof(raw3215_info);
		memset(raw, 0, sizeof(raw3215_info));
		raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, GFP_KERNEL);
		if (raw->buffer == NULL) {
			kfree(raw);
			return -ENOMEM;
		}
		raw->tqueue.routine = raw3215_softint;
		raw->tqueue.data = raw;
                init_waitqueue_head(&raw->empty_wait);
		raw3215[line] = raw;
	}
	tty->driver_data = raw;
	raw->tty = tty;
	tty->low_latency = 0;  
	retval = raw3215_startup(raw);
	if (retval)
		return retval;
	return 0;
}
static int tty3215_open ( struct tty_struct * tty , struct file * filp ) { raw3215_info * raw ; int retval , line ; line = MINOR ( tty -> device ) - tty -> driver . minor_start ; if ( ( line < 0 ) || ( line >= NR_3215 ) ) return - ENODEV ; raw = raw3215 [ line ] ; if ( raw == NULL ) { raw = kmalloc ( sizeof ( raw3215_info ) + RAW3215_INBUF_SIZE , GFP_KERNEL ) ; if ( raw == NULL ) return - ENOMEM ; raw -> irq = raw3215_find_dev ( line ) ; if ( raw -> irq == -1 ) { kfree ( raw ) ; return - ENODEV ; } raw -> inbuf = ( char * ) raw + sizeof ( raw3215_info ) ; memset ( raw , 0 , sizeof ( raw3215_info ) ) ; raw -> buffer = ( char * ) kmalloc ( RAW3215_BUFFER_SIZE , GFP_KERNEL ) ; if ( raw -> buffer == NULL ) { kfree ( raw ) ; return - ENOMEM ; } raw -> tqueue . routine = raw3215_softint ; raw -> tqueue . data = raw ; init_waitqueue_head ( & raw -> empty_wait ) ; raw3215 [ line ] = raw ; } tty -> driver_data = raw ; raw -> tty = tty ; tty -> low_latency = 0 ; retval = raw3215_startup ( raw ) ; if ( retval ) return retval ; return 0 ; }
tty3215_open
 This routine is called whenever a 3215 tty is opened.
tty3215_open This routine is called whenever a 3215 tty is opened .
/* don't use bottom half for pushing chars */ /*
	 * Start up 3215 device
	 */