Re: [PATCH] video: fbdev: sis: avoid mismatched prototypes

2018-03-12 Thread Bartlomiej Zolnierkiewicz
On Friday, February 02, 2018 04:00:48 PM Arnd Bergmann wrote:
> 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.
> 
> Signed-off-by: Arnd Bergmann 

Patch queued for 4.17, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] video: fbdev: sis: avoid mismatched prototypes

2018-02-02 Thread 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(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.

Signed-off-by: Arnd Bergmann 
---
 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(-)

diff --git a/drivers/video/fbdev/sis/init.h b/drivers/video/fbdev/sis/init.h
index 85d6738b6c64..400b0e5681b2 100644
--- a/drivers/video/fbdev/sis/init.h
+++ b/drivers/video/fbdev/sis/init.h
@@ -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