Skip to content

Commit

Permalink
[PATCH] drivers/isdn/sc/: possible cleanups
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Bunk authored and Linus Torvalds committed Jun 25, 2005
1 parent 594dd2c commit e3ca5e7
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 173 deletions.
2 changes: 1 addition & 1 deletion drivers/isdn/sc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
88 changes: 16 additions & 72 deletions drivers/isdn/sc/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -147,56 +147,6 @@ int command(isdn_ctrl *cmd)
return 0;
}

/*
* 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
*/
Expand All @@ -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];
Expand Down Expand Up @@ -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);
Expand All @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
46 changes: 0 additions & 46 deletions drivers/isdn/sc/debug.c

This file was deleted.

21 changes: 4 additions & 17 deletions drivers/isdn/sc/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/sc/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 2 additions & 3 deletions drivers/isdn/sc/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions drivers/isdn/sc/packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

2 changes: 2 additions & 0 deletions drivers/isdn/sc/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
18 changes: 1 addition & 17 deletions drivers/isdn/sc/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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 */
}

0 comments on commit e3ca5e7

Please sign in to comment.