Commit 672c3fd9 authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

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

This patch contains the following possible cleanups:
- make needlessly global code static
- remove the compiled but unused st5481_hdlc.{c,h}
- kill enternow.h
- enternow_pci.c: kill InByte/OutByte/BYTE
- isdnl2.c: kill FreeSkb
- remove or #if 0 the following unused functions:
  - config.c: IsdnCardState
  - ipacx.c: ipacx_new_ph
  - ipacx.c: dch_bh
  - ipacx.c: setup_ipacx
  - isdnl2.c: IsRR
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Acked-by: default avatarKai Germaschewski <kai@germaschewski.name>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8b3d4a2a
......@@ -23,7 +23,7 @@ endif
# Multipart objects.
hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \
st5481_b.o st5481_hdlc.o
st5481_b.o
hisax-y := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
lmgr.o q931.o callc.o fsm.o
......
......@@ -97,7 +97,7 @@ static WORD initAMD[] = {
};
void /* macro wWordAMD */
static void /* macro wWordAMD */
WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val)
{
wByteAMD(cs, 0x00, reg);
......@@ -105,7 +105,7 @@ WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val)
wByteAMD(cs, 0x01, HIBYTE(val));
}
WORD /* macro rWordAMD */
static WORD /* macro rWordAMD */
ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg)
{
WORD res;
......@@ -665,7 +665,7 @@ Amd7930_l1hw(struct PStack *st, int pr, void *arg)
}
}
void
static void
setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs)
{
......@@ -676,7 +676,7 @@ setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs)
}
void
static void
DC_Close_Amd7930(struct IsdnCardState *cs) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "Amd7930: DC_Close called");
......
......@@ -22,7 +22,7 @@
extern const char *CardType[];
const char *Asuscom_revision = "$Revision: 1.14.2.4 $";
static const char *Asuscom_revision = "$Revision: 1.14.2.4 $";
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -239,7 +239,7 @@ Start_IPAC:
return IRQ_HANDLED;
}
void
static void
release_io_asuscom(struct IsdnCardState *cs)
{
int bytecnt = 8;
......
......@@ -172,7 +172,7 @@ struct BCState *Sel_BCS(struct IsdnCardState *cs, int channel)
return(NULL);
}
void
static void
write_ctrl(struct BCState *bcs, int which) {
if (bcs->cs->debug & L1_DEB_HSCX)
......@@ -193,7 +193,7 @@ write_ctrl(struct BCState *bcs, int which) {
}
}
void
static void
modehdlc(struct BCState *bcs, int mode, int bc)
{
struct IsdnCardState *cs = bcs->cs;
......@@ -451,7 +451,7 @@ HDLC_irq(struct BCState *bcs, u_int stat) {
}
}
inline void
static inline void
HDLC_irq_main(struct IsdnCardState *cs)
{
u_int stat;
......@@ -487,7 +487,7 @@ HDLC_irq_main(struct IsdnCardState *cs)
}
}
void
static void
hdlc_l2l1(struct PStack *st, int pr, void *arg)
{
struct BCState *bcs = st->l1.bcs;
......@@ -547,7 +547,7 @@ hdlc_l2l1(struct PStack *st, int pr, void *arg)
}
}
void
static void
close_hdlcstate(struct BCState *bcs)
{
modehdlc(bcs, 0, 0);
......@@ -570,7 +570,7 @@ close_hdlcstate(struct BCState *bcs)
}
}
int
static int
open_hdlcstate(struct IsdnCardState *cs, struct BCState *bcs)
{
if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
......@@ -598,7 +598,7 @@ open_hdlcstate(struct IsdnCardState *cs, struct BCState *bcs)
return (0);
}
int
static int
setstack_hdlc(struct PStack *st, struct BCState *bcs)
{
bcs->channel = st->l1.bc;
......@@ -612,6 +612,7 @@ setstack_hdlc(struct PStack *st, struct BCState *bcs)
return (0);
}
#if 0
void __init
clear_pending_hdlc_ints(struct IsdnCardState *cs)
{
......@@ -641,8 +642,9 @@ clear_pending_hdlc_ints(struct IsdnCardState *cs)
debugl1(cs, "HDLC 2 VIN %x", val);
}
}
#endif /* 0 */
void __init
static void __init
inithdlc(struct IsdnCardState *cs)
{
cs->bcs[0].BC_SetStack = setstack_hdlc;
......
......@@ -23,7 +23,7 @@
extern const char *CardType[];
const char *bkm_a4t_revision = "$Revision: 1.22.2.4 $";
static const char *bkm_a4t_revision = "$Revision: 1.22.2.4 $";
static inline u_char
......@@ -167,7 +167,7 @@ bkm_interrupt(int intno, void *dev_id, struct pt_regs *regs)
}
}
void
static void
release_io_bkm(struct IsdnCardState *cs)
{
if (cs->hw.ax.base) {
......
......@@ -27,7 +27,7 @@
extern const char *CardType[];
const char sct_quadro_revision[] = "$Revision: 1.22.2.4 $";
static const char sct_quadro_revision[] = "$Revision: 1.22.2.4 $";
static const char *sct_quadro_subtypes[] =
{
......@@ -193,7 +193,7 @@ bkm_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
return IRQ_HANDLED;
}
void
static void
release_io_sct_quadro(struct IsdnCardState *cs)
{
release_region(cs->hw.ax.base & 0xffffffc0, 128);
......@@ -261,7 +261,7 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return (0);
}
int __init
static int __init
sct_alloc_io(u_int adr, u_int len)
{
if (!request_region(adr, len, "scitel")) {
......
......@@ -874,7 +874,7 @@ release_b_st(struct Channel *chanp)
}
}
struct Channel
static struct Channel
*selectfreechannel(struct PStack *st, int bch)
{
struct IsdnCardState *cs = st->l1.hardware;
......@@ -1429,7 +1429,7 @@ capi_debug(struct Channel *chanp, capi_msg *cm)
HiSax_putstatus(chanp->cs, "Ch", "%d CAPIMSG %s", chanp->chan, tmpbuf);
}
void
static void
lli_got_fac_req(struct Channel *chanp, capi_msg *cm) {
if ((cm->para[0] != 3) || (cm->para[1] != 0))
return;
......@@ -1454,7 +1454,7 @@ lli_got_fac_req(struct Channel *chanp, capi_msg *cm) {
}
}
void
static void
lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *cm) {
if ((cs->typ == ISDN_CTYPE_ELSA) || (cs->typ == ISDN_CTYPE_ELSA_PNP) ||
(cs->typ == ISDN_CTYPE_ELSA_PCI)) {
......
......@@ -332,7 +332,7 @@ struct IsdnCard cards[HISAX_MAX_CARDS] = {
#define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
static char HiSaxID[HISAX_IDSIZE] = { 0, };
char *HiSax_id = HiSaxID;
static char *HiSax_id = HiSaxID;
#ifdef MODULE
/* Variables for insmod */
static int type[HISAX_MAX_CARDS] = { 0, };
......@@ -391,7 +391,7 @@ char *HiSax_getrev(const char *revision)
return rev;
}
void __init HiSaxVersion(void)
static void __init HiSaxVersion(void)
{
char tmp[64];
......@@ -608,6 +608,7 @@ static inline struct IsdnCardState *hisax_findcard(int driverid)
/*
* Find card with given card number
*/
#if 0
struct IsdnCardState *hisax_get_card(int cardnr)
{
if ((cardnr <= nrcards) && (cardnr > 0))
......@@ -615,8 +616,9 @@ struct IsdnCardState *hisax_get_card(int cardnr)
return cards[cardnr - 1].cs;
return NULL;
}
#endif /* 0 */
int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
{
int count, cnt;
u_char __user *p = buf;
......@@ -768,7 +770,7 @@ int ll_run(struct IsdnCardState *cs, int addfeatures)
return 0;
}
void ll_stop(struct IsdnCardState *cs)
static void ll_stop(struct IsdnCardState *cs)
{
isdn_ctrl ic;
......@@ -1184,7 +1186,7 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
return ret;
}
void HiSax_shiftcards(int idx)
static void HiSax_shiftcards(int idx)
{
int i;
......@@ -1192,7 +1194,7 @@ void HiSax_shiftcards(int idx)
memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));
}
int HiSax_inithardware(int *busy_flag)
static int HiSax_inithardware(int *busy_flag)
{
int foundcards = 0;
int i = 0;
......
......@@ -28,7 +28,7 @@
extern const char *CardType[];
const char *Diva_revision = "$Revision: 1.33.2.6 $";
static const char *Diva_revision = "$Revision: 1.33.2.6 $";
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -706,7 +706,7 @@ diva_irq_ipacx_pci(int intno, void *dev_id, struct pt_regs *regs)
return IRQ_HANDLED;
}
void
static void
release_io_diva(struct IsdnCardState *cs)
{
int bytecnt;
......
......@@ -33,13 +33,13 @@
extern const char *CardType[];
const char *Elsa_revision = "$Revision: 2.32.2.4 $";
const char *Elsa_Types[] =
static const char *Elsa_revision = "$Revision: 2.32.2.4 $";
static const char *Elsa_Types[] =
{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
"PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI",
"PCMCIA-IPAC" };
const char *ITACVer[] =
static const char *ITACVer[] =
{"?0?", "?1?", "?2?", "?3?", "?4?", "V2.2",
"B1", "A1"};
......@@ -425,7 +425,7 @@ Start_IPAC:
return IRQ_HANDLED;
}
void
static void
release_io_elsa(struct IsdnCardState *cs)
{
int bytecnt = 8;
......
......@@ -237,7 +237,7 @@ static void mshutdown(struct IsdnCardState *cs)
#endif
}
inline int
static inline int
write_modem(struct BCState *bcs) {
int ret=0;
struct IsdnCardState *cs = bcs->cs;
......@@ -275,7 +275,7 @@ write_modem(struct BCState *bcs) {
return(ret);
}
inline void
static inline void
modem_fill(struct BCState *bcs) {
if (bcs->tx_skb) {
......@@ -422,7 +422,7 @@ extern int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);
extern void modehscx(struct BCState *bcs, int mode, int bc);
extern void hscx_l2l1(struct PStack *st, int pr, void *arg);
void
static void
close_elsastate(struct BCState *bcs)
{
modehscx(bcs, 0, bcs->channel);
......@@ -442,7 +442,7 @@ close_elsastate(struct BCState *bcs)
}
}
void
static void
modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
int count, fp;
u_char *msg = buf;
......@@ -472,7 +472,7 @@ modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
}
}
void
static void
modem_set_init(struct IsdnCardState *cs) {
int timeout;
......@@ -521,7 +521,7 @@ modem_set_init(struct IsdnCardState *cs) {
udelay(RCV_DELAY);
}
void
static void
modem_set_dial(struct IsdnCardState *cs, int outgoing) {
int timeout;
#define RCV_DELAY 20000
......@@ -543,7 +543,7 @@ modem_set_dial(struct IsdnCardState *cs, int outgoing) {
udelay(RCV_DELAY);
}
void
static void
modem_l2l1(struct PStack *st, int pr, void *arg)
{
struct BCState *bcs = st->l1.bcs;
......@@ -579,7 +579,7 @@ modem_l2l1(struct PStack *st, int pr, void *arg)
}
}
int
static int
setstack_elsa(struct PStack *st, struct BCState *bcs)
{
......@@ -614,7 +614,7 @@ setstack_elsa(struct PStack *st, struct BCState *bcs)
return (0);
}
void
static void
init_modem(struct IsdnCardState *cs) {
cs->bcs[0].BC_SetStack = setstack_elsa;
......@@ -641,7 +641,7 @@ init_modem(struct IsdnCardState *cs) {
modem_set_init(cs);
}
void
static void
release_modem(struct IsdnCardState *cs) {
cs->hw.elsa.MFlag = 0;
......
/* 2001/10/02
*
* enternow.h Header-file included by
* enternow_pci.c
*
* Author Christoph Ersfeld <info@formula-n.de>
* Formula-n Europe AG (www.formula-n.com)
* previously Gerdes AG
*
*
* This file is (c) under GNU PUBLIC LICENSE
*/
/* ***************************************************************************************** *
* ****************************** datatypes and macros ************************************* *
* ***************************************************************************************** */
#define BYTE unsigned char
#define WORD unsigned int
#define HIBYTE(w) ((unsigned char)((w & 0xff00) / 256))
#define LOBYTE(w) ((unsigned char)(w & 0x00ff))
#define InByte(addr) inb(addr)
#define OutByte(addr,val) outb(val,addr)
/* ***************************************************************************************** *
* *********************************** card-specific *************************************** *
* ***************************************************************************************** */
/* fr PowerISDN PCI */
#define TJ_AMD_IRQ 0x20
#define TJ_LED1 0x40
#define TJ_LED2 0x80
/* Das Fenster zum AMD...
* Ab Adresse hw.njet.base + TJ_AMD_PORT werden vom AMD jeweils 8 Bit in
* den TigerJet i/o-Raum gemappt
* -> 0x01 des AMD bei hw.njet.base + 0C4 */
#define TJ_AMD_PORT 0xC0
/* ***************************************************************************************** *
* *************************************** Prototypen ************************************** *
* ***************************************************************************************** */
BYTE ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset);
void WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value);
......@@ -65,7 +65,6 @@
#include "isac.h"
#include "isdnl1.h"
#include "amd7930_fn.h"
#include "enternow.h"
#include <linux/interrupt.h>
#include <linux/ppp_defs.h>
#include <linux/pci.h>
......@@ -74,58 +73,72 @@
const char *enternow_pci_rev = "$Revision: 1.1.4.5 $";
static const char *enternow_pci_rev = "$Revision: 1.1.4.5 $";
/* fr PowerISDN PCI */
#define TJ_AMD_IRQ 0x20
#define TJ_LED1 0x40
#define TJ_LED2 0x80
/* Das Fenster zum AMD...
* Ab Adresse hw.njet.base + TJ_AMD_PORT werden vom AMD jeweils 8 Bit in
* den TigerJet i/o-Raum gemappt
* -> 0x01 des AMD bei hw.njet.base + 0C4 */
#define TJ_AMD_PORT 0xC0
/* *************************** I/O-Interface functions ************************************* */
/* cs->readisac, macro rByteAMD */
BYTE
ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset)
static unsigned char
ReadByteAmd7930(struct IsdnCardState *cs, unsigned char offset)
{
/* direktes Register */
if(offset < 8)
return (InByte(cs->hw.njet.isac + 4*offset));
return (inb(cs->hw.njet.isac + 4*offset));
/* indirektes Register */
else {
OutByte(cs->hw.njet.isac + 4*AMD_CR, offset);
return(InByte(cs->hw.njet.isac + 4*AMD_DR));
outb(offset, cs->hw.njet.isac + 4*AMD_CR);
return(inb(cs->hw.njet.isac + 4*AMD_DR));
}
}
/* cs->writeisac, macro wByteAMD */
void
WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value)
static void
WriteByteAmd7930(struct IsdnCardState *cs, unsigned char offset, unsigned char value)
{
/* direktes Register */
if(offset < 8)
OutByte(cs->hw.njet.isac + 4*offset, value);
outb(value, cs->hw.njet.isac + 4*offset);
/* indirektes Register */
else {
OutByte(cs->hw.njet.isac + 4*AMD_CR, offset);
OutByte(cs->hw.njet.isac + 4*AMD_DR, value);
outb(offset, cs->hw.njet.isac + 4*AMD_CR);
outb(value, cs->hw.njet.isac + 4*AMD_DR);
}
}
void
enpci_setIrqMask(struct IsdnCardState *cs, BYTE val) {
static void
enpci_setIrqMask(struct IsdnCardState *cs, unsigned char val) {
if (!val)
OutByte(cs->hw.njet.base+NETJET_IRQMASK1, 0x00);
outb(0x00, cs->hw.njet.base+NETJET_IRQMASK1);
else
OutByte(cs->hw.njet.base+NETJET_IRQMASK1, TJ_AMD_IRQ);
outb(TJ_AMD_IRQ, cs->hw.njet.base+NETJET_IRQMASK1);
}
static BYTE dummyrr(struct IsdnCardState *cs, int chan, BYTE off)
static unsigned char dummyrr(struct IsdnCardState *cs, int chan, unsigned char off)
{
return(5);
}
static void dummywr(struct IsdnCardState *cs, int chan, BYTE off, BYTE value)
static void dummywr(struct IsdnCardState *cs, int chan, unsigned char off, unsigned char value)
{
}
......@@ -142,18 +155,18 @@ reset_enpci(struct IsdnCardState *cs)
/* Reset on, (also for AMD) */
cs->hw.njet.ctrl_reg = 0x07;
OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
mdelay(20);
/* Reset off */
cs->hw.njet.ctrl_reg = 0x30;
OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
outb(cs->hw.njet.ctrl_reg, cs->hw.njet.base + NETJET_CTRL);
/* 20ms delay */
mdelay(20);
cs->hw.njet.auxd = 0; // LED-status
cs->hw.njet.dmactrl = 0;
OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ);
OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ);
OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd); // LED off
outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL);
outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1);
outb(cs->hw.njet.auxd, cs->hw.njet.auxa); // LED off
}
......@@ -161,7 +174,7 @@ static int
enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
u_long flags;
BYTE *chan;
unsigned char *chan;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt);
......@@ -187,16 +200,16 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case MDL_ASSIGN:
/* TEI assigned, LED1 on */
cs->hw.njet.auxd = TJ_AMD_IRQ << 1;
OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd);
outb(cs->hw.njet.auxd, cs->hw.njet.base + NETJET_AUXDATA);
break;
case MDL_REMOVE:
/* TEI removed, LEDs off */
cs->hw.njet.auxd = 0;
OutByte(cs->hw.njet.base + NETJET_AUXDATA, 0x00);
outb(0x00, cs->hw.njet.base + NETJET_AUXDATA);
break;
case MDL_BC_ASSIGN:
/* activate B-channel */
chan = (BYTE *)arg;
chan = (unsigned char *)arg;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "enter:now PCI: assign phys. BC %d in AMD LMR1", *chan);
......@@ -204,11 +217,11 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
cs->dc.amd7930.ph_command(cs, (cs->dc.amd7930.lmr1 | (*chan + 1)), "MDL_BC_ASSIGN");
/* at least one b-channel in use, LED 2 on */
cs->hw.njet.auxd |= TJ_AMD_IRQ << 2;
OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd);
outb(cs->hw.njet.auxd, cs->hw.njet.base + NETJET_AUXDATA);
break;
case MDL_BC_RELEASE:
/* deactivate B-channel */
chan = (BYTE *)arg;
chan = (unsigned char *)arg;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "enter:now PCI: release phys. BC %d in Amd LMR1", *chan);
......@@ -217,7 +230,7 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
/* no b-channel active -> LED2 off */
if (!(cs->dc.amd7930.lmr1 & 3)) {
cs->hw.njet.auxd &