博客
关于我
tty open failed
阅读量:753 次
发布时间:2019-03-23

本文共 2712 字,大约阅读时间需要 9 分钟。

tty_open

   ->     if (tty) { retval = tty_reopen(tty);}

           ->

static int tty_reopen(struct tty_struct *tty)

{
    struct tty_driver *driver = tty->driver;
    if (test_bit(TTY_CLOSING, &tty->flags) ||
            test_bit(TTY_HUPPING, &tty->flags) ||
            test_bit(TTY_LDISC_CHANGING, &tty->flags))
        return -EIO;
    if (driver->type == TTY_DRIVER_TYPE_PTY &&
        driver->subtype == PTY_TYPE_MASTER) {
        /*
         * special case for PTY masters: only one open permitted,
         * and the slave side open count is incremented as well.
         */
        if (tty->count)
            return -EIO;
        tty->link->count++;
    }
    tty->count++;
    mutex_lock(&tty->ldisc_mutex);
    WARN_ON(!test_bit(TTY_LDISC, &tty->flags));
    mutex_unlock(&tty->ldisc_mutex);
    return 0;
}

/*---------------------------------------------------------------------------*/
static void smd_ch_irq_tasklet_handler(unsigned long data)
{
    unsigned char *ptr;
    int avail;
    struct tty_struct *tty;
    int index=data;
    unsigned long flags;
    struct smd_tty_info *tty_info = &driver_info->smd_tty[index];
    dbg("enter %s\n",__func__);
    spin_lock_irqsave(&driver_info->lock, flags);
    tty = tty_port_tty_get(&tty_info->port);
    if (!tty){
        spin_unlock_irqrestore(&driver_info->lock, flags);
        return;
    }
    avail = smd_stream_read_avail(tty_info->ch);
    if (!avail){
        spin_unlock_irqrestore(&driver_info->lock, flags);
        return;
    }
    avail = tty_prepare_flip_string(tty, &ptr, avail);
    if(!avail){
        spin_unlock_irqrestore(&driver_info->lock, flags);
        pr_err("smd_ch_irq_tasklet_handler: cannot get space from tty_buffer!\n");
        return;
    }
    smd_stream_read(tty_info->ch,ptr,avail);
    smd_send_intr(tty_info->a2b_int_rx);
    tty_flip_buffer_push(tty);
    tty_kref_put(tty);
    spin_unlock_irqrestore(&driver_info->lock, flags);
}
更改为:

/*---------------------------------------------------------------------------*/
static void smd_ch_irq_tasklet_handler(unsigned long data)
{
    unsigned char *ptr;
    int avail;
    struct tty_struct *tty;
    int index=data;
    unsigned long flags;
    struct smd_tty_info *tty_info = &driver_info->smd_tty[index];
    dbg("enter %s\n",__func__);
    spin_lock_irqsave(&driver_info->lock, flags);
    tty = tty_port_tty_get(&tty_info->port);
    if (!tty){
        spin_unlock_irqrestore(&driver_info->lock, flags);
        return;
    }
    avail = smd_stream_read_avail(tty_info->ch);
    if (!avail){
        tty_kref_put(tty);
        spin_unlock_irqrestore(&driver_info->lock, flags);
        return;
    }
    avail = tty_prepare_flip_string(tty, &ptr, avail);
    if(!avail){
        tty_kref_put(tty);
        spin_unlock_irqrestore(&driver_info->lock, flags);
        pr_err("smd_ch_irq_tasklet_handler: cannot get space from tty_buffer!\n");
        return;
    }
    smd_stream_read(tty_info->ch,ptr,avail);
    smd_send_intr(tty_info->a2b_int_rx);
    tty_flip_buffer_push(tty);
    tty_kref_put(tty);
    spin_unlock_irqrestore(&driver_info->lock, flags);
}
就是说tty_port_tty_get和tty_kref_put没有成对出现

具体的原因,有时间在填上。

转载地址:http://kekzk.baihongyu.com/

你可能感兴趣的文章
Mac book pro打开docker出现The data couldn’t be read because it is missing
查看>>
MAC M1大数据0-1成神篇-25 hadoop高可用搭建
查看>>
mac mysql 进程_Mac平台下启动MySQL到完全终止MySQL----终端八步走
查看>>
Mac OS 12.0.1 如何安装柯美287打印机驱动,刷卡打印
查看>>
MangoDB4.0版本的安装与配置
查看>>
Manjaro 24.1 “Xahea” 发布!具有 KDE Plasma 6.1.5、GNOME 46 和最新的内核增强功能
查看>>
mapping文件目录生成修改
查看>>
MapReduce程序依赖的jar包
查看>>
mariadb multi-source replication(mariadb多主复制)
查看>>
MariaDB的简单使用
查看>>
MaterialForm对tab页进行隐藏
查看>>
Member var and Static var.
查看>>
memcached高速缓存学习笔记001---memcached介绍和安装以及基本使用
查看>>
memcached高速缓存学习笔记003---利用JAVA程序操作memcached crud操作
查看>>
Memcached:Node.js 高性能缓存解决方案
查看>>
memcache、redis原理对比
查看>>
memset初始化高维数组为-1/0
查看>>
Metasploit CGI网关接口渗透测试实战
查看>>
Metasploit Web服务器渗透测试实战
查看>>
MFC模态对话框和非模态对话框
查看>>