Example #1
0
static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
{
	struct port *port = get_port_by_tty(tty);
	struct nozomi *dc = get_dc_by_tty(tty);
	int ret;
	if (!port || !dc || dc->state != NOZOMI_STATE_READY)
		return -ENODEV;
	ret = tty_standard_install(driver, tty);
	if (ret == 0)
		tty->driver_data = port;
	return ret;
}
Example #2
0
static int gdm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
{
	struct gdm *gdm = NULL;
	int ret;
	int i;
	int j;

	j = GDM_TTY_MINOR;
	for (i = 0; i < TTY_MAX_COUNT; i++) {
		if (!strcmp(tty->driver->driver_name, DRIVER_STRING[i])) {
			j = tty->index;
			break;
		}
	}

	if (j == GDM_TTY_MINOR)
		return -ENODEV;

	mutex_lock(&gdm_table_lock);
	gdm = gdm_table[i][j];
	if (gdm == NULL) {
		mutex_unlock(&gdm_table_lock);
		return -ENODEV;
	}

	tty_port_get(&gdm->port);

	ret = tty_standard_install(driver, tty);
	if (ret) {
		tty_port_put(&gdm->port);
		mutex_unlock(&gdm_table_lock);
		return ret;
	}

	tty->driver_data = gdm;
	mutex_unlock(&gdm_table_lock);

	return 0;
}
Example #3
0
static int acm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
{
	struct acm *acm;
	int retval;

	dev_dbg(tty->dev, "%s\n", __func__);

	acm = acm_get_by_index(tty->index);
	if (!acm)
		return -ENODEV;

	retval = tty_standard_install(driver, tty);
	if (retval)
		goto error_init_termios;

	tty->driver_data = acm;

	return 0;

error_init_termios:
	tty_port_put(&acm->port);
	return retval;
}