提交 df47e533 编写于 作者: A Adrian Bunk 提交者: Greg Kroah-Hartman

[PATCH] USB: sisusbvga: possible cleanups

This patch contains the following possible cleanups:
- make needlessly global functions static
- function and struct declarations belong into header files
- make SiS_VCLKData const
- #if 0 the following unused global functions:
  - sisusb.c: sisusb_writew()
  - sisusb.c: sisusb_readw()
  - sisusb_init.c: SiSUSB_GetModeID()
Signed-off-by: NAdrian Bunk <bunk@stusta.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 2682d27c
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include "sisusb.h" #include "sisusb.h"
#include "sisusb_init.h"
#ifdef INCL_SISUSB_CON #ifdef INCL_SISUSB_CON
#include <linux/font.h> #include <linux/font.h>
...@@ -63,36 +64,6 @@ ...@@ -63,36 +64,6 @@
/* Forward declarations / clean-up routines */ /* Forward declarations / clean-up routines */
#ifdef INCL_SISUSB_CON #ifdef INCL_SISUSB_CON
int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data);
int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data);
int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data);
int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data);
int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand, u8 myor);
int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor);
int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand);
int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data);
int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data);
int sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data);
int sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data);
int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
u32 dest, int length, size_t *bytes_written);
int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init);
extern int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
extern int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo);
extern void sisusb_init_concode(void);
extern int sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last);
extern void sisusb_console_exit(struct sisusb_usb_data *sisusb);
extern void sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location);
extern int sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot,
u8 *arg, int cmapsz, int ch512, int dorecalc,
struct vc_data *c, int fh, int uplock);
static int sisusb_first_vc = 0; static int sisusb_first_vc = 0;
static int sisusb_last_vc = 0; static int sisusb_last_vc = 0;
module_param_named(first, sisusb_first_vc, int, 0); module_param_named(first, sisusb_first_vc, int, 0);
...@@ -1360,9 +1331,6 @@ sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) ...@@ -1360,9 +1331,6 @@ sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data)
} }
#endif #endif
#ifndef INCL_SISUSB_CON
static
#endif
int int
sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data)
{ {
...@@ -1372,9 +1340,6 @@ sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) ...@@ -1372,9 +1340,6 @@ sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data)
return ret; return ret;
} }
#ifndef INCL_SISUSB_CON
static
#endif
int int
sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data)
{ {
...@@ -1384,9 +1349,6 @@ sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) ...@@ -1384,9 +1349,6 @@ sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data)
return ret; return ret;
} }
#ifndef INCL_SISUSB_CON
static
#endif
int int
sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx,
u8 myand, u8 myor) u8 myand, u8 myor)
...@@ -1416,18 +1378,12 @@ sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx, ...@@ -1416,18 +1378,12 @@ sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx,
return ret; return ret;
} }
#ifndef INCL_SISUSB_CON
static
#endif
int int
sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor) sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor)
{ {
return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor)); return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor));
} }
#ifndef INCL_SISUSB_CON
static
#endif
int int
sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand) sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand)
{ {
...@@ -1449,6 +1405,8 @@ sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data) ...@@ -1449,6 +1405,8 @@ sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data)
return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data)); return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
} }
#if 0
int int
sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data) sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data)
{ {
...@@ -1461,6 +1419,8 @@ sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data) ...@@ -1461,6 +1419,8 @@ sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data)
return(sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data)); return(sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data));
} }
#endif /* 0 */
int int
sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
u32 dest, int length, size_t *bytes_written) u32 dest, int length, size_t *bytes_written)
......
...@@ -70,27 +70,9 @@ ...@@ -70,27 +70,9 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include "sisusb.h" #include "sisusb.h"
#include "sisusb_init.h"
#ifdef INCL_SISUSB_CON #ifdef INCL_SISUSB_CON
extern int sisusb_setreg(struct sisusb_usb_data *, int, u8);
extern int sisusb_getreg(struct sisusb_usb_data *, int, u8 *);
extern int sisusb_setidxreg(struct sisusb_usb_data *, int, u8, u8);
extern int sisusb_getidxreg(struct sisusb_usb_data *, int, u8, u8 *);
extern int sisusb_setidxregor(struct sisusb_usb_data *, int, u8, u8);
extern int sisusb_setidxregand(struct sisusb_usb_data *, int, u8, u8);
extern int sisusb_setidxregandor(struct sisusb_usb_data *, int, u8, u8, u8);
extern int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data);
extern int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data);
extern int sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data);
extern int sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data);
extern int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
u32 dest, int length, size_t *bytes_written);
extern void sisusb_delete(struct kref *kref);
extern int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init);
extern int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
#define sisusbcon_writew(val, addr) (*(addr) = (val)) #define sisusbcon_writew(val, addr) (*(addr) = (val))
#define sisusbcon_readw(addr) (*(addr)) #define sisusbcon_readw(addr) (*(addr))
...@@ -103,8 +85,6 @@ static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES]; ...@@ -103,8 +85,6 @@ static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES];
/* Forward declaration */ /* Forward declaration */
static const struct consw sisusb_con; static const struct consw sisusb_con;
extern struct mutex disconnect_mutex;
static inline void static inline void
sisusbcon_memsetw(u16 *s, u16 c, unsigned int count) sisusbcon_memsetw(u16 *s, u16 c, unsigned int count)
{ {
...@@ -1487,7 +1467,7 @@ static int sisusbdummycon_dummy(void) ...@@ -1487,7 +1467,7 @@ static int sisusbdummycon_dummy(void)
#define SISUSBCONDUMMY (void *)sisusbdummycon_dummy #define SISUSBCONDUMMY (void *)sisusbdummycon_dummy
const struct consw sisusb_dummy_con = { static const struct consw sisusb_dummy_con = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.con_startup = sisusbdummycon_startup, .con_startup = sisusbdummycon_startup,
.con_init = sisusbdummycon_init, .con_init = sisusbdummycon_init,
......
...@@ -74,6 +74,7 @@ SiSUSB_InitPtr(struct SiS_Private *SiS_Pr) ...@@ -74,6 +74,7 @@ SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
/* HELPER: Get ModeID */ /* HELPER: Get ModeID */
/*********************************************/ /*********************************************/
#if 0
unsigned short unsigned short
SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth) SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth)
{ {
...@@ -157,6 +158,7 @@ SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth) ...@@ -157,6 +158,7 @@ SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth)
return ModeIndex; return ModeIndex;
} }
#endif /* 0 */
/*********************************************/ /*********************************************/
/* HELPER: SetReg, GetReg */ /* HELPER: SetReg, GetReg */
...@@ -233,7 +235,7 @@ SiS_DisplayOn(struct SiS_Private *SiS_Pr) ...@@ -233,7 +235,7 @@ SiS_DisplayOn(struct SiS_Private *SiS_Pr)
/* HELPER: Init Port Addresses */ /* HELPER: Init Port Addresses */
/*********************************************/ /*********************************************/
void static void
SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr) SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
{ {
SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; SiS_Pr->SiS_P3c4 = BaseAddr + 0x14;
......
...@@ -690,7 +690,7 @@ static const struct SiS_CRT1Table SiSUSB_CRT1Table[] = ...@@ -690,7 +690,7 @@ static const struct SiS_CRT1Table SiSUSB_CRT1Table[] =
0x41}} /* 0x54 */ 0x41}} /* 0x54 */
}; };
static struct SiS_VCLKData SiSUSB_VCLKData[] = static const struct SiS_VCLKData SiSUSB_VCLKData[] =
{ {
{ 0x1b,0xe1, 25}, /* 0x00 */ { 0x1b,0xe1, 25}, /* 0x00 */
{ 0x4e,0xe4, 28}, /* 0x01 */ { 0x4e,0xe4, 28}, /* 0x01 */
...@@ -808,8 +808,8 @@ static struct SiS_VCLKData SiSUSB_VCLKData[] = ...@@ -808,8 +808,8 @@ static struct SiS_VCLKData SiSUSB_VCLKData[] =
{ 0x2b,0xc2, 35} /* 0x71 768@576@60 */ { 0x2b,0xc2, 35} /* 0x71 768@576@60 */
}; };
void SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr); extern struct mutex disconnect_mutex;
unsigned short SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth);
int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo);
...@@ -826,5 +826,19 @@ extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, ...@@ -826,5 +826,19 @@ extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port,
extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port,
u8 idx, u8 myand); u8 idx, u8 myand);
void sisusb_delete(struct kref *kref);
int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data);
int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data);
int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
u32 dest, int length, size_t *bytes_written);
int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init);
int sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot,
u8 *arg, int cmapsz, int ch512, int dorecalc,
struct vc_data *c, int fh, int uplock);
void sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location);
int sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last);
void sisusb_console_exit(struct sisusb_usb_data *sisusb);
void sisusb_init_concode(void);
#endif #endif
...@@ -161,7 +161,7 @@ struct SiS_Private ...@@ -161,7 +161,7 @@ struct SiS_Private
const struct SiS_Ext *SiS_EModeIDTable; const struct SiS_Ext *SiS_EModeIDTable;
const struct SiS_Ext2 *SiS_RefIndex; const struct SiS_Ext2 *SiS_RefIndex;
const struct SiS_CRT1Table *SiS_CRT1Table; const struct SiS_CRT1Table *SiS_CRT1Table;
struct SiS_VCLKData *SiS_VCLKData; const struct SiS_VCLKData *SiS_VCLKData;
const struct SiS_ModeResInfo *SiS_ModeResInfo; const struct SiS_ModeResInfo *SiS_ModeResInfo;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册