[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: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Adrian Bunk 2006-04-15 11:17:27 +02:00 committed by Greg Kroah-Hartman
parent 2682d27c58
commit df47e5330b
5 changed files with 28 additions and 72 deletions

View File

@ -53,6 +53,7 @@
#include <linux/vmalloc.h>
#include "sisusb.h"
#include "sisusb_init.h"
#ifdef INCL_SISUSB_CON
#include <linux/font.h>
@ -63,36 +64,6 @@
/* Forward declarations / clean-up routines */
#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_last_vc = 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)
}
#endif
#ifndef INCL_SISUSB_CON
static
#endif
int
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;
}
#ifndef INCL_SISUSB_CON
static
#endif
int
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;
}
#ifndef INCL_SISUSB_CON
static
#endif
int
sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx,
u8 myand, u8 myor)
@ -1416,18 +1378,12 @@ sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx,
return ret;
}
#ifndef INCL_SISUSB_CON
static
#endif
int
sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor)
{
return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor));
}
#ifndef INCL_SISUSB_CON
static
#endif
int
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)
return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
}
#if 0
int
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)
return(sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data));
}
#endif /* 0 */
int
sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
u32 dest, int length, size_t *bytes_written)

View File

@ -70,27 +70,9 @@
#include <linux/vmalloc.h>
#include "sisusb.h"
#include "sisusb_init.h"
#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_readw(addr) (*(addr))
@ -103,8 +85,6 @@ static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES];
/* Forward declaration */
static const struct consw sisusb_con;
extern struct mutex disconnect_mutex;
static inline void
sisusbcon_memsetw(u16 *s, u16 c, unsigned int count)
{
@ -1487,7 +1467,7 @@ static int sisusbdummycon_dummy(void)
#define SISUSBCONDUMMY (void *)sisusbdummycon_dummy
const struct consw sisusb_dummy_con = {
static const struct consw sisusb_dummy_con = {
.owner = THIS_MODULE,
.con_startup = sisusbdummycon_startup,
.con_init = sisusbdummycon_init,

View File

@ -74,6 +74,7 @@ SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
/* HELPER: Get ModeID */
/*********************************************/
#if 0
unsigned short
SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth)
{
@ -157,6 +158,7 @@ SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth)
return ModeIndex;
}
#endif /* 0 */
/*********************************************/
/* HELPER: SetReg, GetReg */
@ -233,7 +235,7 @@ SiS_DisplayOn(struct SiS_Private *SiS_Pr)
/* HELPER: Init Port Addresses */
/*********************************************/
void
static void
SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
{
SiS_Pr->SiS_P3c4 = BaseAddr + 0x14;

View File

@ -690,7 +690,7 @@ static const struct SiS_CRT1Table SiSUSB_CRT1Table[] =
0x41}} /* 0x54 */
};
static struct SiS_VCLKData SiSUSB_VCLKData[] =
static const struct SiS_VCLKData SiSUSB_VCLKData[] =
{
{ 0x1b,0xe1, 25}, /* 0x00 */
{ 0x4e,0xe4, 28}, /* 0x01 */
@ -808,8 +808,8 @@ static struct SiS_VCLKData SiSUSB_VCLKData[] =
{ 0x2b,0xc2, 35} /* 0x71 768@576@60 */
};
void SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr);
unsigned short SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth);
extern struct mutex disconnect_mutex;
int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
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,
extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port,
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

View File

@ -161,7 +161,7 @@ struct SiS_Private
const struct SiS_Ext *SiS_EModeIDTable;
const struct SiS_Ext2 *SiS_RefIndex;
const struct SiS_CRT1Table *SiS_CRT1Table;
struct SiS_VCLKData *SiS_VCLKData;
const struct SiS_VCLKData *SiS_VCLKData;
const struct SiS_ModeResInfo *SiS_ModeResInfo;
};