Skip to contentSkip to conversation

drivers/char/: misc cleanups

PATCH New Adrian Bunk 1 participant 1 message Jan 3, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/char/: misc cleanups

Hi Andrew,

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

cu
Adrian

<-- snip -->

The patch below makes changes under drivers/char/ including the following:
- make needlessly global code static
- remove completely unused code

 drivers/char/esp.c                |    6 
 drivers/char/genrtc.c             |    8 
 drivers/char/ip2/fip_firm.h       |    2 
 drivers/char/ip2/i2cmd.c          |   59 -----
 drivers/char/ip2/i2cmd.h          |   17 -
 drivers/char/ip2/i2lib.c          |    2 
 drivers/char/ip2main.c            |   11 -
 drivers/char/keyboard.c           |   24 --
 drivers/char/lp.c                 |    8 
 drivers/char/n_tty.c              |    8 
 drivers/char/pcmcia/synclink_cs.c |   28 +-
 drivers/char/pty.c                |   10 
 drivers/char/specialix.c          |   97 ++-------
 drivers/char/synclink.c           |  317 ++++++++++++++----------------
 drivers/char/tipar.c              |    8 
 drivers/char/toshiba.c            |    8 
 drivers/char/tty_io.c             |   32 ---
 drivers/char/tty_ioctl.c          |    5 
 include/linux/lp.h                |    6 
 19 files changed, 215 insertions(+), 441 deletions(-)
drivers/char/esp.c renamed from drivers/char/esp.c.old +1 -1
@@ -2401,7 +2401,7 @@
 /*
  * 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;
drivers/char/genrtc.c renamed from drivers/char/genrtc.c.old +1 -1
@@ -83,7 +83,7 @@
 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;
drivers/char/ip2/fip_firm.h renamed from drivers/char/ip2/fip_firm.h.old +1 -1
@@ -1,7 +1,7 @@
 /* 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,
drivers/char/ip2/i2cmd.c renamed from drivers/char/ip2/i2cmd.c.old +2 -57

83 lines not on this page · raw message

drivers/char/ip2/i2cmd.h renamed from drivers/char/ip2/i2cmd.h.old +0 -17
@@ -71,9 +71,7 @@
 // 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 @@
 // 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 @@
 #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
 //
drivers/char/ip2/i2lib.c renamed from drivers/char/ip2/i2lib.c.old +1 -1
@@ -141,7 +141,7 @@
 //* Code *
 //********
 
-inline int
+static inline int
 i2Validate ( i2ChanStrPtr pCh )
 {
 	//ip2trace(pCh->port_index, ITRC_VERIFY,ITRC_ENTER,2,pCh->validity,
drivers/char/ip2main.c renamed from drivers/char/ip2main.c.old +2 -3
@@ -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 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 @@
  * 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;
drivers/char/keyboard.c renamed from drivers/char/keyboard.c.old +4 -16
@@ -330,7 +330,7 @@
  * 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 @@
  * 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 @@
 	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 @@
 /*
  * 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 @@
 }
 #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;
include/linux/lp.h renamed from include/linux/lp.h.old +0 -6
@@ -186,12 +186,6 @@
  */
 #define LP_DELAY 	50
 
-/*
- * function prototypes
- */
-
-extern int lp_init(void);
-
 #endif
 
 #endif
drivers/char/lp.c renamed from drivers/char/lp.c.old +2 -2
@@ -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 @@
 	.detach = lp_detach,
 };
 
-int __init lp_init (void)
+static int __init lp_init (void)
 {
 	int i, err = 0;
 
drivers/char/n_tty.c renamed from drivers/char/n_tty.c.old +2 -2
@@ -152,7 +152,7 @@
  *	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 @@
  *	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;
drivers/char/pty.c renamed from drivers/char/pty.c.old +1 -1
@@ -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)
drivers/char/specialix.c renamed from drivers/char/specialix.c.old +27 -64

148 lines not on this page · raw message

drivers/char/synclink.c renamed from drivers/char/synclink.c.old +152 -161

840 lines not on this page · raw message

drivers/char/pcmcia/synclink_cs.c renamed from drivers/char/pcmcia/synclink_cs.c.old +12 -12
@@ -923,7 +923,7 @@
 /* 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 @@
 }
 
 /* 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 @@
 	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 tx_done(MGSLPC_INFO *info) 
+static void tx_done(MGSLPC_INFO *info) 
 {
 	if (!info->tx_active)
 		return;
@@ -1190,7 +1190,7 @@
 	}
 }
 
-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 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 @@
 	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 @@
 	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 @@
 	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 @@
 
 /* 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;
@@ -3212,7 +3212,7 @@
 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;
@@ -3248,7 +3248,7 @@
 
 /* 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;
 	
drivers/char/tipar.c renamed from drivers/char/tipar.c.old +2 -2
@@ -489,7 +489,7 @@
 	.detach = tipar_detach,
 };
 
-int __init
+static int __init
 tipar_init_module(void)
 {
 	int err = 0;
@@ -526,7 +526,7 @@
 	return err;	
 }
 
-void __exit
+static void __exit
 tipar_cleanup_module(void)
 {
 	unsigned int i;
drivers/char/toshiba.c renamed from drivers/char/toshiba.c.old +1 -1
@@ -407,7 +407,7 @@
  *   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 };
drivers/char/tty_io.c renamed from drivers/char/tty_io.c.old +3 -25
@@ -327,7 +327,7 @@
 	
 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 @@
 /*
  * 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 @@
  * 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;
@@ -2504,28 +2504,6 @@
 }
 
 /*
- *	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
  *
  * Note that the baud_table needs to be kept in sync with the
drivers/char/tty_ioctl.c renamed from drivers/char/tty_ioctl.c.old +1 -1
@@ -372,7 +372,7 @@
 /*
  * 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;