xserver: Branch 'master' - 9 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Sep 21 14:31:38 PDT 2011


 dix/dispatch.c                           |   18 
 hw/xfree86/common/xf86Globals.c          |    2 
 hw/xfree86/common/xf86Init.c             |   12 
 hw/xfree86/common/xf86Privstr.h          |    2 
 hw/xfree86/i2c/fi1236.c                  | 1002 ++++++++++++++++---------------
 hw/xfree86/man/Xorg.man                  |    7 
 hw/xfree86/os-support/bsd/bsd_init.c     |   17 
 hw/xfree86/os-support/linux/lnx_init.c   |   25 
 hw/xfree86/os-support/solaris/sun_init.c |   42 -
 hw/xfree86/utils/man/cvt.man             |    3 
 hw/xfree86/utils/man/gtf.man             |    3 
 include/dixstruct.h                      |    9 
 12 files changed, 610 insertions(+), 532 deletions(-)

New commits:
commit 98f4940093dc90c3366d3e4d3ddceacbaee299dc
Merge: b018b81... c8eacae...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Sep 21 14:30:19 2011 -0700

    Merge remote-tracking branch 'alanc/master'

commit c8eacae4f833a0bd81907ba2b4cfaa80c08e037f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Aug 25 21:46:16 2011 -0700

    Space & style cleanup of hw/xfree86/i2c/fi1236.c
    
    Fortunately, the massive decrease in the cost of whitespace in the past
    decade has allowed us to be much more generous with it, and much more
    consistent in its application, even for code like this that clearly no
    one has ever tried to read.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>

diff --git a/hw/xfree86/i2c/fi1236.c b/hw/xfree86/i2c/fi1236.c
index 8337c90..0bc50e5 100644
--- a/hw/xfree86/i2c/fi1236.c
+++ b/hw/xfree86/i2c/fi1236.c
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
@@ -19,587 +18,658 @@
 const FI1236_parameters tuner_parms[NUM_TUNERS] =
 {
     /* 0 - FI1236 */
-    { 733 ,884 ,12820 ,2516 ,7220 ,0xA2 ,0x94, 0x34, 0x8e },
+    { 733, 884, 12820, 2516, 7220, 0xA2, 0x94, 0x34, 0x8e },
     /* !!!based on documentation - it should be:
-    {733 ,16*55.25 ,16*801.25 ,16*160 ,16*454 ,0xA0 ,0x90, 0x30, 0x8e},*/
-    
+    {733, 16*55.25, 16*801.25, 16*160, 16*454, 0xA0, 0x90, 0x30, 0x8e},*/
+
     /* 1 - FI1216 */
-    { 623 ,16*48.75 ,16*855.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e },
+    { 623, 16*48.75, 16*855.25, 16*170, 16*450, 0xA0, 0x90, 0x30, 0x8e },
     /* 2 - TEMIC FN5AL */
-    { 623 ,16*45.75 ,16*855.25 ,16*169 ,16*454 ,0xA0 ,0x90, 0x30, 0x8e },
+    { 623, 16*45.75, 16*855.25, 16*169, 16*454, 0xA0, 0x90, 0x30, 0x8e },
     /* 3 - MT2032.. */
-    { 733 ,768 ,13760 , 0 , 0 , 0 , 0,  0, 0 },
+    { 733, 768, 13760,  0,  0,  0,  0,  0, 0 },
     /* 4 - FI1246 */
-    { 623 ,16*45.75 ,16*855.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e },
+    { 623, 16*45.75, 16*855.25, 16*170, 16*450, 0xA0, 0x90, 0x30, 0x8e },
     /* 5 - FI1256 */
-    { 623 ,16*49.75 ,16*863.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e },
+    { 623, 16*49.75, 16*863.25, 16*170, 16*450, 0xA0, 0x90, 0x30, 0x8e },
     /* 6 - FI1236W */
-    /*{ 733 ,884 ,12820 ,2516 ,7220 ,0x1 ,0x2, 0x4, 0x8e },*/
+    /*{ 733, 884, 12820, 2516, 7220, 0x1, 0x2, 0x4, 0x8e },*/
     { 732, 16*55.25, 16*801.25, 16*160, 16*442, 0x1, 0x2, 0x4, 0x8e },
-	 /* 7 - FM1216ME */
-    { 623 ,16*48.25 ,16*863.25 ,16*158.00 ,16*442.00 ,0x1 ,0x2, 0x4, 0x8e }
+    /* 7 - FM1216ME */
+    { 623, 16*48.25, 16*863.25, 16*158.00, 16*442.00, 0x1, 0x2, 0x4, 0x8e }
 };
 
 
-FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
+FI1236Ptr
+Detect_FI1236 (I2CBusPtr b, I2CSlaveAddr addr)
 {
-   FI1236Ptr f;
-   I2CByte a;
-
-   f = calloc(1,sizeof(FI1236Rec));
-   if(f == NULL) return NULL;
-   f->d.DevName = strdup("FI12xx Tuner");
-   f->d.SlaveAddr = addr;
-   f->d.pI2CBus = b;
-   f->d.NextDev = NULL;
-   f->d.StartTimeout = b->StartTimeout;
-   f->d.BitTimeout = b->BitTimeout;
-   f->d.AcknTimeout = b->AcknTimeout;
-   f->d.ByteTimeout = b->ByteTimeout;
-   f->type=TUNER_TYPE_FI1236;
-   f->afc_timer_installed=FALSE;
-   f->last_afc_hint=TUNER_OFF;
-   f->video_if=45.7812;
-  
-   if(!I2C_WriteRead(&(f->d), NULL, 0, &a, 1))
-   {
-   	free(f);
-	return NULL;
+    FI1236Ptr f;
+    I2CByte a;
+
+    f = calloc(1,sizeof(FI1236Rec));
+    if (f == NULL)
+        return NULL;
+    f->d.DevName = strdup("FI12xx Tuner");
+    f->d.SlaveAddr = addr;
+    f->d.pI2CBus = b;
+    f->d.NextDev = NULL;
+    f->d.StartTimeout = b->StartTimeout;
+    f->d.BitTimeout = b->BitTimeout;
+    f->d.AcknTimeout = b->AcknTimeout;
+    f->d.ByteTimeout = b->ByteTimeout;
+    f->type=TUNER_TYPE_FI1236;
+    f->afc_timer_installed=FALSE;
+    f->last_afc_hint=TUNER_OFF;
+    f->video_if=45.7812;
+
+    if (!I2C_WriteRead(&(f->d), NULL, 0, &a, 1)) {
+        free(f);
+        return NULL;
     }
     FI1236_set_tuner_type(f, TUNER_TYPE_FI1236);
-    if(!I2CDevInit(&(f->d)))
-    {
-       free(f);
-       return NULL;
+    if (!I2CDevInit(&(f->d))) {
+        free(f);
+        return NULL;
     }
     return f;
 }
 
-static void MT2032_dump_parameters(FI1236Ptr f, MT2032_parameters *m)
+static void
+MT2032_dump_parameters (FI1236Ptr f, MT2032_parameters *m)
 {
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n", 
-	m->f_rf, m->f_if1, m->f_if2, m->f_ref, m->f_ifbw, m->f_step);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n",
+               m->f_rf, m->f_if1, m->f_if2, m->f_ref, m->f_ifbw, m->f_step);
 
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: computed f_lo1=%g f_lo2=%g LO1I=%d LO2I=%d SEL=%d STEP=%d NUM=%d\n", 
-	m->f_lo1, m->f_lo2, m->LO1I, m->LO2I, m->SEL, m->STEP, m->NUM);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: computed f_lo1=%g f_lo2=%g LO1I=%d LO2I=%d SEL=%d STEP=%d NUM=%d\n",
+               m->f_lo1, m->f_lo2, m->LO1I, m->LO2I, m->SEL, m->STEP, m->NUM);
 }
 
 
-static void MT2032_getid(FI1236Ptr f)
+static void
+MT2032_getid (FI1236Ptr f)
 {
-CARD8 out[4];
-CARD8 in;
+    CARD8 out[4];
+    CARD8 in;
 
-in=0x11;
-I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 4);
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
-	out[0], out[1], out[2], out[3]);
+    in = 0x11;
+    I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 4);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
+               out[0], out[1], out[2], out[3]);
 
 }
 
 /* might be buggy */
 #if 0
-static void MT2032_shutdown(FI1236Ptr f)
+static void
+MT2032_shutdown (FI1236Ptr f)
 {
-CARD8 data[10];
+    CARD8 data[10];
 
-data[0]=0x00; /* start with register 0x00 */
-data[1]=0x1A; 
-data[2]=0x44;
-data[3]=0x20;
+    data[0] = 0x00; /* start with register 0x00 */
+    data[1] = 0x1A;
+    data[2] = 0x44;
+    data[3] = 0x20;
 
-I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
 
-data[0]=0x05; /* now start with register 0x05 */
-data[1]=0xD7;
-data[2]=0x14;
-data[3]=0x05;
-I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+    data[0] = 0x05; /* now start with register 0x05 */
+    data[1] = 0xD7;
+    data[2] = 0x14;
+    data[3] = 0x05;
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
 
-data[0]=0x0B; /* now start with register 0x05 */
-data[1]=0x8F;
-data[2]=0x07;
-data[3]=0x43;
-I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+    data[0] = 0x0B; /* now start with register 0x05 */
+    data[1] = 0x8F;
+    data[2] = 0x07;
+    data[3] = 0x43;
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
 
-usleep(15000);
+    usleep(15000);
 }
 #endif
 
-static void MT2032_dump_status(FI1236Ptr f);
+static void MT2032_dump_status (FI1236Ptr f);
 
-static void MT2032_init(FI1236Ptr f)
+static void
+MT2032_init (FI1236Ptr f)
 {
-CARD8 data[10];
-CARD8 value;
-CARD8 xogc = 0x00;
-
-MT2032_getid(f);
-
-data[0]=0x02; /* start with register 0x02 */
-data[1]=0xFF; 
-data[2]=0x0F;
-data[3]=0x1F;
-
-I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
-
-data[0]=0x06; /* now start with register 0x06 */
-data[1]=0xE4;
-data[2]=0x8F;
-data[3]=0xC3;
-data[4]=0x4E;
-data[5]=0xEC;
-I2C_WriteRead(&(f->d), (I2CByte *)data, 6, NULL, 0);
-
-data[0]=0x0d; /* now start with register 0x0d */
-data[1]=0x32;
-I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
-
-while(1) {
-	usleep(15000); /* wait 15 milliseconds */
-
-	data[0]=0x0e; /* register number 7, status */
-	value=0xFF;
-	if(!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
-		xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to read XOK\n"); 
-	xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: XOK=%d\n", value & 0x01); 
-	if(value & 1) break;
-	
-	data[0]=0x07;
-	if(!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
-		xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to read XOGC\n"); 
-	 
-	xogc=value & 0x7;
-	if(xogc==4){
-		break; /* XOGC has reached 4.. stop */	
-		}
-	xogc--;
-	xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: try XOGC=%d\n", xogc); 
-	usleep(15000);
-	data[0]=0x07; /* register number 7, control byte 2 */
-	data[1]=0x08 | xogc;
-	I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);	
-	}
-f->xogc=xogc;
-/* wait before continuing */
-usleep(15000); /* wait 50 milliseconds */
-MT2032_dump_status(f);
+    CARD8 data[10];
+    CARD8 value;
+    CARD8 xogc = 0x00;
+
+    MT2032_getid(f);
+
+    data[0] = 0x02; /* start with register 0x02 */
+    data[1] = 0xFF;
+    data[2] = 0x0F;
+    data[3] = 0x1F;
+
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+    data[0] = 0x06; /* now start with register 0x06 */
+    data[1] = 0xE4;
+    data[2] = 0x8F;
+    data[3] = 0xC3;
+    data[4] = 0x4E;
+    data[5] = 0xEC;
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 6, NULL, 0);
+
+    data[0] = 0x0d; /* now start with register 0x0d */
+    data[1] = 0x32;
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+
+    while (1) {
+        usleep(15000); /* wait 15 milliseconds */
+
+        data[0] = 0x0e; /* register number 7, status */
+        value = 0xFF;
+        if (!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
+            xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                       "MT2032: failed to read XOK\n");
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "MT2032: XOK=%d\n", value & 0x01);
+        if (value & 1)
+            break;
+
+        data[0] = 0x07;
+        if (!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
+            xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                       "MT2032: failed to read XOGC\n");
+
+        xogc=value & 0x7;
+        if (xogc == 4)
+            break; /* XOGC has reached 4.. stop */
+        xogc--;
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "MT2032: try XOGC=%d\n", xogc);
+        usleep(15000);
+        data[0] = 0x07; /* register number 7, control byte 2 */
+        data[1] = 0x08 | xogc;
+        I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+    }
+    f->xogc = xogc;
+    /* wait before continuing */
+    usleep(15000); /* wait 50 milliseconds */
+    MT2032_dump_status(f);
 }
 
-static int MT2032_no_spur_in_band(MT2032_parameters *m)
+static int
+MT2032_no_spur_in_band (MT2032_parameters *m)
 {
-int n_max, n1, n2;
-double f_test;
-n_max=5;
-n1=1;
-while(1){
-	n2=-n1;
-	f_test=n1*(m->f_lo1-m->f_lo2);
-	while(1){
-		n2--;
-		f_test=f_test-m->f_lo2;
-		xf86DrvMsg(0, X_INFO, "testing f_test=%g n1=%d n2=%d f_lo1=%g f_lo2=%g f_if2=%g\n", f_test, n1, n2, m->f_lo1, m->f_lo2, m->f_if2);  
-		xf86DrvMsg(0, X_INFO, "d_f=%g f_ifbw=%g\n",fabs(fabs(f_test)-m->f_if2), m->f_ifbw);  
-		if((fabs(fabs(f_test)-m->f_if2)*2.0)<=m->f_ifbw)return 0;
-		if(n2<=-n_max)break;
-  		/* this line in the manual is bogus. I say it is faster
-		and more correct to go over all harmonics.. */
-		#if 0
-		if(f_test<(m->f_lo2-m->f_if2-m->f_ifbw))break; 
-		#endif
-		}
-	n1++;
-	if(n1>=n_max)return 1;
-	}
+    int n_max, n1, n2;
+    double f_test;
+    n_max = 5;
+    n1 = 1;
+    while (1) {
+        n2 = -n1;
+        f_test = n1 * (m->f_lo1 - m->f_lo2);
+        while (1) {
+            n2--;
+            f_test = f_test - m->f_lo2;
+            xf86DrvMsg(0, X_INFO,
+                       "testing f_test=%g n1=%d n2=%d f_lo1=%g f_lo2=%g f_if2=%g\n",
+                       f_test, n1, n2, m->f_lo1, m->f_lo2, m->f_if2);
+            xf86DrvMsg(0, X_INFO, "d_f=%g f_ifbw=%g\n",
+                       fabs(fabs(f_test) - m->f_if2), m->f_ifbw);
+            if ((fabs(fabs(f_test) - m->f_if2) * 2.0) <= m->f_ifbw)
+                return 0;
+            if (n2 <= -n_max)
+                break;
+            /* this line in the manual is bogus. I say it is faster
+               and more correct to go over all harmonics.. */
+#if 0
+            if (f_test < (m->f_lo2 - m->f_if2 - m->f_ifbw))
+                break;
+#endif
+        }
+        n1++;
+        if (n1 >= n_max)
+            return 1;
+    }
 
 }
 
-static void MT2032_calculate_register_settings(MT2032_parameters *m, double f_rf, double f_if1, double f_if2, double f_ref, double f_ifbw, double f_step)
+static void
+MT2032_calculate_register_settings (MT2032_parameters *m, double f_rf,
+   double f_if1, double f_if2, double f_ref, double f_ifbw, double f_step)
 {
-int n;
-m->f_rf=f_rf;
-m->f_if1=f_if1;
-m->f_if2=f_if2;
-m->f_ref=f_ref;
-m->f_ifbw=f_ifbw;
-m->f_step=f_step;
-
-m->f_lo1=f_rf+f_if1;
-m->LO1I=lrint(m->f_lo1/f_ref);
-m->f_lo1=f_ref*m->LO1I;
-
-m->f_lo2=m->f_lo1-f_rf-f_if2;
-
-/* check for spurs */
-n=1;
-while(n<3){
-	if(MT2032_no_spur_in_band(m))break;
-	if(m->f_lo1<(f_rf+f_if1)){
-		m->LO1I+=n;
-		} else {
-		m->LO1I-=n;
-		}
-	m->f_lo1=m->LO1I*f_ref;
-	m->f_lo2=m->f_lo1-f_rf-f_if2;
-	n++;
-	}
-/* xf86DrvMsg(0, X_INFO, "MT2032: n=%d\n", n); */
-/* select VCO */
-
-/* m->f_lo1>1100.0 */
-if(m->f_lo1<1370.0)m->SEL=4;
-	else
-if(m->f_lo1<1530.0)m->SEL=3;
-	else
-if(m->f_lo1<1720.0)m->SEL=2;
-	else
-if(m->f_lo1<1890.0)m->SEL=1;
-	else  /* m->f_lo1 < 1958.0 */
-	m->SEL=0;
-
-/* calculate the rest of the registers */
-m->LO2I=floor(m->f_lo2/f_ref);
-m->STEP=floor(3780.0*f_step/f_ref);
-m->NUM=floor(3780.0*(m->f_lo2/f_ref-m->LO2I));
-m->NUM=m->STEP*lrint((1.0*m->NUM)/(1.0*m->STEP));
+    int n;
+    m->f_rf = f_rf;
+    m->f_if1 = f_if1;
+    m->f_if2 = f_if2;
+    m->f_ref = f_ref;
+    m->f_ifbw = f_ifbw;
+    m->f_step = f_step;
+
+    m->f_lo1 = f_rf+f_if1;
+    m->LO1I = lrint(m->f_lo1 / f_ref);
+    m->f_lo1 = f_ref * m->LO1I;
+
+    m->f_lo2 = m->f_lo1 - f_rf - f_if2;
+
+    /* check for spurs */
+    n = 1;
+    while (n < 3) {
+        if (MT2032_no_spur_in_band(m))
+            break;
+
+        if (m->f_lo1 < (f_rf + f_if1))
+            m->LO1I += n;
+        else
+            m->LO1I -= n;
+
+        m->f_lo1 = m->LO1I * f_ref;
+        m->f_lo2 = m->f_lo1 - f_rf - f_if2;
+        n++;
+    }
+    /* xf86DrvMsg(0, X_INFO, "MT2032: n=%d\n", n); */
+    /* select VCO */
+
+    /* m->f_lo1>1100.0 */
+    if (m->f_lo1 < 1370.0)
+        m->SEL = 4;
+    else if (m->f_lo1 < 1530.0)
+        m->SEL = 3;
+    else if (m->f_lo1 < 1720.0)
+        m->SEL = 2;
+    else if (m->f_lo1 < 1890.0)
+        m->SEL = 1;
+    else  /* m->f_lo1 < 1958.0 */
+        m->SEL = 0;
+
+    /* calculate the rest of the registers */
+    m->LO2I = floor(m->f_lo2 / f_ref);
+    m->STEP = floor(3780.0 * f_step / f_ref);
+    m->NUM  = floor(3780.0 * (m->f_lo2 / f_ref - m->LO2I));
+    m->NUM  = m->STEP * lrint((1.0 * m->NUM) / (1.0 * m->STEP));
 }
 
-static int MT2032_wait_for_lock(FI1236Ptr f)
+static int
+MT2032_wait_for_lock (FI1236Ptr f)
 {
-int n;
-CARD8 data[10];
-CARD8 value;
-
-n=12;
-while(1){
-	data[0]=0x0e; /* register number 7, status */
-	I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
-/*	xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: LO1LK=%d LO2LK=%d\n", (value & 0x04)>>2, (value & 0x02)>>1); */
-	if((value & 6)==6) break;
-	usleep(1500);
-	n--;
-	if(n<0)break;
-	}
-if(n<0){
-	xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n");
-	return 0;
-	}
-return 1;
+    int n;
+    CARD8 data[10];
+    CARD8 value;
+
+    n=12;
+    while(1) {
+        data[0] = 0x0e; /* register number 7, status */
+        I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+     /* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "MT2032: LO1LK=%d LO2LK=%d\n",
+                   (value & 0x04)>>2, (value & 0x02)>>1); */
+        if ((value & 6)==6)
+            break;
+        usleep (1500);
+        n--;
+        if (n < 0)
+            break;
+    }
+    if (n < 0) {
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "MT2032: failed to set frequency\n");
+        return 0;
+    }
+    return 1;
 }
 
-static void MT2032_implement_settings(FI1236Ptr f, MT2032_parameters *m)
+static void
+MT2032_implement_settings (FI1236Ptr f, MT2032_parameters *m)
 {
-CARD8 data[10];
-CARD8 value;
-
-data[0]=0x00;     /* start with register 0x00 */
-data[1]=(m->LO1I>>3)-1;
-data[2]=(m->SEL<<4)|(m->LO1I & 0x7);
-data[3]=0x86;
-I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
-
-data[0]=0x05;     /* start with register 0x05 */
-data[1]=((m->LO2I & 0x7)<<5)|((m->LO2I>>3)-1);
-if(m->f_rf<400.0)data[2]=0xe4;
-	else data[2]=0xf4;
-I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
-
-data[0]=0x07; /* register number 7, control byte 2 */
-I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: using XOGC=%d\n", (value & 0x07));
-data[1]=8 | (value & 0x7);
-I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);	
-
-data[0]=0x0b;   /* start with register 0x0b */
-data[1]=m->NUM & 0xff;
-data[2]=(1<<7)|((m->NUM >> 8) & 0x0f);
-I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
-
-MT2032_wait_for_lock(f);
+    CARD8 data[10];
+    CARD8 value;
+
+    data[0] = 0x00;     /* start with register 0x00 */
+    data[1] = (m->LO1I >> 3) - 1;
+    data[2] = (m->SEL << 4) | (m->LO1I & 0x7);
+    data[3] = 0x86;
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+    data[0] = 0x05;     /* start with register 0x05 */
+    data[1] = ((m->LO2I & 0x7) << 5) | ((m->LO2I >> 3) - 1);
+    if (m->f_rf < 400.0)
+        data[2] = 0xe4;
+    else
+        data[2] = 0xf4;
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
+
+    data[0] = 0x07;     /* register number 7, control byte 2 */
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: using XOGC=%d\n", (value & 0x07));
+    data[1] = 8 | (value & 0x7);
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+
+    data[0] = 0x0b;     /* start with register 0x0b */
+    data[1] = m->NUM & 0xff;
+    data[2] = (1<<7) | ((m->NUM >> 8) & 0x0f);
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
+
+    MT2032_wait_for_lock(f);
 }
 
-static void MT2032_optimize_VCO(FI1236Ptr f, MT2032_parameters *m)
+static void
+MT2032_optimize_VCO (FI1236Ptr f, MT2032_parameters *m)
 {
-CARD8 data[10];
-CARD8 value;
-CARD8 TAD1;
-
-data[0]=0x0f; /* register number 7, status */
-I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
-TAD1=value & 0x07;
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL);
-if(TAD1 < 2)return;
-if(TAD1==2){
-	if(m->SEL==0)return;
-	m->SEL--;
-	} else {
-	if(m->SEL>=4)return;
-	m->SEL++;
-	}
-data[0]=0x01;  /* start with register 1 */
-data[1]=(m->SEL<<4)|(m->LO1I & 0x7);
-I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+    CARD8 data[10];
+    CARD8 value;
+    CARD8 TAD1;
+
+    data[0] = 0x0f; /* register number 7, status */
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+    TAD1=value & 0x07;
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL);
+    if (TAD1 < 2)
+        return;
+    if (TAD1 == 2) {
+        if (m->SEL == 0)
+            return;
+        m->SEL--;
+    } else {
+        if (m->SEL >= 4)
+            return;
+        m->SEL++;
+    }
+    data[0] = 0x01;  /* start with register 1 */
+    data[1] = (m->SEL << 4) | (m->LO1I & 0x7);
+    I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
 
 }
 
-static int FI1236_get_afc_hint(FI1236Ptr f)
+static int
+FI1236_get_afc_hint (FI1236Ptr f)
 {
-	CARD8 out;
-	CARD8 AFC;
-
-	if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W))
-	{
-		TDA9885Ptr t = (TDA9885Ptr)f->afc_source;
-		if (t == NULL)
-			return TUNER_OFF; 
-		
-		tda9885_getstatus(t);
-		tda9885_dumpstatus(t);
-		AFC = t->afc_status & 0x0f;
-
-		xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC);
-		if (AFC == 0) return TUNER_TUNED;
-		else if (AFC <= 0x07)return TUNER_JUST_BELOW;
-		else if (AFC < 0x0f )return TUNER_JUST_ABOVE;
-		else if (AFC == 0x0f)return TUNER_TUNED;
-	}
-	else
-	{
-		I2C_WriteRead(&(f->d), NULL, 0, &out, 1);
-		AFC=out & 0x7;
-		xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC);
-		if(AFC==2)return TUNER_TUNED;
-		if(AFC==3)return TUNER_JUST_BELOW;
-		if(AFC==1)return TUNER_JUST_ABOVE;
-		return TUNER_OFF;
-	}
-	return TUNER_OFF;
+    CARD8 out;
+    CARD8 AFC;
+
+    if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
+        TDA9885Ptr t = (TDA9885Ptr)f->afc_source;
+        if (t == NULL)
+            return TUNER_OFF;
+
+        tda9885_getstatus(t);
+        tda9885_dumpstatus(t);
+        AFC = t->afc_status & 0x0f;
+
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "AFC: FI1236_get_afc_hint: %i\n", AFC);
+        if (AFC == 0)
+            return TUNER_TUNED;
+        else if (AFC <= 0x07)
+            return TUNER_JUST_BELOW;
+        else if (AFC < 0x0f)
+            return TUNER_JUST_ABOVE;
+        else if (AFC == 0x0f)
+            return TUNER_TUNED;
+    } else {
+        I2C_WriteRead(&(f->d), NULL, 0, &out, 1);
+        AFC = out & 0x7;
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "AFC: FI1236_get_afc_hint: %i\n", AFC);
+        if (AFC == 2)
+            return TUNER_TUNED;
+        if (AFC == 3)
+            return TUNER_JUST_BELOW;
+        if (AFC == 1)
+            return TUNER_JUST_ABOVE;
+        return TUNER_OFF;
+    }
+    return TUNER_OFF;
 }
 
-static int MT2032_get_afc_hint(FI1236Ptr f)
+static int
+MT2032_get_afc_hint (FI1236Ptr f)
 {
-CARD8 in;
-CARD8 out[2];
-CARD8 AFC;
-in=0x0e;
-I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
-AFC=(out[0]>>4) & 0x7;
+    CARD8 in;
+    CARD8 out[2];
+    CARD8 AFC;
+    in = 0x0e;
+    I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
+    AFC = (out[0] >> 4) & 0x7;
 #if 0
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n", AFC, out[1] & 0x7, (out[1]>>4)& 0x07);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n",
+               AFC, out[1] & 0x7, (out[1]>>4)& 0x07);
 #endif
-if(AFC==2)return TUNER_TUNED;
-if(AFC==3)return TUNER_JUST_BELOW;
-if(AFC==1)return TUNER_JUST_ABOVE;
-return TUNER_OFF;
+    if (AFC == 2)
+        return TUNER_TUNED;
+    if (AFC == 3)
+        return TUNER_JUST_BELOW;
+    if (AFC == 1)
+        return TUNER_JUST_ABOVE;
+    return TUNER_OFF;
 }
 
 /* this function is for external use only */
-int TUNER_get_afc_hint(FI1236Ptr f)
+int
+TUNER_get_afc_hint (FI1236Ptr f)
 {
-if(f->afc_timer_installed)return TUNER_STILL_TUNING;
-return f->last_afc_hint;
+    if (f->afc_timer_installed)
+        return TUNER_STILL_TUNING;
+    return f->last_afc_hint;
 }
 
-static void MT2032_dump_status(FI1236Ptr f)
+static void
+MT2032_dump_status (FI1236Ptr f)
 {
-CARD8 in;
-CARD8 out[2];
-CARD8 AFC;
-CARD8 LDONrb;
-CARD8 LO1LK, LO2LK, XOK;
-CARD8 TAD2, TAD1;
-
-in=0x0e;
-I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
-XOK=out[0] & 1;
-LO1LK=(out[0]>>2) &1;
-LO2LK=(out[0]>>1) &1;
-LDONrb=(out[0]>>3) &1;
-
-AFC=(out[0]>>4) & 0x7;
-
-TAD1=(out[1] & 0x7);
-TAD2=(out[1]>>4) & 0x7;
-
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n", 
-	XOK, LO1LK, LO2LK, LDONrb, AFC, TAD1, TAD2);
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n", 
-	XOK ? "ok":"off", LO1LK ? "locked" : "off" , LO2LK ? "locked" : "off");
+    CARD8 in;
+    CARD8 out[2];
+    CARD8 AFC;
+    CARD8 LDONrb;
+    CARD8 LO1LK, LO2LK, XOK;
+    CARD8 TAD2, TAD1;
+
+    in = 0x0e;
+    I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
+    XOK = out[0] & 1;
+    LO1LK  = (out[0] >> 2) & 1;
+    LO2LK  = (out[0] >> 1) & 1;
+    LDONrb = (out[0] >> 3) & 1;
+
+    AFC    = (out[0] >> 4) & 0x7;
+
+    TAD1   = (out[1] & 0x7);
+    TAD2   = (out[1] >> 4) & 0x7;
+
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n",
+               XOK, LO1LK, LO2LK, LDONrb, AFC, TAD1, TAD2);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n",
+               XOK ? "ok" : "off",
+               LO1LK ? "locked" : "off",
+               LO2LK ? "locked" : "off");
 
 }
 
 static void MT2032_tune(FI1236Ptr f, double freq, double step)
 {
-MT2032_parameters m;
-CARD8 data[10];
-int i;
-/* NTSC IF is 44mhz.. but 733/16=45.8125 and all TDAXXXX docs mention
-     45.75, 39, 58.75 and 30. */
+    MT2032_parameters m;
+    CARD8 data[10];
+    int i;
+
+    /* NTSC IF is 44mhz.. but 733/16=45.8125 and all TDAXXXX docs mention
+       45.75, 39, 58.75 and 30. */
 #if 0
-MT2032_calculate_register_settings(&m, freq, 1090.0, 45.125, 5.25, 6.0, step);
-MT2032_calculate_register_settings(&m, freq, 1090.0, 45.74, 5.25, 6.0, step);
+    MT2032_calculate_register_settings(&m, freq, 1090.0, 45.125, 5.25, 6.0, step);
+    MT2032_calculate_register_settings(&m, freq, 1090.0, 45.74, 5.25, 6.0, step);
 #endif
-MT2032_calculate_register_settings(&m, freq, 1090.0, f->video_if, 5.25, 3.0, step);
-MT2032_dump_parameters(f, &m);
-MT2032_implement_settings(f, &m);
-/* MT2032_dump_parameters(f, &m); */
-for(i=0;i<3;i++){
-	MT2032_optimize_VCO(f, &m);
-	if(MT2032_wait_for_lock(f)){
-		data[0]=0x02;  /* LO Gain control register 0x02 */
-		data[1]=0x20;
-		I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
-		return;
-		}
-	data[0]=0x07;
-	data[1]=0x88|f->xogc;
-	I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
-	usleep(15000);
-	data[1]=0x08|f->xogc;
-	I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);	
-	}
-xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n");
+    MT2032_calculate_register_settings(&m, freq, 1090.0, f->video_if, 5.25, 3.0, step);
+    MT2032_dump_parameters(f, &m);
+    MT2032_implement_settings(f, &m);
+ /* MT2032_dump_parameters(f, &m); */
+    for (i = 0; i < 3; i++) {
+        MT2032_optimize_VCO(f, &m);
+        if (MT2032_wait_for_lock(f)) {
+            data[0] = 0x02;  /* LO Gain control register 0x02 */
+            data[1] = 0x20;
+            I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+            return;
+        }
+        data[0] = 0x07;
+        data[1] = 0x88 | f->xogc;
+        I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+        usleep(15000);
+        data[1] = 0x08 | f->xogc;
+        I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+    }
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "MT2032: failed to set frequency\n");
 }
 
-void FI1236_set_tuner_type(FI1236Ptr f, int type)
+void
+FI1236_set_tuner_type (FI1236Ptr f, int type)
 {
-f->type=type;
-if(type>=NUM_TUNERS)type = NUM_TUNERS-1;
-if(type<0)type = 0;
-memcpy(&(f->parm), &(tuner_parms[type]), sizeof(FI1236_parameters));
-f->original_frequency=f->parm.min_freq;
-f->afc_delta=0;
-if(type==TUNER_TYPE_MT2032){
-	MT2032_init(f);
-	return;
-	}
+    f->type = type;
+    if (type >= NUM_TUNERS)
+        type = NUM_TUNERS-1;
+    if (type < 0)
+        type = 0;
+    memcpy(&(f->parm), &(tuner_parms[type]), sizeof(FI1236_parameters));
+    f->original_frequency = f->parm.min_freq;
+    f->afc_delta = 0;
+    if (type == TUNER_TYPE_MT2032) {
+        MT2032_init(f);
+        return;
+    }
 }
 
 
-static CARD32 AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data){
-FI1236Ptr f=(FI1236Ptr)data;
-if(FI1236_AFC(f))return 150;
-	else {
-	f->afc_timer_installed=FALSE;
-	f->afc_count=0;
-	return 0;
-	}
+static CARD32
+AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data)
+{
+    FI1236Ptr f = (FI1236Ptr)data;
+    if (FI1236_AFC(f))
+        return 150;
+    else {
+        f->afc_timer_installed = FALSE;
+        f->afc_count = 0;
+        return 0;
+    }
 }
 
-void FI1236_tune(FI1236Ptr f, CARD32 frequency)
+void
+FI1236_tune(FI1236Ptr f, CARD32 frequency)
 {
     CARD16 divider;
-	 CARD8 data;
+    CARD8 data;
 
-    if(frequency < f->parm.min_freq) frequency = f->parm.min_freq;
-    if(frequency > f->parm.max_freq) frequency = f->parm.max_freq;
+    if (frequency < f->parm.min_freq) frequency = f->parm.min_freq;
+    if (frequency > f->parm.max_freq) frequency = f->parm.max_freq;
 
-    divider = (f->parm.fcar+(CARD16)frequency) & 0x7fff;
-    f->tuner_data.div1 = (CARD8)((divider>>8)&0x7f);
+    divider = (f->parm.fcar + (CARD16)frequency) & 0x7fff;
+    f->tuner_data.div1 = (CARD8)((divider >> 8)&0x7f);
     f->tuner_data.div2 = (CARD8)(divider & 0xff);
-    f->tuner_data.control = f->parm.control; 
+    f->tuner_data.control = f->parm.control;
 
-    if(frequency < f->parm.threshold1)
-    {
+    if (frequency < f->parm.threshold1)
         f->tuner_data.band = f->parm.band_low;
-    } 
     else if (frequency < f->parm.threshold2)
-    {
         f->tuner_data.band = f->parm.band_mid;
-    }
     else
-    {
         f->tuner_data.band = f->parm.band_high;
-    }
 
-	 xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner band to %d\n", f->tuner_data.band);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "Setting tuner band to %d\n", f->tuner_data.band);
 
-    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner frequency to %d\n", (int)frequency);
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "Setting tuner frequency to %d\n", (int)frequency);
 
-	 if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W))
-	 {
-				f->tuner_data.aux = 0x20;
-				I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 5, NULL, 0);
-				I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
-				xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
-
-	 }
-	 else
-				I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0);
+    if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
+        f->tuner_data.aux = 0x20;
+        I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 5, NULL, 0);
+        I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
+    }
+    else
+        I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0);
 }
 
-void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
+void
+TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
 {
-    if(frequency < f->parm.min_freq) frequency = f->parm.min_freq;
-    if(frequency > f->parm.max_freq) frequency = f->parm.max_freq;
+    if (frequency < f->parm.min_freq) frequency = f->parm.min_freq;
+    if (frequency > f->parm.max_freq) frequency = f->parm.max_freq;
 
     f->afc_delta=0;
     f->original_frequency=frequency;
 
-    if(f->type==TUNER_TYPE_MT2032)
-        {
-    	MT2032_tune(f, (1.0*frequency)/16.0, 0.0625);
-	} else 
-	{
-	FI1236_tune(f, frequency);
-	}
-    
-    if(!f->afc_timer_installed)
-        {
-     	f->afc_timer_installed=TRUE;
-/*     	RegisterBlockAndWakeupHandlers(FI1236_BlockHandler, AFCWakeup, f); */
-	TimerSet(NULL, 0, 300, AFC_TimerCallback, f);
-	}
-	
+    if (f->type == TUNER_TYPE_MT2032)
+        MT2032_tune(f, (1.0*frequency)/16.0, 0.0625);
+    else
+        FI1236_tune(f, frequency);
+
+    if (!f->afc_timer_installed) {
+        f->afc_timer_installed=TRUE;
+/*      RegisterBlockAndWakeupHandlers(FI1236_BlockHandler, AFCWakeup, f); */
+        TimerSet(NULL, 0, 300, AFC_TimerCallback, f);
+    }
+
 }
 
 
-int FI1236_AFC(FI1236Ptr f)
+int
+FI1236_AFC(FI1236Ptr f)
 {
-    #if 0
-    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n", f, f->afc_count, f->original_frequency, f->afc_delta);
-    #endif
+#if 0
+    xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+               "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n",
+               f, f->afc_count, f->original_frequency, f->afc_delta);
+#endif
     f->afc_count++;
-    if(f->type==TUNER_TYPE_MT2032)
-        {
-    	f->last_afc_hint=MT2032_get_afc_hint(f);
-        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: afc_hint=%d\n", f->last_afc_hint);
-	if(f->last_afc_hint==TUNER_TUNED)return 0;
-	if(f->afc_count>3)f->last_afc_hint=TUNER_OFF;
-	if(f->last_afc_hint==TUNER_OFF)
-	        {
-		f->afc_delta=0;
-		} else
-		f->afc_delta+=f->last_afc_hint;
-        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0);
-    	MT2032_tune(f, (1.0*f->original_frequency+0.5*f->afc_delta)/16.0, 0.03125);
-	if(f->last_afc_hint==TUNER_OFF)return 0;
-	return 1; /* call me again */
-	} else 
-	{
-    	f->last_afc_hint=FI1236_get_afc_hint(f);
-	if(f->last_afc_hint==TUNER_TUNED)
-	{
-			  xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n");
-			  return 0;
-	}
-	if(f->afc_count>3)f->last_afc_hint=TUNER_OFF;
-	if(f->last_afc_hint==TUNER_OFF)
-	        {
-		f->afc_delta=0;
-		} else
-		f->afc_delta+=f->last_afc_hint;
-        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0);
-	FI1236_tune(f, f->original_frequency+f->afc_delta);
-	if(f->last_afc_hint==TUNER_OFF)return 0;
-	return 1; /* call me again */
-	}
+    if (f->type == TUNER_TYPE_MT2032) {
+        f->last_afc_hint = MT2032_get_afc_hint(f);
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "AFC: afc_hint=%d\n", f->last_afc_hint);
+        if (f->last_afc_hint == TUNER_TUNED)
+            return 0;
+        if (f->afc_count > 3)
+            f->last_afc_hint = TUNER_OFF;
+        if (f->last_afc_hint == TUNER_OFF)
+            f->afc_delta = 0;
+        else
+            f->afc_delta += f->last_afc_hint;
+
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "AFC: Setting tuner frequency to %g\n",
+                   (0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0);
+        MT2032_tune(f,
+                    (1.0 * f->original_frequency+ 0.5 * f->afc_delta) / 16.0,
+                    0.03125);
+        if (f->last_afc_hint == TUNER_OFF)
+            return 0;
+        return 1; /* call me again */
+    } else {
+        f->last_afc_hint = FI1236_get_afc_hint(f);
+        if (f->last_afc_hint == TUNER_TUNED) {
+            xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n");
+            return 0;
+        }
+        if (f->afc_count > 3)
+            f->last_afc_hint = TUNER_OFF;
+
+        if (f->last_afc_hint == TUNER_OFF)
+            f->afc_delta=0;
+        else
+            f->afc_delta+=f->last_afc_hint;
+
+        xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
+                   "AFC: Setting tuner frequency to %g\n",
+                   (0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0);
+        FI1236_tune(f, f->original_frequency + f->afc_delta);
+        if (f->last_afc_hint == TUNER_OFF)
+            return 0;
+        return 1; /* call me again */
+    }
     return 0; /* done */
 }
 
-void fi1236_dump_status(FI1236Ptr f)
+void
+fi1236_dump_status(FI1236Ptr f)
 {
-if(f->type==TUNER_TYPE_MT2032){
-	MT2032_dump_status(f);
-	}
+    if (f->type == TUNER_TYPE_MT2032)
+        MT2032_dump_status(f);
 }
commit c46215c100e964665580211a5d5893558ca9374f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Wed Aug 10 11:17:46 2011 -0700

    Cross-reference cvt(1) & gtf(1) man pages
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/utils/man/cvt.man b/hw/xfree86/utils/man/cvt.man
index b380171..f5075f5 100644
--- a/hw/xfree86/utils/man/cvt.man
+++ b/hw/xfree86/utils/man/cvt.man
@@ -1,4 +1,3 @@
-.\" $XFree86$
 .TH CVT 1 __vendorversion__
 .SH NAME
 cvt - calculate VESA CVT mode lines
@@ -32,7 +31,7 @@ Create a mode with reduced blanking.  This allows for higher frequency signals,
 with a lower or equal dotclock. Not for Cathode Ray Tube based displays though.
 
 .SH "SEE ALSO"
-__xconfigfile__(__filemansuffix__)
+__xconfigfile__(__filemansuffix__), gtf(__appmansuffix__)
 .SH AUTHOR
 Luc Verhaegen.
 .PP
diff --git a/hw/xfree86/utils/man/gtf.man b/hw/xfree86/utils/man/gtf.man
index 74ade74..8e83650 100644
--- a/hw/xfree86/utils/man/gtf.man
+++ b/hw/xfree86/utils/man/gtf.man
@@ -1,4 +1,3 @@
-.\" $XFree86$
 .TH GTF 1 __vendorversion__
 .SH NAME
 gtf - calculate VESA GTF mode lines
@@ -35,7 +34,7 @@ default format.
 Print the mode parameters in a format suitable for
 .BR fbset(8) .
 .SH "SEE ALSO"
-__xconfigfile__(__filemansuffix__)
+__xconfigfile__(__filemansuffix__), cvt(__appmansuffix__)
 .SH AUTHOR
 Andy Ritger.
 .PP
commit 1526f1caf396fefc5f09eaff884d5b92aac44997
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue May 31 19:54:33 2011 -0700

    Remove unused ClientStateAuthenticating
    
    Appears to be leftover from the Kerberos code deleted in 2007
    (commit dfbe32b5b828cc4e3da36a0e2e6ad641164eaa5e).
    Nothing left ever set clientState to ClientStateAuthenticating
    
    Skipped over 1 to preserve existing enum numbering.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index e21f08f..6c44c5e 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3443,8 +3443,7 @@ CloseDownClient(ClientPtr client)
 	 * now.  If it hasn't gotten to Running, nClients has *not*
 	 * been incremented, so *don't* decrement it.
 	 */
-	if (client->clientState != ClientStateInitial &&
-	    client->clientState != ClientStateAuthenticating )
+	if (client->clientState != ClientStateInitial)
 	{
 	    --nClients;
 	}
@@ -3706,17 +3705,8 @@ ProcEstablishConnection(ClientPtr client)
 				  auth_proto,
 				  (unsigned short)prefix->nbytesAuthString,
 				  auth_string);
-    /*
-     * If Kerberos is being used for this client, the clientState
-     * will be set to ClientStateAuthenticating at this point.
-     * More messages need to be exchanged among the X server, Kerberos
-     * server, and client to figure out if everyone is authorized.
-     * So we don't want to send the connection setup info yet, since
-     * the auth step isn't really done.
-     */
-    if (client->clientState != ClientStateAuthenticating)
-	return(SendConnSetup(client, reason));
-    return Success;
+
+    return(SendConnSetup(client, reason));
 }
 
 void
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 90e617b..6cc9614 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -57,8 +57,8 @@ extern _X_EXPORT void ReplyNotSwappd (
 		void *		/* pbuf */) _X_NORETURN;
 
 typedef enum {ClientStateInitial,
-	      ClientStateAuthenticating,
-	      ClientStateRunning,
+	      /* 1 is unused now, was ClientStateAuthenticating */
+	      ClientStateRunning = 2,
 	      ClientStateRetained,
 	      ClientStateGone
 } ClientState;
commit 13ac1ba480ee3e89163825cd2777f9a6e9dcbc9f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue May 31 19:42:48 2011 -0700

    Remove unused ClientStateCheckingSecurity & ClientStateCheckedSecurity
    
    Appear to be leftovers from the XC-QUERY-SECURITY code deleted in 2007
    (commit 375864cb74cced40ae688078b1f7750998972535).
    Nothing left ever set clientState to ClientStateCheckingSecurity.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 192c8c3..e21f08f 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3714,9 +3714,7 @@ ProcEstablishConnection(ClientPtr client)
      * So we don't want to send the connection setup info yet, since
      * the auth step isn't really done.
      */
-    if (client->clientState == ClientStateCheckingSecurity)
-	client->clientState = ClientStateCheckedSecurity;
-    else if (client->clientState != ClientStateAuthenticating)
+    if (client->clientState != ClientStateAuthenticating)
 	return(SendConnSetup(client, reason));
     return Success;
 }
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 443e8b0..90e617b 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -60,9 +60,8 @@ typedef enum {ClientStateInitial,
 	      ClientStateAuthenticating,
 	      ClientStateRunning,
 	      ClientStateRetained,
-	      ClientStateGone,
-	      ClientStateCheckingSecurity,
-	      ClientStateCheckedSecurity} ClientState;
+	      ClientStateGone
+} ClientState;
 
 #ifdef XFIXES
 typedef struct _saveSet {
commit 78f946c297081d39d312e05928146c78f59fedcb
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu May 19 23:26:31 2011 -0700

    sun_init.c: Implement novtswitch & sharevts for Solaris
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: John Martin <john.m.martin at oracle.com>

diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index d8c897d..800fc1c 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -186,6 +186,11 @@ xf86OpenConsole(void)
 	    xf86Info.vtno = VTnum;
 	    from = X_CMDLINE;
 	}
+	else if (xf86Info.ShareVTs)
+	{
+	    xf86Info.vtno = vtinfo.v_active;
+	    from = X_CMDLINE;
+	}
 	else
 	{
 	    if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
@@ -217,6 +222,9 @@ OPENCONSOLE:
 	chown(consoleDev, getuid(), getgid());
 
 #ifdef HAS_USL_VTS
+	if (xf86Info.ShareVTs)
+	    return;
+
 	if (vtEnabled)
 	{
 	    /*
@@ -261,12 +269,13 @@ OPENCONSOLE:
     else /* serverGeneration != 1 */
     {
 #ifdef HAS_USL_VTS
-	if (vtEnabled)
+	if (vtEnabled && !xf86Info.ShareVTs)
 	{
 	    /*
 	     * Now re-get the VT
 	     */
-	    switch_to(xf86Info.vtno, "xf86OpenConsole");
+	    if (xf86Info.autoVTSwitch)
+		switch_to(xf86Info.vtno, "xf86OpenConsole");
 
 #ifdef VT_SET_CONSUSER /* added in snv_139 */
 	    if (strcmp(display, "0") == 0)
@@ -355,7 +364,8 @@ xf86CloseConsole(void)
 	}
 
 	/* Activate the VT that X was started on */
-	switch_to(xf86StartVT, "xf86CloseConsole");
+	if (xf86Info.autoVTSwitch)
+	    switch_to(xf86StartVT, "xf86CloseConsole");
     }
 #endif /* HAS_USL_VTS */
 
commit 7e127f12a24acb8f43055af0a9be1ec585bbed36
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu May 19 23:22:27 2011 -0700

    sun_init.c: Move vt switches to a switch_to helper function like lnx_init.c
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 281a6df..d8c897d 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -63,6 +63,22 @@ static char consoleDev[PATH_MAX] = "/dev/fb";
    Used by hw/xfree86/common/xf86AutoConfig.c for VIS_GETIDENTIFIER */
 _X_HIDDEN char xf86SolarisFbDev[PATH_MAX] = "/dev/fb";
 
+static void
+switch_to(int vt, const char *from)
+{
+    int ret;
+
+    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
+    if (ret != 0)
+        xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n",
+		from, strerror(errno));
+
+    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
+    if (ret != 0)
+        xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n",
+		from, strerror(errno));
+}
+
 void
 xf86OpenConsole(void)
 {
@@ -206,11 +222,7 @@ OPENCONSOLE:
 	    /*
 	     * Now get the VT
 	     */
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
-		xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
-
-	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
-		xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+	    switch_to(xf86Info.vtno, "xf86OpenConsole");
 
 #ifdef VT_SET_CONSUSER /* added in snv_139 */
 	    if (strcmp(display, "0") == 0)
@@ -254,11 +266,7 @@ OPENCONSOLE:
 	    /*
 	     * Now re-get the VT
 	     */
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
-		xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
-
-	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
-		xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+	    switch_to(xf86Info.vtno, "xf86OpenConsole");
 
 #ifdef VT_SET_CONSUSER /* added in snv_139 */
 	    if (strcmp(display, "0") == 0)
@@ -347,7 +355,7 @@ xf86CloseConsole(void)
 	}
 
 	/* Activate the VT that X was started on */
-	ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT);
+	switch_to(xf86StartVT, "xf86CloseConsole");
     }
 #endif /* HAS_USL_VTS */
 
commit a00dc6af6e84d0bee3f69d8df89d7f68cb535d35
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu May 19 22:43:56 2011 -0700

    Xorg.man: Add -novtswitch and -sharevts options
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
index c89b5ee..2fa72d6 100644
--- a/hw/xfree86/man/Xorg.man
+++ b/hw/xfree86/man/Xorg.man
@@ -334,6 +334,10 @@ as root (i.e, with real-uid 0).
 .B \-nosilk
 Disable Silken Mouse support.
 .TP 8
+.B \-novtswitch
+Disable the automatic switching on X server reset and shutdown to the
+VT that was active when the server started, if supported by the OS.
+.TP 8
 .B \-pixmap24
 Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel.
 The default is usually 32 bits per pixel.  There is normally little
@@ -376,6 +380,9 @@ and
 .B \-ggamma
 options.
 .TP 8
+.B \-sharevts
+Share virtual terminals with another X server, if supported by the OS.
+.TP 8
 .BI \-screen " screen-name"
 Use the __xconfigfile__(__filemansuffix__) file
 .B Screen
commit 93abda6bddf770dbfc3d4d0ada61ea84a7b7b9be
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu May 19 22:39:09 2011 -0700

    xfree86: move -novtswitch & -sharevts argument handling up to common layer
    
    Stop duplicating in each os-support variant before it gets replicated
    even further.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Alexandr Shadchin <Alexandr.Shadchin at gmail.com>

diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 16d5557..f2e88c2 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -103,6 +103,8 @@ xf86InfoRec xf86Info = {
     .vtPendingNum               = -1,
 #endif
     .dontVTSwitch               = FALSE,
+    .autoVTSwitch               = TRUE,
+    .ShareVTs                   = FALSE,
     .dontZap                    = FALSE,
     .dontZoom                   = FALSE,
     .notrapSignals              = FALSE,
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 71926f8..93ea333 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1352,6 +1352,16 @@ ddxProcessArgument(int argc, char **argv, int i)
     xf86xkbdirFlag = TRUE;
     return 0;
   }
+  if (!strcmp(argv[i], "-novtswitch"))
+  {
+    xf86Info.autoVTSwitch = FALSE;
+    return 1;
+  }
+  if (!strcmp(argv[i], "-sharevts"))
+  {
+    xf86Info.ShareVTs = TRUE;
+    return 1;
+  }
 
   /* OS-specific processing */
   return xf86ProcessArgument(argc, argv, i);
@@ -1408,6 +1418,8 @@ ddxUseMsg(void)
   ErrorF("-version               show the server version\n");
   ErrorF("-showDefaultModulePath show the server default module path\n");
   ErrorF("-showDefaultLibPath    show the server default library path\n");
+  ErrorF("-novtswitch            don't automatically switch VT at reset & exit\n");
+  ErrorF("-sharevts              share VTs with another X server\n");
   /* OS-specific usage */
   xf86UseMsg();
   ErrorF("\n");
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 608f9bd..cdc67cb 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -66,6 +66,8 @@ typedef struct {
     int			vtPendingNum;
 #endif
     Bool		dontVTSwitch;
+    Bool		autoVTSwitch;
+    Bool		ShareVTs;
     Bool		dontZap;
     Bool		dontZoom;
     Bool		notrapSignals;	/* don't exit cleanly - die at fault */
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 123eb17..837a2f4 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -45,7 +45,6 @@ static int devConsoleFd = -1;
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 static int VTnum = -1;
 static int initialVT = -1;
-static Bool ShareVTs = FALSE;
 #endif
 
 #ifdef PCCONS_SUPPORT
@@ -266,7 +265,7 @@ xf86OpenConsole()
 	    }
 #endif
 acquire_vt:
-	    if (!ShareVTs) {
+	    if (!xf86Info.ShareVTs) {
 		    /*
 		     * now get the VT
 		     */
@@ -304,7 +303,7 @@ acquire_vt:
 		    {
 			FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
 		    }
-	    } else { /* ShareVTs */
+	    } else { /* xf86Info.ShareVTs */
 		    close(xf86Info.consoleFd);
 	    }	
   	    break; 
@@ -320,7 +319,8 @@ acquire_vt:
     {
 	/* serverGeneration != 1 */
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
-    	if (!ShareVTs) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
+	if (!xf86Info.ShareVTs &&
+	    (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT))
     	{
 	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
 	    {
@@ -393,7 +393,7 @@ xf86OpenSyscons()
 	    if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
 		initialVT = -1;
 #endif
-            if (ShareVTs)
+            if (xf86Info.ShareVTs)
 		xf86Info.vtno = initialVT;
 
 	    if (xf86Info.vtno == -1)
@@ -655,7 +655,7 @@ xf86CloseConsole()
     struct vt_mode   VT;
 #endif
 
-    if (ShareVTs) return;
+    if (xf86Info.ShareVTs) return;
 
     switch (xf86Info.consType)
     {
@@ -723,11 +723,6 @@ xf86ProcessArgument(int argc, char *argv[], int i)
 		return 1;
 	}
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
-	if (!strcmp(argv[i], "-sharevts"))
-	{	
-		ShareVTs = TRUE;
-		return 1;
-	}
 	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
 	{
 		if (sscanf(argv[i], "vt%2d", &VTnum) == 0 ||
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 77dfb2f..9c91740 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -39,8 +39,6 @@
 #include <sys/stat.h>
 
 static Bool KeepTty = FALSE;
-static Bool VTSwitch = TRUE;
-static Bool ShareVTs = FALSE;
 static int activeVT = -1;
 
 static char vtname[11];
@@ -109,7 +107,7 @@ xf86OpenConsole(void)
 		    "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
 		    strerror(errno));
 
-            if (ShareVTs)
+            if (xf86Info.ShareVTs)
             {
 		SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
 		if (ret < 0)
@@ -184,7 +182,7 @@ xf86OpenConsole(void)
 	}
 #endif
 
-        if (!ShareVTs)
+        if (!xf86Info.ShareVTs)
         {
             struct termios nTty;
 
@@ -240,7 +238,7 @@ xf86OpenConsole(void)
 	     * of Init?$#*&Device(). So I just place it here */
         }
     } else { 	/* serverGeneration != 1 */
-        if (!ShareVTs && VTSwitch)
+        if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch)
         {
 	    /* now get the VT */
             switch_to(xf86Info.vtno, "xf86OpenConsole");
@@ -254,7 +252,7 @@ xf86CloseConsole(void)
     struct vt_mode   VT;
     int ret;
 
-    if (ShareVTs) {
+    if (xf86Info.ShareVTs) {
         close(xf86Info.consoleFd);
         return;
     }
@@ -286,7 +284,7 @@ xf86CloseConsole(void)
 		    strerror(errno));
     }
 
-    if (VTSwitch)
+    if (xf86Info.autoVTSwitch)
     {
         /*
          * Perform a switch back to the active VT when we were started
@@ -311,16 +309,7 @@ xf86ProcessArgument(int argc, char *argv[], int i)
 		KeepTty = TRUE;
 		return 1;
 	}
-        if (!strcmp(argv[i], "-novtswitch"))
-        {
-                VTSwitch = FALSE;
-                return 1;
-        }
-        if (!strcmp(argv[i], "-sharevts"))
-        {
-                ShareVTs = TRUE;
-                return 1;
-        }
+
 	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
 	{
 		if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
@@ -340,6 +329,4 @@ xf86UseMsg(void)
 	ErrorF("vtXX                   use the specified VT number\n");
 	ErrorF("-keeptty               ");
 	ErrorF("don't detach controlling tty (for debugging only)\n");
-	ErrorF("-novtswitch            don't immediately switch to new VT\n");
-	ErrorF("-sharevts              share VTs with another X server\n");
 }


More information about the xorg-commit mailing list