Commit eefe1116 authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

[PATCH] drivers/char/: misc cleanups

below are as requested my drivers/char/ cleanups in one big patch for
better merging.

Each of the patches included was already sent three times without any
objections to linux-kernel.

The n_tty.c patch is
Approved-by: default avatarAlan Cox <alan@redhat.com>

The patch below makes changes under drivers/char/ including the
following:
- make needlessly global code static
- remove completely unused code
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3fe81239
......@@ -2401,7 +2401,7 @@ static struct tty_operations esp_ops = {
/*
* The serial driver boot-time initialization code!
*/
int __init espserial_init(void)
static int __init espserial_init(void)
{
int i, offset;
struct esp_struct * info;
......
......@@ -83,7 +83,7 @@ static unsigned char days_in_mo[] =
static int irq_active;
#ifdef CONFIG_GEN_RTC_X
struct work_struct genrtc_task;
static struct work_struct genrtc_task;
static struct timer_list timer_task;
static unsigned int oldsecs;
......
/* fip_firm.h - Intelliport II loadware */
/* -31232 bytes read from ff.lod */
unsigned char fip_firm[] __initdata = {
static unsigned char fip_firm[] __initdata = {
0x3C,0x42,0x37,0x18,0x02,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x57,0x65,0x64,0x20,0x44,0x65,0x63,0x20,0x30,0x31,0x20,0x31,0x32,0x3A,0x32,0x34,
0x3A,0x33,0x30,0x20,0x31,0x39,0x39,0x39,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
......
......@@ -88,7 +88,7 @@ static UCHAR ct36[] = { 2, BTH, 0x24,0 }; // SETERRMODE
//static UCHAR ct37[]={ 5, BYP|VIP, 0x25,0,0,0,0 }; // FLOW PACKET
// Back to normal
static UCHAR ct38[] = {11, BTH|VAR, 0x26,0,0,0,0,0,0,0,0,0,0 }; // DEF KEY SEQ
//static UCHAR ct38[] = {11, BTH|VAR, 0x26,0,0,0,0,0,0,0,0,0,0 }; // DEF KEY SEQ
//static UCHAR ct39[]={ 3, BTH|END, 0x27,0,0 }; // OPOSTON
//static UCHAR ct40[]={ 1, BTH|END, 0x28 }; // OPOSTOFF
static UCHAR ct41[] = { 1, BYP, 0x29 }; // RESUME
......@@ -103,7 +103,7 @@ static UCHAR ct47[] = { 7, BTH, 0x2F,0,0,0,0,0,0 }; // UNIX FLAGS
//static UCHAR ct50[]={ 1, BTH, 0x32 }; // DTRFLOWENAB
//static UCHAR ct51[]={ 1, BTH, 0x33 }; // DTRFLOWDSAB
//static UCHAR ct52[]={ 1, BTH, 0x34 }; // BAUDTABRESET
static UCHAR ct53[] = { 3, BTH, 0x35,0,0 }; // BAUDREMAP
//static UCHAR ct53[] = { 3, BTH, 0x35,0,0 }; // BAUDREMAP
static UCHAR ct54[] = { 3, BTH, 0x36,0,0 }; // CUSTOMBAUD1
static UCHAR ct55[] = { 3, BTH, 0x37,0,0 }; // CUSTOMBAUD2
static UCHAR ct56[] = { 2, BTH|END, 0x38,0 }; // PAUSE
......@@ -151,40 +151,6 @@ static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW
//* Code *
//********
//******************************************************************************
// Function: i2cmdSetSeq(type, size, string)
// Parameters: type - sequence number
// size - length of sequence
// string - substitution string
//
// Returns: Pointer to command structure
//
// Description:
//
// This routine sets the parameters of command 38 Define Hot Key sequence (alias
// "special receive sequence"). Returns a pointer to the structure. Endeavours
// to be bullet-proof in that the sequence number is forced in range, and any
// out-of-range sizes are forced to zero.
//******************************************************************************
cmdSyntaxPtr
i2cmdSetSeq(unsigned char type, unsigned char size, unsigned char *string)
{
cmdSyntaxPtr pCM = (cmdSyntaxPtr) ct38;
unsigned char *pc;
pCM->cmd[1] = ((type > 0xf) ? 0xf : type); // Sequence number
size = ((size > 0x8) ? 0 : size); // size
pCM->cmd[2] = size;
pCM->length = 3 + size; // UPDATES THE LENGTH!
pc = &(pCM->cmd[3]);
while(size--) {
*pc++ = *string++;
}
return pCM;
}
//******************************************************************************
// Function: i2cmdUnixFlags(iflag, cflag, lflag)
// Parameters: Unix tty flags
......@@ -210,27 +176,6 @@ i2cmdUnixFlags(unsigned short iflag,unsigned short cflag,unsigned short lflag)
return pCM;
}
//******************************************************************************
// Function: i2cmdBaudRemap(dest,src)
// Parameters: ?
//
// Returns: Pointer to command structure
//
// Description:
//
// This routine sets the parameters of command 53 and returns a pointer to the
// appropriate structure.
//******************************************************************************
cmdSyntaxPtr
i2cmdBaudRemap(unsigned char dest, unsigned char src)
{
cmdSyntaxPtr pCM = (cmdSyntaxPtr) ct53;
pCM->cmd[1] = dest;
pCM->cmd[2] = src;
return pCM;
}
//******************************************************************************
// Function: i2cmdBaudDef(which, rate)
// Parameters: ?
......
......@@ -71,9 +71,7 @@ typedef struct _cmdSyntax
// there is more than one parameter to assign, we must use a function rather
// than a macro (used usually).
//
extern cmdSyntaxPtr i2cmdSetSeq(UCHAR seqno, UCHAR size, UCHAR *string);
extern cmdSyntaxPtr i2cmdUnixFlags(USHORT iflag,USHORT cflag,USHORT lflag);
extern cmdSyntaxPtr i2cmdBaudRemap(UCHAR dest, UCHAR src);
extern cmdSyntaxPtr i2cmdBaudDef(int which, USHORT rate);
// Declarations for the global arrays used to bear the commands and their
......@@ -397,14 +395,6 @@ static UCHAR cc02[];
// library code in response to data movement and shouldn't ever be sent by the
// user code. See i2pack.h and the body of i2lib.c for details.
// COMMAND 38: Define the hot-key sequence
// seqno: sequence number 0-15
// size: number of characters in sequence (1-8)
// string: pointer to the characters
// (if size == 0, "undefines" this sequence
//
#define CMD_SET_SEQ(seqno,size,string) i2cmdSetSeq(seqno,size,string)
// Enable on-board post-processing, using options given in oflag argument.
// Formerly, this command was automatically preceded by a CMD_OPOST_OFF command
// because the loadware does not permit sending back-to-back CMD_OPOST_ON
......@@ -458,13 +448,6 @@ static UCHAR cc02[];
#define CMD_DTRFL_DSAB (cmdSyntaxPtr)(ct51) // Disable DTR flow control
#define CMD_BAUD_RESET (cmdSyntaxPtr)(ct52) // Reset baudrate table
// COMMAND 53: Remap baud rate table
// dest = index of table entry to be changed
// src = index value to substitute.
// at default mapping table is f(x) = x
//
#define CMD_BAUD_REMAP(dest,src) i2cmdBaudRemap(dest,src)
// COMMAND 54: Define custom rate #1
// rate = (short) 1/10 of the desired baud rate
//
......
......@@ -141,7 +141,7 @@ fatality(i2eBordStrPtr pB )
//* Code *
//********
inline int
static inline int
i2Validate ( i2ChanStrPtr pCh )
{
//ip2trace(pCh->port_index, ITRC_VERIFY,ITRC_ENTER,2,pCh->validity,
......
......@@ -138,7 +138,7 @@
#include <linux/proc_fs.h>
static int ip2_read_procmem(char *, char **, off_t, int);
int ip2_read_proc(char *, char **, off_t, int, int *, void * );
static int ip2_read_proc(char *, char **, off_t, int, int *, void * );
/********************/
/* Type Definitions */
......@@ -202,7 +202,6 @@ static void do_status(void *p);
static void ip2_wait_until_sent(PTTY,int);
static void set_params (i2ChanStrPtr, struct termios *);
static int set_modem_info(i2ChanStrPtr, unsigned int, unsigned int *);
static int get_serial_info(i2ChanStrPtr, struct serial_struct __user *);
static int set_serial_info(i2ChanStrPtr, struct serial_struct __user *);
......@@ -3097,7 +3096,7 @@ ip2_read_procmem(char *buf, char **start, off_t offset, int len)
* different sources including ip2mkdev.c and a couple of other drivers.
* The bugs are all mine. :-) =mhw=
*/
int ip2_read_proc(char *page, char **start, off_t off,
static int ip2_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int i, j, box;
......
......@@ -330,7 +330,7 @@ static void applkey(struct vc_data *vc, int key, char mode)
* in utf-8 already. UTF-8 is defined for words of up to 31 bits,
* but we need only 16 bits here
*/
void to_utf8(struct vc_data *vc, ushort c)
static void to_utf8(struct vc_data *vc, ushort c)
{
if (c < 0x80)
/* 0******* */
......@@ -392,7 +392,7 @@ void compute_shiftstate(void)
* Otherwise, conclude that DIACR was not combining after all,
* queue it and return CH.
*/
unsigned char handle_diacr(struct vc_data *vc, unsigned char ch)
static unsigned char handle_diacr(struct vc_data *vc, unsigned char ch)
{
int d = diacr;
int i;
......@@ -853,18 +853,6 @@ void setledstate(struct kbd_struct *kbd, unsigned int led)
set_leds();
}
void register_leds(struct kbd_struct *kbd, unsigned int led,
unsigned int *addr, unsigned int mask)
{
if (led < 3) {
ledptrs[led].addr = addr;
ledptrs[led].mask = mask;
ledptrs[led].valid = 1;
kbd->ledmode = LED_SHOW_MEM;
} else
kbd->ledmode = LED_SHOW_FLAGS;
}
static inline unsigned char getleds(void)
{
struct kbd_struct *kbd = kbd_table + fg_console;
......@@ -925,7 +913,7 @@ DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
/*
* This allows a newly plugged keyboard to pick the LED state.
*/
void kbd_refresh_leds(struct input_handle *handle)
static void kbd_refresh_leds(struct input_handle *handle)
{
unsigned char leds = ledstate;
......@@ -1027,7 +1015,7 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode, unsigned char u
}
#endif
void kbd_rawcode(unsigned char data)
static void kbd_rawcode(unsigned char data)
{
struct vc_data *vc = vc_cons[fg_console].d;
kbd = kbd_table + fg_console;
......
......@@ -142,7 +142,7 @@
/* ROUND_UP macro from fs/select.c */
#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
struct lp_struct lp_table[LP_NO];
static struct lp_struct lp_table[LP_NO];
static unsigned int lp_count = 0;
static struct class_simple *lp_class;
......@@ -867,7 +867,7 @@ static struct parport_driver lp_driver = {
.detach = lp_detach,
};
int __init lp_init (void)
static int __init lp_init (void)
{
int i, err = 0;
......
......@@ -152,7 +152,7 @@ static void reset_buffer_flags(struct tty_struct *tty)
* lock_kernel() still.
*/
void n_tty_flush_buffer(struct tty_struct * tty)
static void n_tty_flush_buffer(struct tty_struct * tty)
{
/* clear everything and unthrottle the driver */
reset_buffer_flags(tty);
......@@ -174,7 +174,7 @@ void n_tty_flush_buffer(struct tty_struct * tty)
* at this instant in time.
*/
ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
{
unsigned long flags;
ssize_t n = 0;
......
......@@ -923,7 +923,7 @@ static void tx_release(struct tty_struct *tty)
/* Return next bottom half action to perform.
* or 0 if nothing to do.
*/
int bh_action(MGSLPC_INFO *info)
static int bh_action(MGSLPC_INFO *info)
{
unsigned long flags;
int rc = 0;
......@@ -1017,7 +1017,7 @@ void bh_status(MGSLPC_INFO *info)
}
/* eom: non-zero = end of frame */
void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
static void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
{
unsigned char data[2];
unsigned char fifo_count, read_count, i;
......@@ -1079,7 +1079,7 @@ void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
issue_command(info, CHA, CMD_RXFIFO);
}
void rx_ready_async(MGSLPC_INFO *info, int tcd)
static void rx_ready_async(MGSLPC_INFO *info, int tcd)
{
unsigned char data, status;
int fifo_count;
......@@ -1153,7 +1153,7 @@ void rx_ready_async(MGSLPC_INFO *info, int tcd)
}
void tx_done(MGSLPC_INFO *info)
static void tx_done(MGSLPC_INFO *info)
{
if (!info->tx_active)
return;
......@@ -1190,7 +1190,7 @@ void tx_done(MGSLPC_INFO *info)
}
}
void tx_ready(MGSLPC_INFO *info)
static void tx_ready(MGSLPC_INFO *info)
{
unsigned char fifo_count = 32;
int c;
......@@ -1239,7 +1239,7 @@ void tx_ready(MGSLPC_INFO *info)
}
}
void cts_change(MGSLPC_INFO *info)
static void cts_change(MGSLPC_INFO *info)
{
get_signals(info);
if ((info->cts_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT)
......@@ -1276,7 +1276,7 @@ void cts_change(MGSLPC_INFO *info)
info->pending_bh |= BH_STATUS;
}
void dcd_change(MGSLPC_INFO *info)
static void dcd_change(MGSLPC_INFO *info)
{
get_signals(info);
if ((info->dcd_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT)
......@@ -1310,7 +1310,7 @@ void dcd_change(MGSLPC_INFO *info)
info->pending_bh |= BH_STATUS;
}
void dsr_change(MGSLPC_INFO *info)
static void dsr_change(MGSLPC_INFO *info)
{
get_signals(info);
if ((info->dsr_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT)
......@@ -1325,7 +1325,7 @@ void dsr_change(MGSLPC_INFO *info)
info->pending_bh |= BH_STATUS;
}
void ri_change(MGSLPC_INFO *info)
static void ri_change(MGSLPC_INFO *info)
{
get_signals(info);
if ((info->ri_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT)
......@@ -2955,7 +2955,7 @@ static inline int line_info(char *buf, MGSLPC_INFO *info)
/* Called to print information about devices
*/
int mgslpc_read_proc(char *page, char **start, off_t off, int count,
static int mgslpc_read_proc(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int len = 0, l;
......@@ -3218,7 +3218,7 @@ static void __exit synclink_cs_exit(void)
module_init(synclink_cs_init);
module_exit(synclink_cs_exit);
void mgslpc_set_rate(MGSLPC_INFO *info, unsigned char channel, unsigned int rate)
static void mgslpc_set_rate(MGSLPC_INFO *info, unsigned char channel, unsigned int rate)
{
unsigned int M, N;
unsigned char val;
......@@ -3254,7 +3254,7 @@ void mgslpc_set_rate(MGSLPC_INFO *info, unsigned char channel, unsigned int rate
/* Enabled the AUX clock output at the specified frequency.
*/
void enable_auxclk(MGSLPC_INFO *info)
static void enable_auxclk(MGSLPC_INFO *info)
{
unsigned char val;
......
......@@ -35,7 +35,7 @@
/* These are global because they are accessed in tty_io.c */
#ifdef CONFIG_UNIX98_PTYS
struct tty_driver *ptm_driver;
struct tty_driver *pts_driver;
static struct tty_driver *pts_driver;
#endif
static void pty_close(struct tty_struct * tty, struct file * filp)
......
This diff is collapsed.
......@@ -488,7 +488,7 @@ static struct parport_driver tipar_driver = {
.detach = tipar_detach,
};
int __init
static int __init
tipar_init_module(void)
{
int err = 0;
......@@ -525,7 +525,7 @@ tipar_init_module(void)
return err;
}
void __exit
static void __exit
tipar_cleanup_module(void)
{
unsigned int i;
......
......@@ -407,7 +407,7 @@ static int tosh_get_machine_id(void)
* laptop, otherwise zero and determines the Machine ID, BIOS version and
* date, and SCI version.
*/
int tosh_probe(void)
static int tosh_probe(void)
{
int i,major,minor,day,year,month,flag;
unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 };
......
......@@ -327,7 +327,7 @@ void tty_ldisc_put(int disc)
EXPORT_SYMBOL_GPL(tty_ldisc_put);
void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld)
static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld)
{
tty->ldisc = *ld;
tty->ldisc.refcount = 0;
......@@ -583,7 +583,7 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
/*
* This routine returns a tty driver structure, given a device number
*/
struct tty_driver *get_tty_driver(dev_t device, int *index)
static struct tty_driver *get_tty_driver(dev_t device, int *index)
{
struct tty_driver *p;
......@@ -744,7 +744,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
* but doesn't hold any locks, so we need to make sure we have the appropriate
* locks for what we're doing..
*/
void do_tty_hangup(void *data)
static void do_tty_hangup(void *data)
{
struct tty_struct *tty = (struct tty_struct *) data;
struct file * cons_filp = NULL;
......@@ -2523,28 +2523,6 @@ static void flush_to_ldisc(void *private_)
tty_ldisc_deref(disc);
}
/*
* Call the ldisc flush directly from a driver. This function may
* return an error and need retrying by the user.
*/
int tty_push_data(struct tty_struct *tty, unsigned char *cp, unsigned char *fp, int count)
{
int ret = 0;
struct tty_ldisc *disc;
disc = tty_ldisc_ref(tty);
if(test_bit(TTY_DONT_FLIP, &tty->flags))
ret = -EAGAIN;
else if(disc == NULL)
ret = -EIO;
else
disc->receive_buf(tty, cp, fp, count);
tty_ldisc_deref(disc);
return ret;
}
/*
* Routine which returns the baud rate of the tty
*
......
......@@ -372,7 +372,7 @@ static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars)
/*
* Send a high priority character to the tty.
*/
void send_prio_char(struct tty_struct *tty, char ch)
static void send_prio_char(struct tty_struct *tty, char ch)
{
int was_stopped = tty->stopped;
......
......@@ -186,12 +186,6 @@ struct lp_struct {
*/
#define LP_DELAY 50
/*
* function prototypes
*/
extern int lp_init(void);
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment