コード例 #1
0
ファイル: smd_qmi.c プロジェクト: mustafak9/photon-android
static int qmi_open(struct inode *ip, struct file *fp)
{
	struct qmi_ctxt *ctxt = qmi_minor_to_ctxt(MINOR(ip->i_rdev));
	int r = 0;

	if (!ctxt) {
		printk(KERN_ERR "unknown qmi misc %d\n", MINOR(ip->i_rdev));
		return -ENODEV;
	}

	fp->private_data = ctxt;

	mutex_lock(&ctxt->lock);
	if (ctxt->ch == 0)
		r = smd_open(ctxt->ch_name, &ctxt->ch, ctxt, qmi_notify);
	if (r == 0)
		wake_up(&qmi_wait_queue);
	mutex_unlock(&ctxt->lock);

	return r;
}
コード例 #2
0
static int qmi_open(struct inode *ip, struct file *fp)
{
    struct qmi_ctxt *ctxt = qmi_minor_to_ctxt(MINOR(ip->i_rdev));
    int r = 0;

// TEST - disable GPRS
//	return -1;
    if (!ctxt) 
    {
        printk(KERN_ERR "unknown qmi misc %d\n", MINOR(ip->i_rdev));
        return -ENODEV;
    }
    DBG("open %s %d\n", ctxt->ch_name, ctxt->ch_num);

    fp->private_data = ctxt;

    mutex_lock(&ctxt->lock);

    if (ctrl_ch == NULL)
    {
        DBG("first open\n");
        r = smd_open("SMD_CONTROL", &ctrl_ch, ctxt, qmi_notify);		 
    }
    else
    {
        DBG("already opened\n");
        r = 0;
    }


    if (r == 0)
        wake_up(&qmi_wait_queue);
    mutex_unlock(&ctxt->lock);

    printk("-qmi_open %d\n", r);
    return r;
}