video: fbdev: sis: avoid mismatched prototypes
Subsystems (2)
PATCH 1/1 video: fbdev: sis: avoid mismatched prototypes
Building with LTO enabled reveals some functions whose prototypes in the header are different from the definition:
drivers/video/fbdev/sis/sis_main.h:765:0: error: type of 'SiS_SetCH70xxANDOR' does not match original declaration [-Werror=lto-type-mismatch]
extern void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
drivers/video/fbdev/sis/init301.c:8937:0: note: type mismatch in parameter 4
SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
drivers/video/fbdev/sis/init301.c:8937:0: note: type 'short unsigned int' should match type 'unsigned char' drivers/video/fbdev/sis/init301.c:8937:0: note: 'SiS_SetCH70xxANDOR' was previously declared here
The root cause appears to be the way that header files are used in this driver, where they contain both static variable and declarations for symbols in other files.
To clean that up, I'm changing all mixed headers to only contain declarations the way we normally do in C, or contain only static variables, and move the rest to a more appropriate place. Once that is done, the headers can be included in the other files as well, and guarantee that the prototypes match.
There are a few headers that now only contain static variables, and I'm leaving those alone here as the patch is already too big. These could be trivially moved into the respective .c files.
--- drivers/video/fbdev/sis/init.h | 76 --------- drivers/video/fbdev/sis/init301.c | 326 +++++++++++++++++++++++++++++++++++++ drivers/video/fbdev/sis/init301.h | 320 ------------------------------------ drivers/video/fbdev/sis/sis.h | 131 +++++++++++++++ drivers/video/fbdev/sis/sis_main.c | 51 ++++++ drivers/video/fbdev/sis/sis_main.h | 117 ------------- 6 files changed, 508 insertions(+), 513 deletions(-)
drivers/video/fbdev/sis/init.h +0 -76
@@ -1461,81 +1461,5 @@ static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] 0x00}} }; -bool SiSInitPtr (struct SiS_Private *SiS_Pr); -unsigned short SiS_GetModeID_LCD (int VGAEngine,unsigned int VBFlags,int HDisplay, -int VDisplay,int Depth,bool FSTN , -unsigned short CustomT,int LCDwith,int LCDheight, -unsigned int VBFlags2); -unsigned short SiS_GetModeID_TV (int VGAEngine,unsigned int VBFlags,int HDisplay, -int VDisplay,int Depth,unsigned int VBFlags2); -unsigned short SiS_GetModeID_VGA2 (int VGAEngine,unsigned int VBFlags,int HDisplay, -int VDisplay,int Depth,unsigned int VBFlags2); - -void SiS_DisplayOn (struct SiS_Private *SiS_Pr); -void SiS_DisplayOff (struct SiS_Private *SiS_Pr); -void SiSRegInit (struct SiS_Private *SiS_Pr,SISIOADDRESS BaseAddr); -void SiS_SetEnableDstn (struct SiS_Private *SiS_Pr,int enable); -void SiS_SetEnableFstn (struct SiS_Private *SiS_Pr,int enable); -unsigned short SiS_GetModeFlag (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -bool SiSDetermineROMLayout661 (struct SiS_Private *SiS_Pr); - -bool SiS_SearchModeID (struct SiS_Private *SiS_Pr,unsigned short *ModeNo, -unsigned short *ModeIdIndex); -unsigned short SiS_GetModePtr (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -unsigned short SiS_GetRefCRTVCLK (struct SiS_Private *SiS_Pr,unsigned short Index,int UseWide); -unsigned short SiS_GetRefCRT1CRTC (struct SiS_Private *SiS_Pr,unsigned short Index,int UseWide); -unsigned short SiS_GetColorDepth (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -unsigned short SiS_GetOffset (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex,unsigned short RRTI ); -#ifdef CONFIG_FB_SIS_300 -void SiS_GetFIFOThresholdIndex300 (struct SiS_Private *SiS_Pr,unsigned short *idx1, -unsigned short *idx2); -unsigned short SiS_GetFIFOThresholdB300 (unsigned short idx1,unsigned short idx2); -unsigned short SiS_GetLatencyFactor630 (struct SiS_Private *SiS_Pr,unsigned short index); -#endif -void SiS_LoadDAC (struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned short ModeIdIndex); -bool SiSSetMode (struct SiS_Private *SiS_Pr,unsigned short ModeNo); -void SiS_CalcCRRegisters (struct SiS_Private *SiS_Pr,int depth); -void SiS_CalcLCDACRT1Timing (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -void SiS_Generic_ConvertCRData (struct SiS_Private *SiS_Pr,unsigned char *crdata,int xres, -int yres,struct fb_var_screeninfo *var,bool writeres); - -/* From init301.c: */ -extern void SiS_GetVBInfo (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex,int chkcrt2mode); -extern void SiS_GetLCDResInfo (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -extern void SiS_SetYPbPr (struct SiS_Private *SiS_Pr); -extern void SiS_SetTVMode (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -extern void SiS_UnLockCRT2 (struct SiS_Private *SiS_Pr); -extern void SiS_DisableBridge (struct SiS_Private *); -extern bool SiS_SetCRT2Group (struct SiS_Private *,unsigned short ); -extern unsigned short SiS_GetRatePtr (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -extern void SiS_WaitRetrace1 (struct SiS_Private *SiS_Pr); -extern unsigned short SiS_GetResInfo (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex); -extern unsigned short SiS_GetCH700x (struct SiS_Private *SiS_Pr,unsigned short tempax); -extern unsigned short SiS_GetVCLK2Ptr (struct SiS_Private *SiS_Pr,unsigned short ModeNo, -unsigned short ModeIdIndex,unsigned short RRTI ); -extern bool SiS_IsVAMode (struct SiS_Private *); -extern bool SiS_IsDualEdge (struct SiS_Private *); - -#ifdef CONFIG_FB_SIS_300 -extern unsigned int sisfb_read_nbridge_pci_dword (struct SiS_Private *SiS_Pr,int reg); -extern void sisfb_write_nbridge_pci_dword (struct SiS_Private *SiS_Pr,int reg, -unsigned int val); -#endif -#ifdef CONFIG_FB_SIS_315 -extern void sisfb_write_nbridge_pci_byte (struct SiS_Private *SiS_Pr,int reg, -unsigned char val); -extern unsigned int sisfb_read_mio_pci_word (struct SiS_Private *SiS_Pr,int reg); -#endif -#endif
drivers/video/fbdev/sis/init301.c +325 -0
331 lines not on this page · raw message
drivers/video/fbdev/sis/init301.h +0 -319
342 lines not on this page · raw message
drivers/video/fbdev/sis/sis.h +131 -0
147 lines not on this page · raw message
drivers/video/fbdev/sis/sis_main.c +51 -0
66 lines not on this page · raw message
drivers/video/fbdev/sis/sis_main.h +0 -117
121 lines not on this page · raw message
Signature · 1 line
2.9.0
Quoted 22 lines · Arnd Bergmann
Building with LTO enabled reveals some functions whose prototypes in the header are different from the definition:
drivers/video/fbdev/sis/sis_main.h:765:0: error: type of 'SiS_SetCH70xxANDOR' does not match original declaration [-Werror=lto-type-mismatch]
extern void SiS_SetCH70xxANDOR(structSiS_Private*SiS_Pr, unsigned short reg,
drivers/video/fbdev/sis/init301.c:8937:0: note: type mismatch in parameter 4
SiS_SetCH70xxANDOR(structSiS_Private*SiS_Pr, unsigned short reg,
drivers/video/fbdev/sis/init301.c:8937:0: note: type 'short unsigned int' should match type 'unsigned char'drivers/video/fbdev/sis/init301.c:8937:0: note: 'SiS_SetCH70xxANDOR' was previously declared hereThe root cause appears to be the way that header files are used in this driver, where they contain both static variable and declarations for symbols in other files.
To clean that up, I'm changing all mixed headers to only contain declarations the way we normally do in C, or contain only static variables, and move the rest to a more appropriate place. Once that is done, the headers can be included in the other files as well, and guarantee that the prototypes match.
Quoted 5 lines
There are a few headers that now only contain static variables, and I'm leaving those alone here as the patch is already too big. These could be trivially moved into the respective .c files.
Signed-off-by Arnd Bergmann <[email protected]>
Patch queued for 4.17, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics