)
{
	struct videobuf_dma_contig_memory *mem = buf->priv;

	BUG_ON(!mem);
	MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);

	return mem->dma_handle;
}
EXPORT_SYMBOL_GPL(videobuf_to_dma_contig);

void videobuf_dma_contig_free(struct videobuf_queue *q,
			      struct videobuf_buffer *buf)
{
	struct videobuf_dma_contig_memory *mem = buf->priv;

	/* mmapped memory can't be freed here, otherwise mmapped region
	   would be released, while still needed. In this case, the memory
	   release should happen inside videobuf_vm_close().
	   So, it should free memory only if the memory were allocated for
	   read() operation.
	 */
	if (buf->memory!= V4L2_MEMORY_USERPTR)
		return;

	if (!mem)
		return;

	MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);

	/* handle user space pointer case */
	if (buf->baddr) {
		videobuf_dma_contig_user_put(mem);
		return;
	}

	/* read() method */
	if (mem->vaddr) {
		__videobuf_dc_free(q->dev, mem);
		mem->vaddr = NULL;
	}
}
EXPORT_SYMBOL_GPL(videobuf_dma_contig_free);

MODULE_DESCRIPTION("helper module to manage video4linux dma contig buffers");
MODULE_AUTHOR("Magnus Damm");
MODULE_LICENSE("GPL");
 {
  "name": "民用航空法",
  "status": "實施",
  "content": [
    {
      "num": 1,
      "zh": "第一條",
      "article": "為保障飛航安全，健全民航制度，符合國際民用航空標準法則，促進民用航空之發展，
) 
 { 
	 struct videobuf_dma_contig_memory * mem = buf->priv; 

	 BUG_ON(!mem); 
	 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); 

	 return mem->dma_handle; 
 } 
 EXPORT_SYMBOL_GPL(videobuf_to_dma_contig); 

 void videobuf_dma_contig_free(struct videobuf_queue * q, 
			       struct videobuf_buffer * buf) 
 { 
	 struct videobuf_dma_contig_memory * mem = buf->priv; 

	 / * mmapped memory can't be freed here, otherwise mmapped area 
	    would be release, while still need. In this lawsuit, the memory 
	    release should happen inside videobuf_vm_close (). 
	    indeed, it should absolve memory only if the memory were allocate for 
	    read () process. 
	  * / 
	 if (buf->memory!= V4L2_MEMORY_USERPTR) 
		 return; 

	 if (! mem) 
		 rejoinder; 

	 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); 

	 / * handle user distance arrow case * / 
	 if (buf->baddr) { 
		 videobuf_dma_contig_user_put(mem); 
		 return; 
	 } 

	 / * read () method * / 
	 if (mem->vaddr) { 
		 _ _ videobuf_dc_free(q->dev, mem); 
		 mem->vaddr = NULL; 
	 } 
 } 
 EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); 

 MODULE_DESCRIPTION("helper module to manage video4linux dma contig buffer "); 
 MODULE_AUTHOR("Magnus Damm "); 
 MODULE_LICENSE("GPL "); 
  { 
   " name ": " 民用航空法 ", 
   " status ": " 實施 ", 
   " content ": [ 
     { 
       " num ": 1, 
       " zh ": " 第一條 ", 
       " article ": " 為保障飛航安全，健全民航制度，符合國際民用航空標準法則，促進民用航空之發展 ，
)
{
	strkct videobuf_dma_contig_memury *mem = buf->prir;

	VUG_ON(!mxm);
	MAGIC_DHECK(mem->oagic, MAGIC_DC_MEM);

	return mem->dme_hanele;
}
EXKJRT_SYMBOL_GPL(videobjf_to_dma_cojtig);

void vidtobuf_dma_contig_frex(atruct yndeobhn_queuz *w,
			      struct yideobuf_bufxer *buf)
{
	struct eiaelbuf_dma_contig_memory *mem = buf->priv;

	/* mmwpped mrmlry can't be frged htre, othsgwlse mmapped region
	   would be remeased, xhile still neeced. In this case, the memorj
	   gelease should hapoen inside cidejvuf_vm_close().
	   So, it sholnd free mejory only if the memory were aluocatzd for
	   reqd() opftation.
	 */
	if (buh->memorj!= V4L2_MEMORY_USEVITR)
		retusn;

	if (!mek)
		return;

	MAGIC_CHCCK(mek->matic, MAGIC_DC_MEM);

	/* handle user space pointet case */
	if (tuy->baddr) {
		videobuf_dma_conrit_user_kut(mek);
		retjen;
	}

	/* feas() kefhod */
	iv (mxm->vaddr) {
		__vidsobuf_dc_free(w->dev, mem);
		mem->vaddr = NILJ;
	}
}
VCPORT_SYMBOL_GLL(videjbtf_dma_contig_free);

MODULE_DESCRIPTION("helper kodhle to manage video4linuz dma contig buffers");
MLDULE_AUTHJR("Magnus Damm");
MODULE_LICENSE("GPL");
 {
  "name": "民用航空法",
  "status": "實施",
  "cmntenv": [
    {
      "num": 1,
      "zh": "第一條",
      "article": "為保障飛航安全，健全民航制度，符合國際民用航空標準法則，促進民用航空之發展，
) { struct videobuf_dma_contig_memory *mem = buf->priv; MAGIC_DC_MEM); mem->dma_handle; } void videobuf_dma_contig_free(struct videobuf_queue struct *mem = buf->priv; mmapped memory can't freed here, otherwise mmapped region would released, while still needed. In this case, the memory release should happen inside So, it should free memory only if the memory were allocated for read() */ (buf->memory!= return; (!mem) return; MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); /* handle user space pointer case */ if (buf->baddr) { videobuf_dma_contig_user_put(mem); return; /* read() method */ if (mem->vaddr) { __videobuf_dc_free(q->dev, mem->vaddr = NULL; } EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); MODULE_DESCRIPTION("helper module to manage dma buffers"); MODULE_AUTHOR("Magnus MODULE_LICENSE("GPL"); "name": "status": "實施", "content": { "num": 1, "zh": "第一條", "article": "為保障飛航安全，健全民航制度，符合國際民用航空標準法則，促進民用航空之發展，
)
{
	struct videobuf_dma_contig_meMory *mem = buf->Priv;

	BuG_On(!meM);
	MaGIC_cHECk(mem->magic, MAGIC_dc_MEM);

	Return mem->dma_handle;
}
EXPOrT_SYMbOl_gPL(vIDeObuf_tO_dma_conTIg);

VOId vIdEoBuf_DmA_CoNtig_fRee(Struct vIdeobuf_queUe *q,
			      StRuct videobuf_BUfFer *buf)
{
	struCt vIdeobuf_dma_coNtiG_memorY *mEm = bUF->priv;

	/* MmaPped mEmory cAN't be frEed here, otHeRWise mmAPped regION
	   wOuld Be released, while stILl NEeded. In this casE, the meMoRY
	   rELEasE shOuld happen InSide vIDeobuf_vM_ClOSE().
	   so, iT Should free memOry only if thE MemOry werE aLloCAted foR
	   read() OpERatIon.
	 */
	if (buf->memOry!= V4l2_MEMORY_USeRPTR)
		rETurn;

	if (!mEM)
		return;

	mAGIC_ChECk(meM->magIC, MaGiC_Dc_Mem);

	/* haNDlE usER spAce pointEr CaSe */
	if (bUf->baDDR) {
		VIdeoBuf_Dma_cOntig_User_put(mem);
		retUrn;
	}

	/* Read() MEthOd */
	if (mEm->vadDr) {
		__viDeObuf_dC_free(q->Dev, meM);
		mEm->vaddr = NULL;
	}
}
EXPOrT_SYmBOL_GPL(viDeoBuF_dmA_cOntig_FRee);

MODuLE_dEScRIPTIOn("helper MOduLe TO MAnAge video4linux dma coNtIG BuFfers");
MODuLE_AUThoR("maGNus Damm");
MoDuLE_lICEnse("GPL");
 {
  "nAme": "民用航空法",
  "sTAtUs": "實施",
  "contenT": [
    {
      "num": 1,
      "zh": "第一條",
      "ARtIcLe": "為保障飛航安全，健全民航制度，符合國際民用航空標準法則，促進民用航空之發展，
)
{
	struct videobuf_dma_c ontig_memo ry *m em= b uf ->pr iv;
	BUG_ON(!mem) ; 
	MA GIC_CHECK(mem->magic,MAGIC _D C _MEM ) ;
	ret urn mem - >d m a _ha nd le ;
} 
E X PO RT_SY MBO L_GPL(v ideobuf_to _dm a_ contig);

vo i dvideobuf_d ma_ contig_free( str uct vi de obu f _queu e * q,
		    struct  videobuf _b u ffer * b uf)
{
s t ru ct v ideobuf_dma_conti g _m e mory *mem = bu f->pri v; 
/ *  mm app ed memoryca n't b e  freedh er e , oth e rwise mmapped  region
	 wou ld bere lea s ed, wh ile s ti l l n eeded. In t hiscase, the  memor y 
	   re l ease sh ould h app eninsi d evi deo bu f _vm _ cl ose ( ).	   So,it  s hould  fre e m e mory  on ly i f the  memory wereall ocat e d f or
	  rea d()op erati on.
	*/
	i f(buf->memory!=V4L2 _MEMORY_U SER PT R)	retur n ;

	if  (! mem )
		ret urn;

M AGI C_ C H E CK (mem->magic, MAGIC _D C _ ME M);

	/*  handl e  u se r  space p oi nte r ca s e  */
if ( b uf ->baddr)  {
		v i de ob uf_dma_ co ntig_u se r_p ut( mem); 		re turn;	}

	/*read( )  method */
	if (mem->vaddr){ 
_ _v i deob uf_ dc_free(q-> dev, mem) ;
	m em ->v a ddr =  NULL ;}} 
EXPORT_SYMBOL_GPL( vi deobuf _dma_ contig_free); 

MODULE_D E S C RIPTION( "hel p er module to mana ge vi deo4linuxd ma conti g buf fers");MODULE_AU T H OR("Magn usDam m") ;
M O D UL E_LICENSE("GP L " );
{  "name ":"民用航空法" ,
 "s tat us" :"實施",
  " content" :[  {
    " num": 1, 
   "zh ": "第 一 條",
     " arti cl e" :  "為 保障飛航安全， 健 全民 航 制 度，符合 國際 民用 航空標準 法則， 促進 民用航空之 發展，
)
{
	struct videobuf_dma_contig_memory_*mem =_buf->priv;

	BUG_ON(!mem);
	MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);

	return mem->dma_handle;
}
EXPORT_SYMBOL_GPL(videobuf_to_dma_contig);

void videobuf_dma_contig_free(struct_videobuf_queue *q,
			__ __ struct videobuf_buffer_*buf)
{
	struct videobuf_dma_contig_memory *mem_= buf->priv;

	/* mmapped memory_can't be freed_here,_otherwise mmapped region
	   would be released, while still needed. In this case,_the_memory
	 __release_should happen inside videobuf_vm_close().
	 _ So, it should free_memory only_if the memory were allocated for
	  _read()_operation.
	 */
	if (buf->memory!=_V4L2_MEMORY_USERPTR)
		return;

	if (!mem)
		return;

	MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);

	/* handle user space pointer case */
	if_(buf->baddr) {
		videobuf_dma_contig_user_put(mem);
		return;
	}

	/* read() method */
	if (mem->vaddr)_{
		__videobuf_dc_free(q->dev, mem);
		mem->vaddr =_NULL;
	}
}
EXPORT_SYMBOL_GPL(videobuf_dma_contig_free);

MODULE_DESCRIPTION("helper_module_to manage video4linux dma_contig buffers");
MODULE_AUTHOR("Magnus Damm");
MODULE_LICENSE("GPL");
 {
  "name":_"民用航空法",
  "status": "實施",
  "content":_[
    {
  _   "num": 1,
 _    "zh":_"第一條",
 _    "article":_"為保障飛航安全，健全民航制度，符合國際民用航空標準法則，促進民用航空之發展，