Skip to content

Commit

Permalink
staging: xgifb: use proper typing for TV data
Browse files Browse the repository at this point in the history
There's a dangerous cast from XGI330_TVDataStruct to SiS_TVData. Use
SiS_TVData everywhere, also the data can be made const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Aaro Koskinen authored and Greg Kroah-Hartman committed Sep 10, 2012
1 parent 6265ee4 commit 2457254
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 30 deletions.
9 changes: 5 additions & 4 deletions drivers/staging/xgifb/vb_setmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
return NULL;
}

static void *XGI_GetTVPtr(unsigned short ModeNo,
static struct SiS_TVData const *XGI_GetTVPtr(unsigned short ModeNo,
unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
Expand Down Expand Up @@ -3264,7 +3264,6 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short tempax = 0, tempbx, modeflag, resinfo;

struct SiS_LCDData *LCDPtr = NULL;
struct SiS_TVData *TVPtr = NULL;

/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
Expand Down Expand Up @@ -3365,8 +3364,10 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
}

if (pVBInfo->VBInfo & (SetCRT2ToTV)) {
TVPtr = (struct SiS_TVData *) XGI_GetTVPtr(ModeNo, ModeIdIndex,
RefreshRateTableIndex, pVBInfo);
struct SiS_TVData const *TVPtr;

TVPtr = XGI_GetTVPtr(ModeNo, ModeIdIndex, RefreshRateTableIndex,
pVBInfo);

pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX;
pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT;
Expand Down
13 changes: 0 additions & 13 deletions drivers/staging/xgifb/vb_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,6 @@ struct XGI330_LCDDataDesStruct2 {
unsigned short LCDVSync;
};


struct XGI330_TVDataStruct {
unsigned short RVBHCMAX;
unsigned short RVBHCFACT;
unsigned short VGAHT;
unsigned short VGAVT;
unsigned short TVHDE;
unsigned short TVVDE;
unsigned short RVBHRS;
unsigned char FlickerMode;
unsigned short HALFRVBHRS;
};

struct XGI330_LCDDataTablStruct {
unsigned char PANELID;
unsigned short MASK;
Expand Down
26 changes: 13 additions & 13 deletions drivers/staging/xgifb/vb_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] = {
{9, 1337, 0, 771, 112, 6} /* ; 0A (1280x768x60Hz) */
};

static struct XGI330_TVDataStruct XGI_StPALData[] = {
static const struct SiS_TVData XGI_StPALData[] = {
{1, 1, 864, 525, 1270, 400, 100, 0, 760},
{1, 1, 864, 525, 1270, 350, 100, 0, 760},
{1, 1, 864, 525, 1270, 400, 0, 0, 720},
Expand All @@ -891,7 +891,7 @@ static struct XGI330_TVDataStruct XGI_StPALData[] = {
{1, 1, 864, 525, 1270, 600, 50, 0, 0}
};

static struct XGI330_TVDataStruct XGI_ExtPALData[] = {
static const struct SiS_TVData XGI_ExtPALData[] = {
{2, 1, 1080, 463, 1270, 500, 50, 0, 50},
{15, 7, 1152, 413, 1270, 500, 50, 0, 50},
{2, 1, 1080, 463, 1270, 500, 50, 0, 50},
Expand All @@ -902,15 +902,15 @@ static struct XGI330_TVDataStruct XGI_ExtPALData[] = {
{3, 2, 1080, 619, 1270, 540, 438, 0, 438}
};

static struct XGI330_TVDataStruct XGI_StNTSCData[] = {
static const struct SiS_TVData XGI_StNTSCData[] = {
{1, 1, 858, 525, 1270, 400, 50, 0, 760},
{1, 1, 858, 525, 1270, 350, 50, 0, 640},
{1, 1, 858, 525, 1270, 400, 0, 0, 720},
{1, 1, 858, 525, 1270, 350, 0, 0, 720},
{1, 1, 858, 525, 1270, 480, 0, 0, 760}
};

static struct XGI330_TVDataStruct XGI_ExtNTSCData[] = {
static const struct SiS_TVData XGI_ExtNTSCData[] = {
{9, 5, 1001, 453, 1270, 420, 171, 0, 171},
{12, 5, 858, 403, 1270, 420, 171, 0, 171},
{9, 5, 1001, 453, 1270, 420, 171, 0, 171},
Expand All @@ -922,7 +922,7 @@ static struct XGI330_TVDataStruct XGI_ExtNTSCData[] = {
{3, 2, 1001, 533, 1270, 420, 0, 0, 0}
};

static struct XGI330_TVDataStruct XGI_St1HiTVData[] = {
static const struct SiS_TVData XGI_St1HiTVData[] = {
{1, 1, 892, 563, 690, 800, 0, 0, 0}, /* 00 (320x200,320x400,
640x200,640x400) */
{1, 1, 892, 563, 690, 700, 0, 0, 0}, /* 01 (320x350,640x350) */
Expand All @@ -932,7 +932,7 @@ static struct XGI330_TVDataStruct XGI_St1HiTVData[] = {
{8, 5, 1050, 683, 1648, 960, 0x150, 1, 0} /* 05 (400x300,800x600) */
};

static struct XGI330_TVDataStruct XGI_St2HiTVData[] = {
static const struct SiS_TVData XGI_St2HiTVData[] = {
{3, 1, 840, 483, 1648, 960, 0x032, 0, 0}, /* 00 (320x200,320x400,
640x200,640x400) */
{1, 1, 892, 563, 690, 700, 0, 0, 0}, /* 01 (320x350,640x350) */
Expand All @@ -942,7 +942,7 @@ static struct XGI330_TVDataStruct XGI_St2HiTVData[] = {
{8, 5, 1050, 683, 1648, 960, 0x17C, 1, 0} /* 05 (400x300,800x600) */
};

static struct XGI330_TVDataStruct XGI_ExtHiTVData[] = {
static const struct SiS_TVData XGI_ExtHiTVData[] = {
{6, 1, 840, 563, 1632, 960, 0, 0, 0}, /* 00 (320x200,320x400,
640x200,640x400) */
{3, 1, 960, 563, 1632, 960, 0, 0, 0}, /* 01 (320x350,640x350) */
Expand All @@ -957,7 +957,7 @@ static struct XGI330_TVDataStruct XGI_ExtHiTVData[] = {
{8, 5, 1750, 803, 1648, 960, 0x128, 0, 0} /* 0A (1280x720) */
};

static struct XGI330_TVDataStruct XGI_ExtYPbPr525iData[] = {
static const struct SiS_TVData XGI_ExtYPbPr525iData[] = {
{ 9, 5, 1001, 453, 1270, 420, 171, 0, 171},
{ 12, 5, 858, 403, 1270, 420, 171, 0, 171},
{ 9, 5, 1001, 453, 1270, 420, 171, 0, 171},
Expand All @@ -969,15 +969,15 @@ static struct XGI330_TVDataStruct XGI_ExtYPbPr525iData[] = {
{ 3, 2, 1001, 533, 1250, 420, 0, 0, 0}
};

static struct XGI330_TVDataStruct XGI_StYPbPr525iData[] = {
static const struct SiS_TVData XGI_StYPbPr525iData[] = {
{1, 1, 858, 525, 1270, 400, 50, 0, 760},
{1, 1, 858, 525, 1270, 350, 50, 0, 640},
{1, 1, 858, 525, 1270, 400, 0, 0, 720},
{1, 1, 858, 525, 1270, 350, 0, 0, 720},
{1, 1, 858, 525, 1270, 480, 0, 0, 760},
};

static struct XGI330_TVDataStruct XGI_ExtYPbPr525pData[] = {
static const struct SiS_TVData XGI_ExtYPbPr525pData[] = {
{ 9, 5, 1001, 453, 1270, 420, 171, 0, 171},
{ 12, 5, 858, 403, 1270, 420, 171, 0, 171},
{ 9, 5, 1001, 453, 1270, 420, 171, 0, 171},
Expand All @@ -989,15 +989,15 @@ static struct XGI330_TVDataStruct XGI_ExtYPbPr525pData[] = {
{ 3, 2, 1001, 533, 1270, 420, 0, 0, 0}
};

static struct XGI330_TVDataStruct XGI_StYPbPr525pData[] = {
static const struct SiS_TVData XGI_StYPbPr525pData[] = {
{1, 1, 1716, 525, 1270, 400, 50, 0, 760},
{1, 1, 1716, 525, 1270, 350, 50, 0, 640},
{1, 1, 1716, 525, 1270, 400, 0, 0, 720},
{1, 1, 1716, 525, 1270, 350, 0, 0, 720},
{1, 1, 1716, 525, 1270, 480, 0, 0, 760},
};

static struct XGI330_TVDataStruct XGI_ExtYPbPr750pData[] = {
static const struct SiS_TVData XGI_ExtYPbPr750pData[] = {
{ 3, 1, 935, 470, 1130, 680, 50, 0, 0}, /* 00 (320x200,320x400,
640x200,640x400) */
{24, 7, 935, 420, 1130, 680, 50, 0, 0}, /* 01 (320x350,640x350) */
Expand All @@ -1012,7 +1012,7 @@ static struct XGI330_TVDataStruct XGI_ExtYPbPr750pData[] = {
{10, 9, 1320, 830, 1130, 640, 50, 0, 0}
};

static struct XGI330_TVDataStruct XGI_StYPbPr750pData[] = {
static const struct SiS_TVData XGI_StYPbPr750pData[] = {
{1, 1, 1650, 750, 1280, 400, 50, 0, 760},
{1, 1, 1650, 750, 1280, 350, 50, 0, 640},
{1, 1, 1650, 750, 1280, 400, 0, 0, 720},
Expand Down

0 comments on commit 2457254

Please sign in to comment.