Commit e3ca5e76 authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds
Browse files

[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: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 594dd2c9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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	
+16 −72
Original line number Diff line number Diff line
@@ -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[];
@@ -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
 */
@@ -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);

drivers/isdn/sc/debug.c

deleted100644 → 0
+0 −46
Original line number Diff line number Diff line
/* $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;
}
+4 −17
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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;

Loading