Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: dgap: Make merged and local functions and variables static

This patch makes all merged and original functions static to dgap.c.
Doing so has revealed more dead code via gcc warnings.

Signed-off-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mark Hounschell and committed by
Greg Kroah-Hartman
fe0ef8e6 31f2a1b6

+89 -118
+89 -70
drivers/staging/dgap/dgap_driver.c
··· 122 122 static int dgap_tty_put_char(struct tty_struct *tty, unsigned char c); 123 123 static void dgap_tty_send_xchar(struct tty_struct *tty, char ch); 124 124 125 - int dgap_tty_register(struct board_t *brd); 126 - int dgap_tty_preinit(void); 127 - int dgap_tty_init(struct board_t *); 128 - void dgap_tty_post_uninit(void); 129 - void dgap_tty_uninit(struct board_t *); 130 - void dgap_carrier(struct channel_t *ch); 131 - void dgap_input(struct channel_t *ch); 125 + static int dgap_tty_register(struct board_t *brd); 126 + static int dgap_tty_preinit(void); 127 + static int dgap_tty_init(struct board_t *); 128 + static void dgap_tty_post_uninit(void); 129 + static void dgap_tty_uninit(struct board_t *); 130 + static void dgap_carrier(struct channel_t *ch); 131 + static void dgap_input(struct channel_t *ch); 132 132 133 133 /* 134 134 * Our function prototypes from dgap_fep5 135 135 */ 136 136 static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds); 137 137 static int dgap_event(struct board_t *bd); 138 + 139 + static void dgap_poll_tasklet(unsigned long data); 140 + static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2, uint ncmds); 141 + static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds); 142 + static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt); 143 + static int dgap_param(struct tty_struct *tty); 144 + static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned char *fbuf, int *len); 145 + static uint dgap_get_custom_baud(struct channel_t *ch); 146 + static void dgap_firmware_reset_port(struct channel_t *ch); 138 147 139 148 /* 140 149 * Function prototypes from dgap_parse.c. ··· 164 155 struct pci_driver; 165 156 struct class_device; 166 157 167 - void dgap_create_ports_sysfiles(struct board_t *bd); 168 - void dgap_remove_ports_sysfiles(struct board_t *bd); 158 + static void dgap_create_ports_sysfiles(struct board_t *bd); 159 + static void dgap_remove_ports_sysfiles(struct board_t *bd); 169 160 170 - void dgap_create_driver_sysfiles(struct pci_driver *); 171 - void dgap_remove_driver_sysfiles(struct pci_driver *); 161 + static void dgap_create_driver_sysfiles(struct pci_driver *); 162 + static void dgap_remove_driver_sysfiles(struct pci_driver *); 172 163 173 - int dgap_tty_class_init(void); 174 - int dgap_tty_class_destroy(void); 164 + static int dgap_tty_class_init(void); 165 + static int dgap_tty_class_destroy(void); 175 166 176 - void dgap_create_tty_sysfs(struct un_t *un, struct device *c); 177 - void dgap_remove_tty_sysfs(struct device *c); 167 + static void dgap_create_tty_sysfs(struct un_t *un, struct device *c); 168 + static void dgap_remove_tty_sysfs(struct device *c); 178 169 179 170 /* 180 171 * Function prototypes from dgap_parse.h 181 172 */ 182 - int dgap_parsefile(char **in, int Remove); 183 - struct cnode *dgap_find_config(int type, int bus, int slot); 184 - uint dgap_config_get_number_of_ports(struct board_t *bd); 185 - char *dgap_create_config_string(struct board_t *bd, char *string); 186 - char *dgap_get_config_letters(struct board_t *bd, char *string); 187 - uint dgap_config_get_useintr(struct board_t *bd); 188 - uint dgap_config_get_altpin(struct board_t *bd); 173 + static int dgap_parsefile(char **in, int Remove); 174 + static struct cnode *dgap_find_config(int type, int bus, int slot); 175 + static uint dgap_config_get_number_of_ports(struct board_t *bd); 176 + static char *dgap_create_config_string(struct board_t *bd, char *string); 177 + static char *dgap_get_config_letters(struct board_t *bd, char *string); 178 + static uint dgap_config_get_useintr(struct board_t *bd); 179 + static uint dgap_config_get_altpin(struct board_t *bd); 180 + 181 + static int dgap_ms_sleep(ulong ms); 182 + static char *dgap_ioctl_name(int cmd); 183 + static void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len); 184 + static void dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len); 185 + static void dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len); 186 + static void dgap_do_config_load(uchar __user *uaddr, int len); 187 + static int dgap_after_config_loaded(void); 188 + static int dgap_finalize_board_init(struct board_t *brd); 189 + 189 190 190 191 /* Driver load/unload functions */ 191 192 int dgap_init_module(void); ··· 217 198 /* 218 199 * Globals 219 200 */ 220 - uint dgap_NumBoards; 221 - struct board_t *dgap_Board[MAXBOARDS]; 201 + static uint dgap_NumBoards; 202 + static struct board_t *dgap_Board[MAXBOARDS]; 222 203 DEFINE_SPINLOCK(dgap_global_lock); 223 - ulong dgap_poll_counter; 224 - char *dgap_config_buf; 225 - int dgap_driver_state = DRIVER_INITIALIZED; 204 + static ulong dgap_poll_counter; 205 + static char *dgap_config_buf; 206 + static int dgap_driver_state = DRIVER_INITIALIZED; 226 207 DEFINE_SPINLOCK(dgap_dl_lock); 227 - wait_queue_head_t dgap_dl_wait; 228 - int dgap_dl_action; 229 - int dgap_poll_tick = 20; /* Poll interval - 20 ms */ 208 + static wait_queue_head_t dgap_dl_wait; 209 + static int dgap_dl_action; 210 + static int dgap_poll_tick = 20; /* Poll interval - 20 ms */ 230 211 231 212 /* 232 213 * Static vars. ··· 238 219 239 220 static struct board_t *dgap_BoardsByMajor[256]; 240 221 static uchar *dgap_TmpWriteBuf = NULL; 241 - static DECLARE_MUTEX(dgap_TmpWriteSem); 222 + DECLARE_MUTEX(dgap_TmpWriteSem); 242 223 static uint dgap_count = 500; 243 224 244 225 /* 245 226 * Poller stuff 246 227 */ 247 - static DEFINE_SPINLOCK(dgap_poll_lock); /* Poll scheduling lock */ 228 + DEFINE_SPINLOCK(dgap_poll_lock); /* Poll scheduling lock */ 248 229 static ulong dgap_poll_time; /* Time of next poll */ 249 230 static uint dgap_poll_stop; /* Used to tell poller to stop */ 250 231 static struct timer_list dgap_poll_timer; ··· 309 290 }; 310 291 311 292 312 - char *dgap_state_text[] = { 293 + static char *dgap_state_text[] = { 313 294 "Board Failed", 314 295 "Configuration for board not found.\n\t\t\tRun mpi to configure board.", 315 296 "Board Found", ··· 333 314 "Board READY", 334 315 }; 335 316 336 - char *dgap_driver_state_text[] = { 317 + static char *dgap_driver_state_text[] = { 337 318 "Driver Initialized", 338 319 "Driver needs configuration load.", 339 320 "Driver requested configuration from download daemon.", ··· 873 854 } 874 855 875 856 876 - int dgap_finalize_board_init(struct board_t *brd) { 857 + static int dgap_finalize_board_init(struct board_t *brd) { 877 858 878 859 int rc; 879 860 ··· 1205 1186 * 1206 1187 * Returns 0 if timed out, !0 (showing signal) if interrupted by a signal. 1207 1188 */ 1208 - int dgap_ms_sleep(ulong ms) 1189 + static int dgap_ms_sleep(ulong ms) 1209 1190 { 1210 1191 current->state = TASK_INTERRUPTIBLE; 1211 1192 schedule_timeout((ms * HZ) / 1000); ··· 1217 1198 /* 1218 1199 * dgap_ioctl_name() : Returns a text version of each ioctl value. 1219 1200 */ 1220 - char *dgap_ioctl_name(int cmd) 1201 + static char *dgap_ioctl_name(int cmd) 1221 1202 { 1222 1203 switch(cmd) { 1223 1204 ··· 1277 1258 * 1278 1259 * Initialize any global tty related data before we download any boards. 1279 1260 */ 1280 - int dgap_tty_preinit(void) 1261 + static int dgap_tty_preinit(void) 1281 1262 { 1282 1263 unsigned long flags; 1283 1264 ··· 1307 1288 * 1308 1289 * Init the tty subsystem for this board. 1309 1290 */ 1310 - int dgap_tty_register(struct board_t *brd) 1291 + static int dgap_tty_register(struct board_t *brd) 1311 1292 { 1312 1293 int rc = 0; 1313 1294 ··· 1403 1384 * Init the tty subsystem. Called once per board after board has been 1404 1385 * downloaded and init'ed. 1405 1386 */ 1406 - int dgap_tty_init(struct board_t *brd) 1387 + static int dgap_tty_init(struct board_t *brd) 1407 1388 { 1408 1389 int i; 1409 1390 int tlw; ··· 1581 1562 * 1582 1563 * UnInitialize any global tty related data. 1583 1564 */ 1584 - void dgap_tty_post_uninit(void) 1565 + static void dgap_tty_post_uninit(void) 1585 1566 { 1586 1567 kfree(dgap_TmpWriteBuf); 1587 1568 dgap_TmpWriteBuf = NULL; ··· 1594 1575 * Uninitialize the TTY portion of this driver. Free all memory and 1595 1576 * resources. 1596 1577 */ 1597 - void dgap_tty_uninit(struct board_t *brd) 1578 + static void dgap_tty_uninit(struct board_t *brd) 1598 1579 { 1599 1580 int i = 0; 1600 1581 ··· 1752 1733 * 1753 1734 *=======================================================================*/ 1754 1735 1755 - void dgap_input(struct channel_t *ch) 1736 + static void dgap_input(struct channel_t *ch) 1756 1737 { 1757 1738 struct board_t *bd; 1758 1739 struct bs_t *bs; ··· 1969 1950 * Determines when CARRIER changes state and takes appropriate 1970 1951 * action. 1971 1952 ************************************************************************/ 1972 - void dgap_carrier(struct channel_t *ch) 1953 + static void dgap_carrier(struct channel_t *ch) 1973 1954 { 1974 1955 struct board_t *bd; 1975 1956 ··· 4659 4640 /* 4660 4641 * Loads the dgap.conf config file from the user. 4661 4642 */ 4662 - void dgap_do_config_load(uchar __user *uaddr, int len) 4643 + static void dgap_do_config_load(uchar __user *uaddr, int len) 4663 4644 { 4664 4645 int orig_len = len; 4665 4646 char *to_addr; ··· 4704 4685 } 4705 4686 4706 4687 4707 - int dgap_after_config_loaded(void) 4688 + static int dgap_after_config_loaded(void) 4708 4689 { 4709 4690 int i = 0; 4710 4691 int rc = 0; ··· 4769 4750 * Copies the BIOS code from the user to the board, 4770 4751 * and starts the BIOS running. 4771 4752 */ 4772 - void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len) 4753 + static void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len) 4773 4754 { 4774 4755 uchar *addr; 4775 4756 uint offset; ··· 4844 4825 * Copies the FEP code from the user to the board, 4845 4826 * and starts the FEP running. 4846 4827 */ 4847 - void dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len) 4828 + static void dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len) 4848 4829 { 4849 4830 uchar *addr; 4850 4831 uint offset; ··· 5006 4987 /* 5007 4988 * Sends a concentrator image into the FEP5 board. 5008 4989 */ 5009 - void dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len) 4990 + static void dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len) 5010 4991 { 5011 4992 char *vaddr; 5012 4993 u16 offset = 0; ··· 5141 5122 /* 5142 5123 * Our board poller function. 5143 5124 */ 5144 - void dgap_poll_tasklet(unsigned long data) 5125 + static void dgap_poll_tasklet(unsigned long data) 5145 5126 { 5146 5127 struct board_t *bd = (struct board_t *) data; 5147 5128 ulong lock_flags; ··· 5407 5388 * in the cmd buffer before returning. 5408 5389 * 5409 5390 *=======================================================================*/ 5410 - void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2, uint ncmds) 5391 + static void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2, uint ncmds) 5411 5392 { 5412 5393 char *vaddr = NULL; 5413 5394 struct cm_t *cm_addr = NULL; ··· 5497 5478 * in the cmd buffer before returning. 5498 5479 * 5499 5480 *=======================================================================*/ 5500 - void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds) 5481 + static void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds) 5501 5482 { 5502 5483 char *vaddr = NULL; 5503 5484 struct cm_t *cm_addr = NULL; ··· 5685 5666 * cnt - Number of characters to move. 5686 5667 * 5687 5668 *=======================================================================*/ 5688 - void dgap_wmove(struct channel_t *ch, char *buf, uint cnt) 5669 + static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt) 5689 5670 { 5690 5671 int n; 5691 5672 char *taddr; ··· 5740 5721 * and returns it back to the user. 5741 5722 * Returns 0 on error. 5742 5723 */ 5743 - uint dgap_get_custom_baud(struct channel_t *ch) 5724 + static uint dgap_get_custom_baud(struct channel_t *ch) 5744 5725 { 5745 5726 uchar *vaddr; 5746 5727 ulong offset = 0; ··· 5777 5758 /* 5778 5759 * Calls the firmware to reset this channel. 5779 5760 */ 5780 - void dgap_firmware_reset_port(struct channel_t *ch) 5761 + static void dgap_firmware_reset_port(struct channel_t *ch) 5781 5762 { 5782 5763 dgap_cmdb(ch, CHRESET, 0, 0, 0); 5783 5764 ··· 5808 5789 * struct tty_struct * - TTY for port. 5809 5790 * 5810 5791 *=======================================================================*/ 5811 - int dgap_param(struct tty_struct *tty) 5792 + static int dgap_param(struct tty_struct *tty) 5812 5793 { 5813 5794 struct ktermios *ts; 5814 5795 struct board_t *bd; ··· 6155 6136 * Convert the FEP5 way of reporting parity errors and breaks into 6156 6137 * the Linux line discipline way. 6157 6138 */ 6158 - void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned char *fbuf, int *len) 6139 + static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned char *fbuf, int *len) 6159 6140 { 6160 6141 int l = *len; 6161 6142 int count = 0; ··· 6581 6562 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgap_driver_pollrate_show, dgap_driver_pollrate_store); 6582 6563 6583 6564 6584 - void dgap_create_driver_sysfiles(struct pci_driver *dgap_driver) 6565 + static void dgap_create_driver_sysfiles(struct pci_driver *dgap_driver) 6585 6566 { 6586 6567 int rc = 0; 6587 6568 struct device_driver *driverfs = &dgap_driver->driver; ··· 6600 6581 } 6601 6582 6602 6583 6603 - void dgap_remove_driver_sysfiles(struct pci_driver *dgap_driver) 6584 + static void dgap_remove_driver_sysfiles(struct pci_driver *dgap_driver) 6604 6585 { 6605 6586 struct device_driver *driverfs = &dgap_driver->driver; 6606 6587 driver_remove_file(driverfs, &driver_attr_version); ··· 6810 6791 /* this function creates the sys files that will export each signal status 6811 6792 * to sysfs each value will be put in a separate filename 6812 6793 */ 6813 - void dgap_create_ports_sysfiles(struct board_t *bd) 6794 + static void dgap_create_ports_sysfiles(struct board_t *bd) 6814 6795 { 6815 6796 int rc = 0; 6816 6797 ··· 6832 6813 6833 6814 6834 6815 /* removes all the sys files created for that port */ 6835 - void dgap_remove_ports_sysfiles(struct board_t *bd) 6816 + static void dgap_remove_ports_sysfiles(struct board_t *bd) 6836 6817 { 6837 6818 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_state); 6838 6819 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_baud); ··· 7231 7212 7232 7213 7233 7214 7234 - void dgap_create_tty_sysfs(struct un_t *un, struct device *c) 7215 + static void dgap_create_tty_sysfs(struct un_t *un, struct device *c) 7235 7216 { 7236 7217 int ret; 7237 7218 ··· 7247 7228 } 7248 7229 7249 7230 7250 - void dgap_remove_tty_sysfs(struct device *c) 7231 + static void dgap_remove_tty_sysfs(struct device *c) 7251 7232 { 7252 7233 sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group); 7253 7234 } ··· 7255 7236 /* 7256 7237 * Parse a configuration file read into memory as a string. 7257 7238 */ 7258 - int dgap_parsefile(char **in, int Remove) 7239 + static int dgap_parsefile(char **in, int Remove) 7259 7240 { 7260 7241 struct cnode *p, *brd, *line, *conc; 7261 7242 int rc; ··· 8231 8212 /* 8232 8213 * Given a board pointer, returns whether we should use interrupts or not. 8233 8214 */ 8234 - uint dgap_config_get_useintr(struct board_t *bd) 8215 + static uint dgap_config_get_useintr(struct board_t *bd) 8235 8216 { 8236 8217 struct cnode *p = NULL; 8237 8218 ··· 8258 8239 /* 8259 8240 * Given a board pointer, returns whether we turn on altpin or not. 8260 8241 */ 8261 - uint dgap_config_get_altpin(struct board_t *bd) 8242 + static uint dgap_config_get_altpin(struct board_t *bd) 8262 8243 { 8263 8244 struct cnode *p = NULL; 8264 8245 ··· 8287 8268 * Given a specific type of board, if found, detached link and 8288 8269 * returns the first occurrence in the list. 8289 8270 */ 8290 - struct cnode *dgap_find_config(int type, int bus, int slot) 8271 + static struct cnode *dgap_find_config(int type, int bus, int slot) 8291 8272 { 8292 8273 struct cnode *p, *prev = NULL, *prev2 = NULL, *found = NULL; 8293 8274 ··· 8353 8334 * all ports user specified should be on the board. 8354 8335 * (This does NOT mean they are all actually present right now tho) 8355 8336 */ 8356 - uint dgap_config_get_number_of_ports(struct board_t *bd) 8337 + static uint dgap_config_get_number_of_ports(struct board_t *bd) 8357 8338 { 8358 8339 int count = 0; 8359 8340 struct cnode *p = NULL; ··· 8382 8363 return (count); 8383 8364 } 8384 8365 8385 - char *dgap_create_config_string(struct board_t *bd, char *string) 8366 + static char *dgap_create_config_string(struct board_t *bd, char *string) 8386 8367 { 8387 8368 char *ptr = string; 8388 8369 struct cnode *p = NULL; ··· 8441 8422 8442 8423 8443 8424 8444 - char *dgap_get_config_letters(struct board_t *bd, char *string) 8425 + static char *dgap_get_config_letters(struct board_t *bd, char *string) 8445 8426 { 8446 8427 int found = FALSE; 8447 8428 char *ptr = string;
-48
drivers/staging/dgap/dgap_driver.h
··· 663 663 REQUESTED_CONCENTRATOR 664 664 }; 665 665 666 - extern char *dgap_state_text[]; 667 - extern char *dgap_driver_state_text[]; 668 666 669 667 670 668 /* ··· 1500 1502 int useintr; 1501 1503 } u; 1502 1504 }; 1503 - 1504 - /************************************************************************* 1505 - * 1506 - * Prototypes for non-static functions used in more than one module 1507 - * 1508 - *************************************************************************/ 1509 - 1510 - extern int dgap_ms_sleep(ulong ms); 1511 - extern char *dgap_ioctl_name(int cmd); 1512 - extern void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len); 1513 - extern void dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len); 1514 - extern void dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len); 1515 - extern void dgap_do_config_load(uchar __user *uaddr, int len); 1516 - extern int dgap_after_config_loaded(void); 1517 - extern int dgap_finalize_board_init(struct board_t *brd); 1518 - 1519 - /* 1520 - * Our Global Variables. 1521 - */ 1522 - extern int dgap_driver_state; /* The state of the driver */ 1523 - extern int dgap_debug; /* Debug variable */ 1524 - extern int dgap_rawreadok; /* Set if user wants rawreads */ 1525 - extern int dgap_poll_tick; /* Poll interval - 20 ms */ 1526 - extern spinlock_t dgap_global_lock; /* Driver global spinlock */ 1527 - extern uint dgap_NumBoards; /* Total number of boards */ 1528 - extern struct board_t *dgap_Board[MAXBOARDS]; /* Array of board structs */ 1529 - extern ulong dgap_poll_counter; /* Times the poller has run */ 1530 - extern char *dgap_config_buf; /* The config file buffer */ 1531 - extern spinlock_t dgap_dl_lock; /* Downloader spinlock */ 1532 - extern wait_queue_head_t dgap_dl_wait; /* Wait queue for downloader */ 1533 - extern int dgap_dl_action; /* Action flag for downloader */ 1534 - extern int dgap_registerttyswithsysfs; /* Should we register the */ 1535 - /* ttys with sysfs or not */ 1536 - 1537 - /* 1538 - * Global functions declared in dgap_fep5.c, but must be hidden from 1539 - * user space programs. 1540 - */ 1541 - extern void dgap_poll_tasklet(unsigned long data); 1542 - extern void dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2, uint ncmds); 1543 - extern void dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds); 1544 - extern void dgap_wmove(struct channel_t *ch, char *buf, uint cnt); 1545 - extern int dgap_param(struct tty_struct *tty); 1546 - extern void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned char *fbuf, int *len); 1547 - extern uint dgap_get_custom_baud(struct channel_t *ch); 1548 - extern void dgap_firmware_reset_port(struct channel_t *ch); 1549 1505 1550 1506 #endif