staging: xgifb: use a real pointer for TV DATAPTR
authorAaro Koskinen <aaro.koskinen@iki.fi>
Mon, 10 Sep 2012 21:15:22 +0000 (00:15 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Sep 2012 22:48:16 +0000 (15:48 -0700)
Replace DATAPTR numbers with a real pointer to make code simpler.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/xgifb/vb_setmode.c
drivers/staging/xgifb/vb_struct.h
drivers/staging/xgifb/vb_table.h

index 08879f4..cd40daf 100644 (file)
@@ -1791,53 +1791,7 @@ static struct SiS_TVData const *XGI_GetTVPtr(unsigned short ModeNo,
                i++;
        }
 
-       switch (XGI_TVDataTable[i].DATAPTR) {
-       case 0:
-               return &XGI_ExtPALData[tempal];
-               break;
-       case 1:
-               return &XGI_ExtNTSCData[tempal];
-               break;
-       case 2:
-               return &XGI_StPALData[tempal];
-               break;
-       case 3:
-               return &XGI_StNTSCData[tempal];
-               break;
-       case 4:
-               return &XGI_ExtHiTVData[tempal];
-               break;
-       case 5:
-               return &XGI_St2HiTVData[tempal];
-               break;
-       case 6:
-               return &XGI_ExtYPbPr525iData[tempal];
-               break;
-       case 7:
-               return &XGI_ExtYPbPr525pData[tempal];
-               break;
-       case 8:
-               return &XGI_ExtYPbPr750pData[tempal];
-               break;
-       case 9:
-               return &XGI_StYPbPr525iData[tempal];
-               break;
-       case 10:
-               return &XGI_StYPbPr525pData[tempal];
-               break;
-       case 11:
-               return &XGI_StYPbPr750pData[tempal];
-               break;
-       case 12: /* avoid system hang */
-               return &XGI_ExtNTSCData[tempal];
-               break;
-       case 13:
-               return &XGI_St1HiTVData[tempal];
-               break;
-       default:
-               break;
-       }
-       return NULL;
+       return &XGI_TVDataTable[i].DATAPTR[tempal];
 }
 
 static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
index 230c54f..2eaeb26 100644 (file)
@@ -69,7 +69,7 @@ struct XGI330_LCDDataTablStruct {
 struct XGI330_TVDataTablStruct {
        unsigned short MASK;
        unsigned short CAP;
-       unsigned short DATAPTR;
+       struct SiS_TVData const *DATAPTR;
 };
 
 
index 441cb39..05d9ab1 100644 (file)
@@ -1872,21 +1872,21 @@ static struct XGI330_LCDDataTablStruct XGI_EPLCHLCDRegPtr[] = {
        {0xFF, 0x0000, 0x0000, 0}
 };
 
-static struct XGI330_TVDataTablStruct XGI_TVDataTable[] = {
-       {0x09E1, 0x0001, 0}, /* XGI_ExtPALData */
-       {0x09E1, 0x0000, 1}, /* XGI_ExtNTSCData */
-       {0x09E1, 0x0801, 2}, /* XGI_StPALData */
-       {0x09E1, 0x0800, 3}, /* XGI_StNTSCData */
-       {0x49E0, 0x0100, 4}, /* XGI_ExtHiTVData */
-       {0x49E0, 0x4100, 5}, /* XGI_St2HiTVData */
-       {0x49E0, 0x4900, 13}, /* XGI_St1HiTVData */
-       {0x09E0, 0x0020, 6}, /* XGI_ExtYPbPr525iData */
-       {0x09E0, 0x0040, 7}, /* XGI_ExtYPbPr525pData */
-       {0x09E0, 0x0080, 8}, /* XGI_ExtYPbPr750pData */
-       {0x09E0, 0x0820, 9}, /* XGI_StYPbPr525iData */
-       {0x09E0, 0x0840, 10}, /* XGI_StYPbPr525pData */
-       {0x09E0, 0x0880, 11}, /* XGI_StYPbPr750pData */
-       {0xffff, 0x0000, 12}  /* END */
+static const struct XGI330_TVDataTablStruct XGI_TVDataTable[] = {
+       {0x09E1, 0x0001, XGI_ExtPALData},
+       {0x09E1, 0x0000, XGI_ExtNTSCData},
+       {0x09E1, 0x0801, XGI_StPALData},
+       {0x09E1, 0x0800, XGI_StNTSCData},
+       {0x49E0, 0x0100, XGI_ExtHiTVData},
+       {0x49E0, 0x4100, XGI_St2HiTVData},
+       {0x49E0, 0x4900, XGI_St1HiTVData},
+       {0x09E0, 0x0020, XGI_ExtYPbPr525iData},
+       {0x09E0, 0x0040, XGI_ExtYPbPr525pData},
+       {0x09E0, 0x0080, XGI_ExtYPbPr750pData},
+       {0x09E0, 0x0820, XGI_StYPbPr525iData},
+       {0x09E0, 0x0840, XGI_StYPbPr525pData},
+       {0x09E0, 0x0880, XGI_StYPbPr750pData},
+       {0xffff, 0x0000, XGI_ExtNTSCData},
 };
 
 static unsigned short LCDLenList[] = {