kernels/linux-2.4.0/drivers/media/video/bttv-driver.c
/*
 *	Open a bttv card. Right now the flags stuff is just playing
 */
Open a bttv card. Right now the flags stuff is just playing
Open a bttv card . Right now the flags stuff is just playing
static int bttv_open(struct video_device *dev, int flags)
{
	struct bttv *btv = (struct bttv *)dev;
        int i,ret;
	ret = -EBUSY;
	if (bttv_debug)
		printk("bttv%d: open called\n",btv->nr);
	MOD_INC_USE_COUNT;
	down(&btv->lock);
	if (btv->user)
		goto out_unlock;
	btv->fbuffer=(unsigned char *) rvmalloc(gbuffers*gbufsize);
	ret = -ENOMEM;
	if (!btv->fbuffer)
		goto out_unlock;
        btv->gq_in = 0;
        btv->gq_out = 0;
	btv->gq_grab = -1;
        for (i = 0; i < gbuffers; i++)
                btv->gbuf[i].stat = GBUFFER_UNUSED;
	if (btv->needs_restart)
		bt848_restart(btv);
        burst(0);
	set_pll(btv);
        btv->user++;
	up(&btv->lock);
        return 0;
 out_unlock:
	up(&btv->lock);
	MOD_DEC_USE_COUNT;
	return ret;
}
static int bttv_open ( struct video_device * dev , int flags ) { struct bttv * btv = ( struct bttv * ) dev ; int i , ret ; ret = - EBUSY ; if ( bttv_debug ) printk ( " \n " , btv -> nr ) ; MOD_INC_USE_COUNT ; down ( & btv -> lock ) ; if ( btv -> user ) goto out_unlock ; btv -> fbuffer = ( unsigned char * ) rvmalloc ( gbuffers * gbufsize ) ; ret = - ENOMEM ; if ( ! btv -> fbuffer ) goto out_unlock ; btv -> gq_in = 0 ; btv -> gq_out = 0 ; btv -> gq_grab = -1 ; for ( i = 0 ; i < gbuffers ; i ++ ) btv -> gbuf [ i ] . stat = GBUFFER_UNUSED ; if ( btv -> needs_restart ) bt848_restart ( btv ) ; burst ( 0 ) ; set_pll ( btv ) ; btv -> user ++ ; up ( & btv -> lock ) ; return 0 ; out_unlock : up ( & btv -> lock ) ; MOD_DEC_USE_COUNT ; return ret ; }
Open a bttv card.
Open a bttv card .