[PATCH] drivers/isdn/sc/: possible cleanups

This patch contains the following possible cleanips:
- make some needlessly global code static
- remove the compiled but completely unused debug.c
- remove or #if 0 the following unused global functions:
- command.c: loopback
- command.c: loadproc
- init.c: irq_supported
- packet.c: print_skb
- shmem.c: memset_shmem
- timer.c: trace_timer

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Adrian Bunk and committed by Linus Torvalds e3ca5e76 594dd2c9

+27 -173
+1 -1
drivers/isdn/sc/Makefile
··· 6 6 7 7 # Multipart objects. 8 8 9 - sc-y := shmem.o init.o debug.o packet.o command.o event.o \ 9 + sc-y := shmem.o init.o packet.o command.o event.o \ 10 10 ioctl.o interrupt.o message.o timer.o
+16 -72
drivers/isdn/sc/command.c
··· 22 22 #include "card.h" 23 23 #include "scioc.h" 24 24 25 - int dial(int card, unsigned long channel, setup_parm setup); 26 - int hangup(int card, unsigned long channel); 27 - int answer(int card, unsigned long channel); 28 - int clreaz(int card, unsigned long channel); 29 - int seteaz(int card, unsigned long channel, char *); 30 - int setl2(int card, unsigned long arg); 31 - int setl3(int card, unsigned long arg); 32 - int acceptb(int card, unsigned long channel); 25 + static int dial(int card, unsigned long channel, setup_parm setup); 26 + static int hangup(int card, unsigned long channel); 27 + static int answer(int card, unsigned long channel); 28 + static int clreaz(int card, unsigned long channel); 29 + static int seteaz(int card, unsigned long channel, char *); 30 + static int setl2(int card, unsigned long arg); 31 + static int setl3(int card, unsigned long arg); 32 + static int acceptb(int card, unsigned long channel); 33 33 34 34 extern int cinst; 35 35 extern board *sc_adapter[]; ··· 148 148 } 149 149 150 150 /* 151 - * Confirm our ability to communicate with the board. This test assumes no 152 - * other message activity is present 153 - */ 154 - int loopback(int card) 155 - { 156 - 157 - int status; 158 - static char testmsg[] = "Test Message"; 159 - RspMessage rspmsg; 160 - 161 - if(!IS_VALID_CARD(card)) { 162 - pr_debug("Invalid param: %d is not a valid card id\n", card); 163 - return -ENODEV; 164 - } 165 - 166 - pr_debug("%s: Sending loopback message\n", 167 - sc_adapter[card]->devicename); 168 - 169 - /* 170 - * Send the loopback message to confirm that memory transfer is 171 - * operational 172 - */ 173 - status = send_and_receive(card, CMPID, cmReqType1, 174 - cmReqClass0, 175 - cmReqMsgLpbk, 176 - 0, 177 - (unsigned char) strlen(testmsg), 178 - (unsigned char *)testmsg, 179 - &rspmsg, SAR_TIMEOUT); 180 - 181 - 182 - if (!status) { 183 - pr_debug("%s: Loopback message successfully sent\n", 184 - sc_adapter[card]->devicename); 185 - if(strcmp(rspmsg.msg_data.byte_array, testmsg)) { 186 - pr_debug("%s: Loopback return != sent\n", 187 - sc_adapter[card]->devicename); 188 - return -EIO; 189 - } 190 - return 0; 191 - } 192 - else { 193 - pr_debug("%s: Send loopback message failed\n", 194 - sc_adapter[card]->devicename); 195 - return -EIO; 196 - } 197 - 198 - } 199 - 200 - /* 201 151 * start the onboard firmware 202 152 */ 203 153 int startproc(int card) ··· 172 222 } 173 223 174 224 175 - int loadproc(int card, char *data) 176 - { 177 - return -1; 178 - } 179 - 180 - 181 225 /* 182 226 * Dials the number passed in 183 227 */ 184 - int dial(int card, unsigned long channel, setup_parm setup) 228 + static int dial(int card, unsigned long channel, setup_parm setup) 185 229 { 186 230 int status; 187 231 char Phone[48]; ··· 205 261 /* 206 262 * Answer an incoming call 207 263 */ 208 - int answer(int card, unsigned long channel) 264 + static int answer(int card, unsigned long channel) 209 265 { 210 266 if(!IS_VALID_CARD(card)) { 211 267 pr_debug("Invalid param: %d is not a valid card id\n", card); ··· 226 282 /* 227 283 * Hangup up the call on specified channel 228 284 */ 229 - int hangup(int card, unsigned long channel) 285 + static int hangup(int card, unsigned long channel) 230 286 { 231 287 int status; 232 288 ··· 249 305 /* 250 306 * Set the layer 2 protocol (X.25, HDLC, Raw) 251 307 */ 252 - int setl2(int card, unsigned long arg) 308 + static int setl2(int card, unsigned long arg) 253 309 { 254 310 int status =0; 255 311 int protocol,channel; ··· 284 340 /* 285 341 * Set the layer 3 protocol 286 342 */ 287 - int setl3(int card, unsigned long channel) 343 + static int setl3(int card, unsigned long channel) 288 344 { 289 345 int protocol = channel >> 8; 290 346 ··· 299 355 return 0; 300 356 } 301 357 302 - int acceptb(int card, unsigned long channel) 358 + static int acceptb(int card, unsigned long channel) 303 359 { 304 360 if(!IS_VALID_CARD(card)) { 305 361 pr_debug("Invalid param: %d is not a valid card id\n", card); ··· 318 374 return 0; 319 375 } 320 376 321 - int clreaz(int card, unsigned long arg) 377 + static int clreaz(int card, unsigned long arg) 322 378 { 323 379 if(!IS_VALID_CARD(card)) { 324 380 pr_debug("Invalid param: %d is not a valid card id\n", card); ··· 332 388 return 0; 333 389 } 334 390 335 - int seteaz(int card, unsigned long arg, char *num) 391 + static int seteaz(int card, unsigned long arg, char *num) 336 392 { 337 393 if(!IS_VALID_CARD(card)) { 338 394 pr_debug("Invalid param: %d is not a valid card id\n", card);
-46
drivers/isdn/sc/debug.c
··· 1 - /* $Id: debug.c,v 1.5.6.1 2001/09/23 22:24:59 kai Exp $ 2 - * 3 - * Copyright (C) 1996 SpellCaster Telecommunications Inc. 4 - * 5 - * This software may be used and distributed according to the terms 6 - * of the GNU General Public License, incorporated herein by reference. 7 - * 8 - * For more information, please contact gpl-info@spellcast.com or write: 9 - * 10 - * SpellCaster Telecommunications Inc. 11 - * 5621 Finch Avenue East, Unit #3 12 - * Scarborough, Ontario Canada 13 - * M1B 2T9 14 - * +1 (416) 297-8565 15 - * +1 (416) 297-6433 Facsimile 16 - */ 17 - 18 - #include <linux/kernel.h> 19 - #include <linux/string.h> 20 - 21 - int dbg_level = 0; 22 - static char dbg_funcname[255]; 23 - 24 - void dbg_endfunc(void) 25 - { 26 - if (dbg_level) { 27 - printk("<-- Leaving function %s\n", dbg_funcname); 28 - strcpy(dbg_funcname, ""); 29 - } 30 - } 31 - 32 - void dbg_func(char *func) 33 - { 34 - strcpy(dbg_funcname, func); 35 - if(dbg_level) 36 - printk("--> Entering function %s\n", dbg_funcname); 37 - } 38 - 39 - inline void pullphone(char *dn, char *str) 40 - { 41 - int i = 0; 42 - 43 - while(dn[i] != ',') 44 - str[i] = dn[i], i++; 45 - str[i] = 0x0; 46 - }
+4 -17
drivers/isdn/sc/init.c
··· 20 20 int cinst; 21 21 22 22 static char devname[] = "scX"; 23 - const char version[] = "2.0b1"; 23 + static const char version[] = "2.0b1"; 24 24 25 - const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; 25 + static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; 26 26 27 27 /* insmod set parameters */ 28 28 static unsigned int io[] = {0,0,0,0}; ··· 35 35 module_param_array(ram, int, NULL, 0); 36 36 module_param(do_reset, bool, 0); 37 37 38 - static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 }; 39 - #define MAX_IRQS 10 40 - 41 38 extern irqreturn_t interrupt_handler(int, void *, struct pt_regs *); 42 39 extern int sndpkt(int, int, int, struct sk_buff *); 43 40 extern int command(isdn_ctrl *); 44 41 extern int indicate_status(int, int, ulong, char*); 45 42 extern int reset(int); 46 43 47 - int identify_board(unsigned long, unsigned int); 48 - 49 - int irq_supported(int irq_x) 50 - { 51 - int i; 52 - for(i=0 ; i < MAX_IRQS ; i++) { 53 - if(sup_irq[i] == irq_x) 54 - return 1; 55 - } 56 - return 0; 57 - } 44 + static int identify_board(unsigned long, unsigned int); 58 45 59 46 static int __init sc_init(void) 60 47 { ··· 441 454 pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n"); 442 455 } 443 456 444 - int identify_board(unsigned long rambase, unsigned int iobase) 457 + static int identify_board(unsigned long rambase, unsigned int iobase) 445 458 { 446 459 unsigned int pgport; 447 460 unsigned long sig;
+1 -1
drivers/isdn/sc/interrupt.c
··· 31 31 extern int cinst; 32 32 extern board *sc_adapter[]; 33 33 34 - int get_card_from_irq(int irq) 34 + static int get_card_from_irq(int irq) 35 35 { 36 36 int i; 37 37
+2 -3
drivers/isdn/sc/ioctl.c
··· 14 14 15 15 extern int indicate_status(int, int, unsigned long, char *); 16 16 extern int startproc(int); 17 - extern int loadproc(int, char *record); 18 17 extern int reset(int); 19 18 extern int send_and_receive(int, unsigned int, unsigned char,unsigned char, 20 19 unsigned char,unsigned char, ··· 22 23 extern board *sc_adapter[]; 23 24 24 25 25 - int GetStatus(int card, boardInfo *); 26 + static int GetStatus(int card, boardInfo *); 26 27 27 28 /* 28 29 * Process private IOCTL messages (typically from scctrl) ··· 427 428 return 0; 428 429 } 429 430 430 - int GetStatus(int card, boardInfo *bi) 431 + static int GetStatus(int card, boardInfo *bi) 431 432 { 432 433 RspMessage rcvmsg; 433 434 int i, status;
-16
drivers/isdn/sc/packet.c
··· 213 213 return 0; 214 214 } 215 215 216 - int print_skb(int card,char *skb_p, int len){ 217 - int i,data; 218 - pr_debug("%s: data at 0x%x len: 0x%x\n", sc_adapter[card]->devicename, 219 - skb_p,len); 220 - for(i=1;i<=len;i++,skb_p++){ 221 - data = (int) (0xff & (*skb_p)); 222 - pr_debug("%s: data = 0x%x", sc_adapter[card]->devicename,data); 223 - if(!(i%4)) 224 - pr_debug(" "); 225 - if(!(i%32)) 226 - pr_debug("\n"); 227 - } 228 - pr_debug("\n"); 229 - return 0; 230 - } 231 -
+2
drivers/isdn/sc/shmem.c
··· 108 108 sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */ 109 109 } 110 110 111 + #if 0 111 112 void memset_shmem(int card, void *dest, int c, size_t n) 112 113 { 113 114 unsigned long flags; ··· 142 141 ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); 143 142 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); 144 143 } 144 + #endif /* 0 */
+1 -17
drivers/isdn/sc/timer.c
··· 32 32 /* 33 33 * Write the proper values into the I/O ports following a reset 34 34 */ 35 - void setup_ports(int card) 35 + static void setup_ports(int card) 36 36 { 37 37 38 38 outb((sc_adapter[card]->rambase >> 12), sc_adapter[card]->ioport[EXP_BASE]); ··· 129 129 ceReqPhyStatus,0,0,NULL); 130 130 } 131 131 132 - /* 133 - * When in trace mode, this callback is used to swap the working shared 134 - * RAM page to the trace page(s) and process all received messages. It 135 - * must be called often enough to get all of the messages out of RAM before 136 - * it loops around. 137 - * Trace messages are \n terminated strings. 138 - * We output the messages in 64 byte chunks through readstat. Each chunk 139 - * is scanned for a \n followed by a time stamp. If the timerstamp is older 140 - * than the current time, scanning stops and the page and offset are recorded 141 - * as the starting point the next time the trace timer is called. The final 142 - * step is to restore the working page and reset the timer. 143 - */ 144 - void trace_timer(unsigned long data) 145 - { 146 - /* not implemented */ 147 - }