patch-2.3.43 linux/drivers/char/bttv.c

Next file: linux/drivers/char/busmouse.c
Previous file: linux/drivers/char/applicom.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/drivers/char/bttv.c linux/drivers/char/bttv.c
@@ -1765,6 +1765,14 @@
 	return count;
 }
 
+static inline void burst(int on)
+{
+	tvnorms[0].scaledtwidth = 1135 - (on?BURSTOFFSET-2:0);
+	tvnorms[0].hdelayx1     = 186  - (on?BURSTOFFSET  :0);
+	tvnorms[2].scaledtwidth = 1135 - (on?BURSTOFFSET-2:0);
+	tvnorms[2].hdelayx1     = 186  - (on?BURSTOFFSET  :0);
+}
+
 /*
  *	Open a bttv card. Right now the flags stuff is just playing
  */
@@ -1775,6 +1783,7 @@
         int i,ret;
 
 	ret = -EBUSY;
+	down(&btv->lock);
 	if (btv->user)
 		goto out_unlock;
 	
@@ -1789,6 +1798,7 @@
         for (i = 0; i < MAX_GBUFFERS; i++)
                 btv->frame_stat[i] = GBUFFER_UNUSED;
 
+        burst(0);
         btv->user++;
 	up(&btv->lock);
         MOD_INC_USE_COUNT;
@@ -2454,19 +2464,13 @@
 		
 	case BTTV_BURST_ON:
 	{
-		tvnorms[0].scaledtwidth=1135-BURSTOFFSET-2;
-		tvnorms[0].hdelayx1=186-BURSTOFFSET;
-		tvnorms[2].scaledtwidth=1135-BURSTOFFSET-2;
-		tvnorms[2].hdelayx1=186-BURSTOFFSET;
+		burst(1);
 		return 0;
 	}
 
 	case BTTV_BURST_OFF:
 	{
-		tvnorms[0].scaledtwidth=1135;
-		tvnorms[0].hdelayx1=186;
-		tvnorms[2].scaledtwidth=1135;
-		tvnorms[2].hdelayx1=186;
+		burst(0);
 		return 0;
 	}
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)