diff options
author | Adrian Bunk <bunk@stusta.de> | 2005-06-25 14:58:34 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 16:24:56 -0700 |
commit | e3ca5e762c2aca373f1762cbc622ebe20fd20869 (patch) | |
tree | 88e4265d0e12f6b42a23e56355679a87e278f867 | |
parent | 594dd2c98101a5dc279153ec806d554e6b8a1e35 (diff) | |
download | lwn-e3ca5e762c2aca373f1762cbc622ebe20fd20869.tar.gz lwn-e3ca5e762c2aca373f1762cbc622ebe20fd20869.zip |
[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>
-rw-r--r-- | drivers/isdn/sc/Makefile | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/command.c | 88 | ||||
-rw-r--r-- | drivers/isdn/sc/debug.c | 46 | ||||
-rw-r--r-- | drivers/isdn/sc/init.c | 21 | ||||
-rw-r--r-- | drivers/isdn/sc/interrupt.c | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/ioctl.c | 5 | ||||
-rw-r--r-- | drivers/isdn/sc/packet.c | 16 | ||||
-rw-r--r-- | drivers/isdn/sc/shmem.c | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/timer.c | 18 |
9 files changed, 27 insertions, 173 deletions
diff --git a/drivers/isdn/sc/Makefile b/drivers/isdn/sc/Makefile index 9cc474cd0c44..0f2b7d602ac0 100644 --- a/drivers/isdn/sc/Makefile +++ b/drivers/isdn/sc/Makefile @@ -6,5 +6,5 @@ obj-$(CONFIG_ISDN_DRV_SC) += sc.o # Multipart objects. -sc-y := shmem.o init.o debug.o packet.o command.o event.o \ +sc-y := shmem.o init.o packet.o command.o event.o \ ioctl.o interrupt.o message.o timer.o diff --git a/drivers/isdn/sc/command.c b/drivers/isdn/sc/command.c index b2c4eac7cef5..19f2fcf0ae4a 100644 --- a/drivers/isdn/sc/command.c +++ b/drivers/isdn/sc/command.c @@ -22,14 +22,14 @@ #include "card.h" #include "scioc.h" -int dial(int card, unsigned long channel, setup_parm setup); -int hangup(int card, unsigned long channel); -int answer(int card, unsigned long channel); -int clreaz(int card, unsigned long channel); -int seteaz(int card, unsigned long channel, char *); -int setl2(int card, unsigned long arg); -int setl3(int card, unsigned long arg); -int acceptb(int card, unsigned long channel); +static int dial(int card, unsigned long channel, setup_parm setup); +static int hangup(int card, unsigned long channel); +static int answer(int card, unsigned long channel); +static int clreaz(int card, unsigned long channel); +static int seteaz(int card, unsigned long channel, char *); +static int setl2(int card, unsigned long arg); +static int setl3(int card, unsigned long arg); +static int acceptb(int card, unsigned long channel); extern int cinst; extern board *sc_adapter[]; @@ -148,56 +148,6 @@ int command(isdn_ctrl *cmd) } /* - * Confirm our ability to communicate with the board. This test assumes no - * other message activity is present - */ -int loopback(int card) -{ - - int status; - static char testmsg[] = "Test Message"; - RspMessage rspmsg; - - if(!IS_VALID_CARD(card)) { - pr_debug("Invalid param: %d is not a valid card id\n", card); - return -ENODEV; - } - - pr_debug("%s: Sending loopback message\n", - sc_adapter[card]->devicename); - - /* - * Send the loopback message to confirm that memory transfer is - * operational - */ - status = send_and_receive(card, CMPID, cmReqType1, - cmReqClass0, - cmReqMsgLpbk, - 0, - (unsigned char) strlen(testmsg), - (unsigned char *)testmsg, - &rspmsg, SAR_TIMEOUT); - - - if (!status) { - pr_debug("%s: Loopback message successfully sent\n", - sc_adapter[card]->devicename); - if(strcmp(rspmsg.msg_data.byte_array, testmsg)) { - pr_debug("%s: Loopback return != sent\n", - sc_adapter[card]->devicename); - return -EIO; - } - return 0; - } - else { - pr_debug("%s: Send loopback message failed\n", - sc_adapter[card]->devicename); - return -EIO; - } - -} - -/* * start the onboard firmware */ int startproc(int card) @@ -222,16 +172,10 @@ int startproc(int card) } -int loadproc(int card, char *data) -{ - return -1; -} - - /* * Dials the number passed in */ -int dial(int card, unsigned long channel, setup_parm setup) +static int dial(int card, unsigned long channel, setup_parm setup) { int status; char Phone[48]; @@ -261,7 +205,7 @@ int dial(int card, unsigned long channel, setup_parm setup) /* * Answer an incoming call */ -int answer(int card, unsigned long channel) +static int answer(int card, unsigned long channel) { if(!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); @@ -282,7 +226,7 @@ int answer(int card, unsigned long channel) /* * Hangup up the call on specified channel */ -int hangup(int card, unsigned long channel) +static int hangup(int card, unsigned long channel) { int status; @@ -305,7 +249,7 @@ int hangup(int card, unsigned long channel) /* * Set the layer 2 protocol (X.25, HDLC, Raw) */ -int setl2(int card, unsigned long arg) +static int setl2(int card, unsigned long arg) { int status =0; int protocol,channel; @@ -340,7 +284,7 @@ int setl2(int card, unsigned long arg) /* * Set the layer 3 protocol */ -int setl3(int card, unsigned long channel) +static int setl3(int card, unsigned long channel) { int protocol = channel >> 8; @@ -355,7 +299,7 @@ int setl3(int card, unsigned long channel) return 0; } -int acceptb(int card, unsigned long channel) +static int acceptb(int card, unsigned long channel) { if(!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); @@ -374,7 +318,7 @@ int acceptb(int card, unsigned long channel) return 0; } -int clreaz(int card, unsigned long arg) +static int clreaz(int card, unsigned long arg) { if(!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); @@ -388,7 +332,7 @@ int clreaz(int card, unsigned long arg) return 0; } -int seteaz(int card, unsigned long arg, char *num) +static int seteaz(int card, unsigned long arg, char *num) { if(!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); diff --git a/drivers/isdn/sc/debug.c b/drivers/isdn/sc/debug.c deleted file mode 100644 index 1a992a75868b..000000000000 --- a/drivers/isdn/sc/debug.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $Id: debug.c,v 1.5.6.1 2001/09/23 22:24:59 kai Exp $ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - * - * For more information, please contact gpl-info@spellcast.com or write: - * - * SpellCaster Telecommunications Inc. - * 5621 Finch Avenue East, Unit #3 - * Scarborough, Ontario Canada - * M1B 2T9 - * +1 (416) 297-8565 - * +1 (416) 297-6433 Facsimile - */ - -#include <linux/kernel.h> -#include <linux/string.h> - -int dbg_level = 0; -static char dbg_funcname[255]; - -void dbg_endfunc(void) -{ - if (dbg_level) { - printk("<-- Leaving function %s\n", dbg_funcname); - strcpy(dbg_funcname, ""); - } -} - -void dbg_func(char *func) -{ - strcpy(dbg_funcname, func); - if(dbg_level) - printk("--> Entering function %s\n", dbg_funcname); -} - -inline void pullphone(char *dn, char *str) -{ - int i = 0; - - while(dn[i] != ',') - str[i] = dn[i], i++; - str[i] = 0x0; -} diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c index efefedea37b9..40b0df04ed9f 100644 --- a/drivers/isdn/sc/init.c +++ b/drivers/isdn/sc/init.c @@ -20,9 +20,9 @@ board *sc_adapter[MAX_CARDS]; int cinst; static char devname[] = "scX"; -const char version[] = "2.0b1"; +static const char version[] = "2.0b1"; -const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; +static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; /* insmod set parameters */ static unsigned int io[] = {0,0,0,0}; @@ -35,26 +35,13 @@ module_param_array(irq, int, NULL, 0); module_param_array(ram, int, NULL, 0); module_param(do_reset, bool, 0); -static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 }; -#define MAX_IRQS 10 - extern irqreturn_t interrupt_handler(int, void *, struct pt_regs *); extern int sndpkt(int, int, int, struct sk_buff *); extern int command(isdn_ctrl *); extern int indicate_status(int, int, ulong, char*); extern int reset(int); -int identify_board(unsigned long, unsigned int); - -int irq_supported(int irq_x) -{ - int i; - for(i=0 ; i < MAX_IRQS ; i++) { - if(sup_irq[i] == irq_x) - return 1; - } - return 0; -} +static int identify_board(unsigned long, unsigned int); static int __init sc_init(void) { @@ -454,7 +441,7 @@ static void __exit sc_exit(void) pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n"); } -int identify_board(unsigned long rambase, unsigned int iobase) +static int identify_board(unsigned long rambase, unsigned int iobase) { unsigned int pgport; unsigned long sig; diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c index e5e164aca7fa..8631d338d69a 100644 --- a/drivers/isdn/sc/interrupt.c +++ b/drivers/isdn/sc/interrupt.c @@ -31,7 +31,7 @@ extern void rcvpkt(int, RspMessage *); extern int cinst; extern board *sc_adapter[]; -int get_card_from_irq(int irq) +static int get_card_from_irq(int irq) { int i; diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c index 1371a990416a..3314a5a19854 100644 --- a/drivers/isdn/sc/ioctl.c +++ b/drivers/isdn/sc/ioctl.c @@ -14,7 +14,6 @@ extern int indicate_status(int, int, unsigned long, char *); extern int startproc(int); -extern int loadproc(int, char *record); extern int reset(int); extern int send_and_receive(int, unsigned int, unsigned char,unsigned char, unsigned char,unsigned char, @@ -23,7 +22,7 @@ extern int send_and_receive(int, unsigned int, unsigned char,unsigned char, extern board *sc_adapter[]; -int GetStatus(int card, boardInfo *); +static int GetStatus(int card, boardInfo *); /* * Process private IOCTL messages (typically from scctrl) @@ -428,7 +427,7 @@ int sc_ioctl(int card, scs_ioctl *data) return 0; } -int GetStatus(int card, boardInfo *bi) +static int GetStatus(int card, boardInfo *bi) { RspMessage rcvmsg; int i, status; diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c index 8e3fac3ba1a1..f50defc38ae5 100644 --- a/drivers/isdn/sc/packet.c +++ b/drivers/isdn/sc/packet.c @@ -213,19 +213,3 @@ int setup_buffers(int card, int c) return 0; } -int print_skb(int card,char *skb_p, int len){ - int i,data; - pr_debug("%s: data at 0x%x len: 0x%x\n", sc_adapter[card]->devicename, - skb_p,len); - for(i=1;i<=len;i++,skb_p++){ - data = (int) (0xff & (*skb_p)); - pr_debug("%s: data = 0x%x", sc_adapter[card]->devicename,data); - if(!(i%4)) - pr_debug(" "); - if(!(i%32)) - pr_debug("\n"); - } - pr_debug("\n"); - return 0; -} - diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c index 7bc2dfad0775..24854826ca45 100644 --- a/drivers/isdn/sc/shmem.c +++ b/drivers/isdn/sc/shmem.c @@ -108,6 +108,7 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n) sc_adapter[card]->rambase + ((unsigned long) src %0x4000), (unsigned long) dest); */ } +#if 0 void memset_shmem(int card, void *dest, int c, size_t n) { unsigned long flags; @@ -141,3 +142,4 @@ void memset_shmem(int card, void *dest, int c, size_t n) ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); } +#endif /* 0 */ diff --git a/drivers/isdn/sc/timer.c b/drivers/isdn/sc/timer.c index 710d0f47ca35..aced19aac5a2 100644 --- a/drivers/isdn/sc/timer.c +++ b/drivers/isdn/sc/timer.c @@ -32,7 +32,7 @@ extern int sendmessage(int, unsigned int, unsigned int, unsigned int, /* * Write the proper values into the I/O ports following a reset */ -void setup_ports(int card) +static void setup_ports(int card) { outb((sc_adapter[card]->rambase >> 12), sc_adapter[card]->ioport[EXP_BASE]); @@ -129,19 +129,3 @@ void check_phystat(unsigned long data) ceReqPhyStatus,0,0,NULL); } -/* - * When in trace mode, this callback is used to swap the working shared - * RAM page to the trace page(s) and process all received messages. It - * must be called often enough to get all of the messages out of RAM before - * it loops around. - * Trace messages are \n terminated strings. - * We output the messages in 64 byte chunks through readstat. Each chunk - * is scanned for a \n followed by a time stamp. If the timerstamp is older - * than the current time, scanning stops and the page and offset are recorded - * as the starting point the next time the trace timer is called. The final - * step is to restore the working page and reset the timer. - */ -void trace_timer(unsigned long data) -{ - /* not implemented */ -} |