From 18ba866bb4c2bf87842188aa0b66efadb402783f Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Tue, 11 Sep 2012 00:15:22 +0300 Subject: [PATCH] staging: xgifb: use a real pointer for TV DATAPTR Replace DATAPTR numbers with a real pointer to make code simpler. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xgifb/vb_setmode.c | 48 +----------------------------- drivers/staging/xgifb/vb_struct.h | 2 +- drivers/staging/xgifb/vb_table.h | 30 +++++++++---------- 3 files changed, 17 insertions(+), 63 deletions(-) diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 08879f4a9b93..cd40daffe1ce 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -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, diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index 230c54f86b28..2eaeb2654f72 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -69,7 +69,7 @@ struct XGI330_LCDDataTablStruct { struct XGI330_TVDataTablStruct { unsigned short MASK; unsigned short CAP; - unsigned short DATAPTR; + struct SiS_TVData const *DATAPTR; }; diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index 441cb39634c0..05d9ab1879a1 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -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[] = { -- 2.20.1