diff options
Diffstat (limited to 'drivers/isdn/sc')
-rw-r--r-- | drivers/isdn/sc/card.h | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/command.c | 132 | ||||
-rw-r--r-- | drivers/isdn/sc/event.c | 24 | ||||
-rw-r--r-- | drivers/isdn/sc/hardware.h | 2 | ||||
-rw-r--r-- | drivers/isdn/sc/init.c | 122 | ||||
-rw-r--r-- | drivers/isdn/sc/interrupt.c | 144 | ||||
-rw-r--r-- | drivers/isdn/sc/ioctl.c | 220 | ||||
-rw-r--r-- | drivers/isdn/sc/message.c | 126 | ||||
-rw-r--r-- | drivers/isdn/sc/message.h | 18 | ||||
-rw-r--r-- | drivers/isdn/sc/packet.c | 129 | ||||
-rw-r--r-- | drivers/isdn/sc/scioc.h | 5 | ||||
-rw-r--r-- | drivers/isdn/sc/shmem.c | 52 | ||||
-rw-r--r-- | drivers/isdn/sc/timer.c | 25 |
13 files changed, 499 insertions, 502 deletions
diff --git a/drivers/isdn/sc/card.h b/drivers/isdn/sc/card.h index 0120bcf8831..3da69ee43da 100644 --- a/drivers/isdn/sc/card.h +++ b/drivers/isdn/sc/card.h @@ -118,7 +118,7 @@ int send_and_receive(int card, unsigned int procid, unsigned char type, unsigned char class, unsigned char code, unsigned char link, unsigned char data_len, unsigned char *data, RspMessage *mesgdata, int timeout); -void flushreadfifo (int card); +void flushreadfifo(int card); int sendmessage(int card, unsigned int procid, unsigned int type, unsigned int class, unsigned int code, unsigned int link, unsigned int data_len, unsigned int *data); diff --git a/drivers/isdn/sc/command.c b/drivers/isdn/sc/command.c index 0e4969c2ef9..4a4e66152ce 100644 --- a/drivers/isdn/sc/command.c +++ b/drivers/isdn/sc/command.c @@ -69,14 +69,14 @@ int get_card_from_id(int driver) { int i; - for(i = 0 ; i < cinst ; i++) { - if(sc_adapter[i]->driverId == driver) + for (i = 0; i < cinst; i++) { + if (sc_adapter[i]->driverId == driver) return i; } return -ENODEV; } -/* +/* * command */ @@ -85,7 +85,7 @@ int command(isdn_ctrl *cmd) int card; card = get_card_from_id(cmd->driver); - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } @@ -93,17 +93,17 @@ int command(isdn_ctrl *cmd) /* * Dispatch the command */ - switch(cmd->command) { + switch (cmd->command) { case ISDN_CMD_IOCTL: { - unsigned long cmdptr; + unsigned long cmdptr; scs_ioctl ioc; memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long)); if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr, sizeof(scs_ioctl))) { pr_debug("%s: Failed to verify user space 0x%lx\n", - sc_adapter[card]->devicename, cmdptr); + sc_adapter[card]->devicename, cmdptr); return -EFAULT; } return sc_ioctl(card, &ioc); @@ -133,76 +133,76 @@ int command(isdn_ctrl *cmd) /* * start the onboard firmware */ -int startproc(int card) +int startproc(int card) { int status; - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } /* - * send start msg + * send start msg */ - status = sendmessage(card, CMPID,cmReqType2, - cmReqClass0, - cmReqStartProc, - 0,0,NULL); + status = sendmessage(card, CMPID, cmReqType2, + cmReqClass0, + cmReqStartProc, + 0, 0, NULL); pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename); - + return status; } /* - * Dials the number passed in + * Dials the number passed in */ static int dial(int card, unsigned long channel, setup_parm setup) { int status; char Phone[48]; - - if(!IS_VALID_CARD(card)) { + + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } - /*extract ISDN number to dial from eaz/msn string*/ - strcpy(Phone,setup.phone); + /*extract ISDN number to dial from eaz/msn string*/ + strcpy(Phone, setup.phone); /*send the connection message*/ - status = sendmessage(card, CEPID,ceReqTypePhy, - ceReqClass1, - ceReqPhyConnect, - (unsigned char) channel+1, - strlen(Phone), - (unsigned int *) Phone); + status = sendmessage(card, CEPID, ceReqTypePhy, + ceReqClass1, + ceReqPhyConnect, + (unsigned char)channel + 1, + strlen(Phone), + (unsigned int *)Phone); pr_debug("%s: Dialing %s on channel %lu\n", - sc_adapter[card]->devicename, Phone, channel+1); - + sc_adapter[card]->devicename, Phone, channel + 1); + return status; } /* - * Answer an incoming call + * Answer an incoming call */ static int answer(int card, unsigned long channel) { - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } - if(setup_buffers(card, channel+1)) { - hangup(card, channel+1); + if (setup_buffers(card, channel + 1)) { + hangup(card, channel + 1); return -ENOBUFS; } - indicate_status(card, ISDN_STAT_BCONN,channel,NULL); + indicate_status(card, ISDN_STAT_BCONN, channel, NULL); pr_debug("%s: Answered incoming call on channel %lu\n", - sc_adapter[card]->devicename, channel+1); + sc_adapter[card]->devicename, channel + 1); return 0; } @@ -213,19 +213,19 @@ static int hangup(int card, unsigned long channel) { int status; - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } status = sendmessage(card, CEPID, ceReqTypePhy, - ceReqClass1, - ceReqPhyDisconnect, - (unsigned char) channel+1, - 0, - NULL); + ceReqClass1, + ceReqPhyDisconnect, + (unsigned char)channel + 1, + 0, + NULL); pr_debug("%s: Sent HANGUP message to channel %lu\n", - sc_adapter[card]->devicename, channel+1); + sc_adapter[card]->devicename, channel + 1); return status; } @@ -234,10 +234,10 @@ static int hangup(int card, unsigned long channel) */ static int setl2(int card, unsigned long arg) { - int status =0; - int protocol,channel; + int status = 0; + int protocol, channel; - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } @@ -249,14 +249,14 @@ static int setl2(int card, unsigned long arg) * check that the adapter is also set to the correct protocol */ pr_debug("%s: Sending GetFrameFormat for channel %d\n", - sc_adapter[card]->devicename, channel+1); + sc_adapter[card]->devicename, channel + 1); status = sendmessage(card, CEPID, ceReqTypeCall, - ceReqClass0, - ceReqCallGetFrameFormat, - (unsigned char)channel+1, - 1, - (unsigned int *) protocol); - if(status) + ceReqClass0, + ceReqCallGetFrameFormat, + (unsigned char)channel + 1, + 1, + (unsigned int *)protocol); + if (status) return status; return 0; } @@ -268,7 +268,7 @@ static int setl3(int card, unsigned long channel) { int protocol = channel >> 8; - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } @@ -279,26 +279,26 @@ static int setl3(int card, unsigned long channel) static int acceptb(int card, unsigned long channel) { - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } - if(setup_buffers(card, channel+1)) + if (setup_buffers(card, channel + 1)) { - hangup(card, channel+1); + hangup(card, channel + 1); return -ENOBUFS; } pr_debug("%s: B-Channel connection accepted on channel %lu\n", - sc_adapter[card]->devicename, channel+1); + sc_adapter[card]->devicename, channel + 1); indicate_status(card, ISDN_STAT_BCONN, channel, NULL); return 0; } static int clreaz(int card, unsigned long arg) { - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } @@ -306,13 +306,13 @@ static int clreaz(int card, unsigned long arg) strcpy(sc_adapter[card]->channel[arg].eazlist, ""); sc_adapter[card]->channel[arg].eazclear = 1; pr_debug("%s: EAZ List cleared for channel %lu\n", - sc_adapter[card]->devicename, arg+1); + sc_adapter[card]->devicename, arg + 1); return 0; } static int seteaz(int card, unsigned long arg, char *num) { - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } @@ -320,8 +320,8 @@ static int seteaz(int card, unsigned long arg, char *num) strcpy(sc_adapter[card]->channel[arg].eazlist, num); sc_adapter[card]->channel[arg].eazclear = 0; pr_debug("%s: EAZ list for channel %lu set to: %s\n", - sc_adapter[card]->devicename, arg+1, - sc_adapter[card]->channel[arg].eazlist); + sc_adapter[card]->devicename, arg + 1, + sc_adapter[card]->channel[arg].eazlist); return 0; } @@ -329,14 +329,14 @@ int reset(int card) { unsigned long flags; - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return -ENODEV; } indicate_status(card, ISDN_STAT_STOP, 0, NULL); - if(sc_adapter[card]->EngineUp) { + if (sc_adapter[card]->EngineUp) { del_timer(&sc_adapter[card]->stat_timer); } @@ -350,14 +350,14 @@ int reset(int card) add_timer(&sc_adapter[card]->reset_timer); spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); - outb(0x1,sc_adapter[card]->ioport[SFT_RESET]); + outb(0x1, sc_adapter[card]->ioport[SFT_RESET]); pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename); return 0; } -void flushreadfifo (int card) +void flushreadfifo(int card) { - while(inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) + while (inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) inb(sc_adapter[card]->ioport[FIFO_READ]); } diff --git a/drivers/isdn/sc/event.c b/drivers/isdn/sc/event.c index 498f4039ece..717003a3bdf 100644 --- a/drivers/isdn/sc/event.c +++ b/drivers/isdn/sc/event.c @@ -38,26 +38,26 @@ static char *events[] = { "ISDN_STAT_STAVAIL", "ISDN_STAT_CAUSE" }; #endif -int indicate_status(int card, int event,ulong Channel,char *Data) +int indicate_status(int card, int event, ulong Channel, char *Data) { isdn_ctrl cmd; #ifdef DEBUG pr_debug("%s: Indicating event %s on Channel %d\n", - sc_adapter[card]->devicename, events[event-256], Channel); + sc_adapter[card]->devicename, events[event - 256], Channel); #endif - if (Data != NULL){ + if (Data != NULL) { pr_debug("%s: Event data: %s\n", sc_adapter[card]->devicename, - Data); + Data); switch (event) { - case ISDN_STAT_BSENT: - memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); - break; - case ISDN_STAT_ICALL: - memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); - break; - default: - strcpy(cmd.parm.num, Data); + case ISDN_STAT_BSENT: + memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); + break; + case ISDN_STAT_ICALL: + memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); + break; + default: + strcpy(cmd.parm.num, Data); } } diff --git a/drivers/isdn/sc/hardware.h b/drivers/isdn/sc/hardware.h index 627324856ea..81fbe78701f 100644 --- a/drivers/isdn/sc/hardware.h +++ b/drivers/isdn/sc/hardware.h @@ -105,6 +105,6 @@ */ /* Determine if a channel number is valid for the adapter */ -#define IS_VALID_CHANNEL(y,x) ((x>0) && (x <= sc_adapter[y]->channels)) +#define IS_VALID_CHANNEL(y, x) ((x > 0) && (x <= sc_adapter[y]->channels)) #endif diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c index 023de789f25..6b580b2c717 100644 --- a/drivers/isdn/sc/init.c +++ b/drivers/isdn/sc/init.c @@ -27,9 +27,9 @@ static const char version[] = "2.0b1"; static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" }; /* insmod set parameters */ -static unsigned int io[] = {0,0,0,0}; -static unsigned char irq[] = {0,0,0,0}; -static unsigned long ram[] = {0,0,0,0}; +static unsigned int io[] = {0, 0, 0, 0}; +static unsigned char irq[] = {0, 0, 0, 0}; +static unsigned long ram[] = {0, 0, 0, 0}; static bool do_reset = 0; module_param_array(io, int, NULL, 0); @@ -62,7 +62,7 @@ static int __init sc_init(void) #endif pr_info("Copyright (C) 1996 SpellCaster Telecommunications Inc.\n"); - while(b++ < MAX_CARDS - 1) { + while (b++ < MAX_CARDS - 1) { pr_debug("Probing for adapter #%d\n", b); /* * Initialize reusable variables @@ -72,17 +72,17 @@ static int __init sc_init(void) channels = 0; pgport = 0; - /* - * See if we should probe for IO base + /* + * See if we should probe for IO base */ pr_debug("I/O Base for board %d is 0x%x, %s probe\n", b, io[b], - io[b] == 0 ? "will" : "won't"); - if(io[b]) { + io[b] == 0 ? "will" : "won't"); + if (io[b]) { /* * No, I/O Base has been provided */ - for (i = 0 ; i < MAX_IO_REGS - 1 ; i++) { - if(!request_region(io[b] + i * 0x400, 1, "sc test")) { + for (i = 0; i < MAX_IO_REGS - 1; i++) { + if (!request_region(io[b] + i * 0x400, 1, "sc test")) { pr_debug("request_region for 0x%x failed\n", io[b] + i * 0x400); io[b] = 0; break; @@ -93,13 +93,13 @@ static int __init sc_init(void) /* * Confirm the I/O Address with a test */ - if(io[b] == 0) { + if (io[b] == 0) { pr_debug("I/O Address invalid.\n"); continue; } outb(0x18, io[b] + 0x400 * EXP_PAGE0); - if(inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { + if (inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { pr_debug("I/O Base 0x%x fails test\n", io[b] + 0x400 * EXP_PAGE0); continue; @@ -109,12 +109,12 @@ static int __init sc_init(void) /* * Yes, probe for I/O Base */ - if(probe_exhasted) { + if (probe_exhasted) { pr_debug("All probe addresses exhasted, skipping\n"); continue; } pr_debug("Probing for I/O...\n"); - for (i = last_base ; i <= IOBASE_MAX ; i += IOBASE_OFFSET) { + for (i = last_base; i <= IOBASE_MAX; i += IOBASE_OFFSET) { int found_io = 1; if (i == IOBASE_MAX) { probe_exhasted = 1; /* No more addresses to probe */ @@ -122,19 +122,19 @@ static int __init sc_init(void) } last_base = i + IOBASE_OFFSET; pr_debug(" checking 0x%x...", i); - for ( j = 0 ; j < MAX_IO_REGS - 1 ; j++) { - if(!request_region(i + j * 0x400, 1, "sc test")) { + for (j = 0; j < MAX_IO_REGS - 1; j++) { + if (!request_region(i + j * 0x400, 1, "sc test")) { pr_debug("Failed\n"); found_io = 0; break; } else release_region(i + j * 0x400, 1); - } + } - if(found_io) { + if (found_io) { io[b] = i; outb(0x18, io[b] + 0x400 * EXP_PAGE0); - if(inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { + if (inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) { pr_debug("Failed by test\n"); continue; } @@ -142,7 +142,7 @@ static int __init sc_init(void) break; } } - if(probe_exhasted) { + if (probe_exhasted) { continue; } } @@ -150,23 +150,23 @@ static int __init sc_init(void) /* * See if we should probe for shared RAM */ - if(do_reset) { + if (do_reset) { pr_debug("Doing a SAFE probe reset\n"); outb(0xFF, io[b] + RESET_OFFSET); msleep_interruptible(10000); } pr_debug("RAM Base for board %d is 0x%lx, %s probe\n", b, - ram[b], ram[b] == 0 ? "will" : "won't"); + ram[b], ram[b] == 0 ? "will" : "won't"); - if(ram[b]) { + if (ram[b]) { /* * No, the RAM base has been provided * Just look for a signature and ID the * board model */ - if(request_region(ram[b], SRAM_PAGESIZE, "sc test")) { + if (request_region(ram[b], SRAM_PAGESIZE, "sc test")) { pr_debug("request_region for RAM base 0x%lx succeeded\n", ram[b]); - model = identify_board(ram[b], io[b]); + model = identify_board(ram[b], io[b]); release_region(ram[b], SRAM_PAGESIZE); } } @@ -175,15 +175,15 @@ static int __init sc_init(void) * Yes, probe for free RAM and look for * a signature and id the board model */ - for (i = SRAM_MIN ; i < SRAM_MAX ; i += SRAM_PAGESIZE) { + for (i = SRAM_MIN; i < SRAM_MAX; i += SRAM_PAGESIZE) { pr_debug("Checking RAM address 0x%x...\n", i); - if(request_region(i, SRAM_PAGESIZE, "sc test")) { + if (request_region(i, SRAM_PAGESIZE, "sc test")) { pr_debug(" request_region succeeded\n"); model = identify_board(i, io[b]); release_region(i, SRAM_PAGESIZE); if (model >= 0) { pr_debug(" Identified a %s\n", - boardname[model]); + boardname[model]); ram[b] = i; break; } @@ -196,19 +196,19 @@ static int __init sc_init(void) /* * See if we found free RAM and the board model */ - if(!ram[b] || model < 0) { + if (!ram[b] || model < 0) { /* * Nope, there was no place in RAM for the * board, or it couldn't be identified */ - pr_debug("Failed to find an adapter at 0x%lx\n", ram[b]); - continue; + pr_debug("Failed to find an adapter at 0x%lx\n", ram[b]); + continue; } /* * Set the board's magic number, memory size and page register */ - switch(model) { + switch (model) { case PRI_BOARD: channels = 23; magic = 0x20000; @@ -224,7 +224,7 @@ static int __init sc_init(void) features = BRI_FEATURES; break; } - switch(ram[b] >> 12 & 0x0F) { + switch (ram[b] >> 12 & 0x0F) { case 0x0: pr_debug("RAM Page register set to EXP_PAGE0\n"); pgport = EXP_PAGE0; @@ -250,12 +250,12 @@ static int __init sc_init(void) continue; } - pr_debug("current IRQ: %d b: %d\n",irq[b],b); + pr_debug("current IRQ: %d b: %d\n", irq[b], b); /* * Make sure we got an IRQ */ - if(!irq[b]) { + if (!irq[b]) { /* * No interrupt could be used */ @@ -299,7 +299,7 @@ static int __init sc_init(void) } spin_lock_init(&sc_adapter[cinst]->lock); - if(!register_isdn(interface)) { + if (!register_isdn(interface)) { /* * Oops, couldn't register for some reason */ @@ -344,30 +344,30 @@ static int __init sc_init(void) kfree(interface); kfree(sc_adapter[cinst]); continue; - + } sc_adapter[cinst]->iobase = io[b]; - for(i = 0 ; i < MAX_IO_REGS - 1 ; i++) { + for (i = 0; i < MAX_IO_REGS - 1; i++) { sc_adapter[cinst]->ioport[i] = io[b] + i * 0x400; request_region(sc_adapter[cinst]->ioport[i], 1, - interface->id); + interface->id); pr_debug("Requesting I/O Port %#x\n", - sc_adapter[cinst]->ioport[i]); + sc_adapter[cinst]->ioport[i]); } sc_adapter[cinst]->ioport[IRQ_SELECT] = io[b] + 0x2; request_region(sc_adapter[cinst]->ioport[IRQ_SELECT], 1, - interface->id); + interface->id); pr_debug("Requesting I/O Port %#x\n", - sc_adapter[cinst]->ioport[IRQ_SELECT]); + sc_adapter[cinst]->ioport[IRQ_SELECT]); sc_adapter[cinst]->rambase = ram[b]; request_region(sc_adapter[cinst]->rambase, SRAM_PAGESIZE, - interface->id); + interface->id); - pr_info(" %s (%d) - %s %d channels IRQ %d, I/O Base 0x%x, RAM Base 0x%lx\n", + pr_info(" %s (%d) - %s %d channels IRQ %d, I/O Base 0x%x, RAM Base 0x%lx\n", sc_adapter[cinst]->devicename, sc_adapter[cinst]->driverId, boardname[model], channels, irq[b], io[b], ram[b]); - + /* * reset the adapter to put things in motion */ @@ -376,7 +376,7 @@ static int __init sc_init(void) cinst++; status = 0; } - if (status) + if (status) pr_info("Failed to find any adapters, driver unloaded\n"); return status; } @@ -385,7 +385,7 @@ static void __exit sc_exit(void) { int i, j; - for(i = 0 ; i < cinst ; i++) { + for (i = 0; i < cinst; i++) { pr_debug("Cleaning up after adapter %d\n", i); /* * kill the timers @@ -417,14 +417,14 @@ static void __exit sc_exit(void) /* * Release the I/O Port regions */ - for(j = 0 ; j < MAX_IO_REGS - 1; j++) { + for (j = 0; j < MAX_IO_REGS - 1; j++) { release_region(sc_adapter[i]->ioport[j], 1); pr_debug("Releasing I/O Port %#x\n", - sc_adapter[i]->ioport[j]); + sc_adapter[i]->ioport[j]); } release_region(sc_adapter[i]->ioport[IRQ_SELECT], 1); pr_debug("Releasing I/O Port %#x\n", - sc_adapter[i]->ioport[IRQ_SELECT]); + sc_adapter[i]->ioport[IRQ_SELECT]); /* * Release any memory we alloced @@ -447,19 +447,19 @@ static int identify_board(unsigned long rambase, unsigned int iobase) int x; pr_debug("Attempting to identify adapter @ 0x%lx io 0x%x\n", - rambase, iobase); + rambase, iobase); /* * Enable the base pointer */ outb(rambase >> 12, iobase + 0x2c00); - switch(rambase >> 12 & 0x0F) { + switch (rambase >> 12 & 0x0F) { case 0x0: pgport = iobase + PG0_OFFSET; pr_debug("Page Register offset is 0x%x\n", PG0_OFFSET); break; - + case 0x4: pgport = iobase + PG1_OFFSET; pr_debug("Page Register offset is 0x%x\n", PG1_OFFSET); @@ -486,7 +486,7 @@ static int identify_board(unsigned long rambase, unsigned int iobase) msleep_interruptible(1000); sig = readl(rambase + SIG_OFFSET); pr_debug("Looking for a signature, got 0x%lx\n", sig); - if(sig == SIGNATURE) + if (sig == SIGNATURE) return PRI_BOARD; /* @@ -496,7 +496,7 @@ static int identify_board(unsigned long rambase, unsigned int iobase) msleep_interruptible(1000); sig = readl(rambase + SIG_OFFSET); pr_debug("Looking for a signature, got 0x%lx\n", sig); - if(sig == SIGNATURE) + if (sig == SIGNATURE) return BRI_BOARD; return -1; @@ -506,7 +506,7 @@ static int identify_board(unsigned long rambase, unsigned int iobase) */ sig = readl(rambase + SIG_OFFSET); pr_debug("Looking for a signature, got 0x%lx\n", sig); - if(sig != SIGNATURE) + if (sig != SIGNATURE) return -1; dpm = (DualPortMemory *) rambase; @@ -523,11 +523,11 @@ static int identify_board(unsigned long rambase, unsigned int iobase) * Wait for the response */ x = 0; - while((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) { + while ((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) { schedule_timeout_interruptible(1); x++; } - if(x == 100) { + if (x == 100) { pr_debug("Timeout waiting for response\n"); return -1; } @@ -540,11 +540,11 @@ static int identify_board(unsigned long rambase, unsigned int iobase) hwci.st_u_sense ? "S/T" : "U", hwci.ram_size, hwci.serial_no, hwci.part_no, hwci.rev_no); - if(!strncmp(PRI_PARTNO, hwci.part_no, 6)) + if (!strncmp(PRI_PARTNO, hwci.part_no, 6)) return PRI_BOARD; - if(!strncmp(BRI_PARTNO, hwci.part_no, 6)) + if (!strncmp(BRI_PARTNO, hwci.part_no, 6)) return BRI_BOARD; - + return -1; } diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c index f0225bc0f26..e80cc76bc31 100644 --- a/drivers/isdn/sc/interrupt.c +++ b/drivers/isdn/sc/interrupt.c @@ -22,7 +22,7 @@ #include <linux/interrupt.h> /* - * + * */ irqreturn_t interrupt_handler(int dummy, void *card_inst) { @@ -31,15 +31,15 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) int channel; int card = (int)(unsigned long) card_inst; - if(!IS_VALID_CARD(card)) { + if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return IRQ_NONE; } pr_debug("%s: Entered Interrupt handler\n", - sc_adapter[card]->devicename); - - /* + sc_adapter[card]->devicename); + + /* * Pull all of the waiting messages off the response queue */ while (!receivemessage(card, &rcvmsg)) { @@ -47,31 +47,31 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) * Push the message to the adapter structure for * send_and_receive to snoop */ - if(sc_adapter[card]->want_async_messages) + if (sc_adapter[card]->want_async_messages) memcpy(&(sc_adapter[card]->async_msg), - &rcvmsg, sizeof(RspMessage)); + &rcvmsg, sizeof(RspMessage)); channel = (unsigned int) rcvmsg.phy_link_no; - + /* * Trap Invalid request messages */ - if(IS_CM_MESSAGE(rcvmsg, 0, 0, Invalid)) { - pr_debug("%s: Invalid request Message, rsp_status = %d\n", - sc_adapter[card]->devicename, - rcvmsg.rsp_status); - break; + if (IS_CM_MESSAGE(rcvmsg, 0, 0, Invalid)) { + pr_debug("%s: Invalid request Message, rsp_status = %d\n", + sc_adapter[card]->devicename, + rcvmsg.rsp_status); + break; } - + /* * Check for a linkRead message */ if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Read)) { pr_debug("%s: Received packet 0x%x bytes long at 0x%lx\n", - sc_adapter[card]->devicename, - rcvmsg.msg_data.response.msg_len, - rcvmsg.msg_data.response.buff_offset); + sc_adapter[card]->devicename, + rcvmsg.msg_data.response.msg_len, + rcvmsg.msg_data.response.buff_offset); rcvpkt(card, &rcvmsg); continue; @@ -80,49 +80,49 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) /* * Handle a write acknoledgement */ - if(IS_CE_MESSAGE(rcvmsg, Lnk, 1, Write)) { + if (IS_CE_MESSAGE(rcvmsg, Lnk, 1, Write)) { pr_debug("%s: Packet Send ACK on channel %d\n", - sc_adapter[card]->devicename, - rcvmsg.phy_link_no); - sc_adapter[card]->channel[rcvmsg.phy_link_no-1].free_sendbufs++; + sc_adapter[card]->devicename, + rcvmsg.phy_link_no); + sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].free_sendbufs++; continue; } /* * Handle a connection message */ - if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Connect)) + if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Connect)) { unsigned int callid; - setup_parm setup; + setup_parm setup; pr_debug("%s: Connect message: line %d: status %d: cause 0x%x\n", - sc_adapter[card]->devicename, - rcvmsg.phy_link_no, - rcvmsg.rsp_status, - rcvmsg.msg_data.byte_array[2]); - - memcpy(&callid,rcvmsg.msg_data.byte_array,sizeof(int)); - if(callid>=0x8000 && callid<=0xFFFF) - { + sc_adapter[card]->devicename, + rcvmsg.phy_link_no, + rcvmsg.rsp_status, + rcvmsg.msg_data.byte_array[2]); + + memcpy(&callid, rcvmsg.msg_data.byte_array, sizeof(int)); + if (callid >= 0x8000 && callid <= 0xFFFF) + { pr_debug("%s: Got Dial-Out Rsp\n", - sc_adapter[card]->devicename); + sc_adapter[card]->devicename); indicate_status(card, ISDN_STAT_DCONN, - (unsigned long)rcvmsg.phy_link_no-1,NULL); - + (unsigned long)rcvmsg.phy_link_no - 1, NULL); + } - else if(callid>=0x0000 && callid<=0x7FFF) + else if (callid >= 0x0000 && callid <= 0x7FFF) { int len; pr_debug("%s: Got Incoming Call\n", - sc_adapter[card]->devicename); + sc_adapter[card]->devicename); len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]), - sizeof(setup.phone)); + sizeof(setup.phone)); if (len >= sizeof(setup.phone)) continue; len = strlcpy(setup.eazmsn, - sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, - sizeof(setup.eazmsn)); + sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, + sizeof(setup.eazmsn)); if (len >= sizeof(setup.eazmsn)) continue; setup.si1 = 7; @@ -130,8 +130,8 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) setup.plan = 0; setup.screen = 0; - indicate_status(card, ISDN_STAT_ICALL,(unsigned long)rcvmsg.phy_link_no-1,(char *)&setup); - indicate_status(card, ISDN_STAT_DCONN,(unsigned long)rcvmsg.phy_link_no-1,NULL); + indicate_status(card, ISDN_STAT_ICALL, (unsigned long)rcvmsg.phy_link_no - 1, (char *)&setup); + indicate_status(card, ISDN_STAT_DCONN, (unsigned long)rcvmsg.phy_link_no - 1, NULL); } continue; } @@ -139,16 +139,16 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) /* * Handle a disconnection message */ - if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Disconnect)) + if (IS_CE_MESSAGE(rcvmsg, Phy, 1, Disconnect)) { pr_debug("%s: disconnect message: line %d: status %d: cause 0x%x\n", - sc_adapter[card]->devicename, - rcvmsg.phy_link_no, - rcvmsg.rsp_status, - rcvmsg.msg_data.byte_array[2]); + sc_adapter[card]->devicename, + rcvmsg.phy_link_no, + rcvmsg.rsp_status, + rcvmsg.msg_data.byte_array[2]); - indicate_status(card, ISDN_STAT_BHUP,(unsigned long)rcvmsg.phy_link_no-1,NULL); - indicate_status(card, ISDN_STAT_DHUP,(unsigned long)rcvmsg.phy_link_no-1,NULL); + indicate_status(card, ISDN_STAT_BHUP, (unsigned long)rcvmsg.phy_link_no - 1, NULL); + indicate_status(card, ISDN_STAT_DHUP, (unsigned long)rcvmsg.phy_link_no - 1, NULL); continue; } @@ -158,10 +158,10 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) */ if (IS_CM_MESSAGE(rcvmsg, 5, 0, MiscEngineUp)) { pr_debug("%s: Received EngineUp message\n", - sc_adapter[card]->devicename); + sc_adapter[card]->devicename); sc_adapter[card]->EngineUp = 1; - sendmessage(card, CEPID,ceReqTypeCall,ceReqClass0,ceReqCallGetMyNumber,1,0,NULL); - sendmessage(card, CEPID,ceReqTypeCall,ceReqClass0,ceReqCallGetMyNumber,2,0,NULL); + sendmessage(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, 1, 0, NULL); + sendmessage(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber, 2, 0, NULL); init_timer(&sc_adapter[card]->stat_timer); sc_adapter[card]->stat_timer.function = check_phystat; sc_adapter[card]->stat_timer.data = card; @@ -175,25 +175,25 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) */ if (IS_CM_MESSAGE(rcvmsg, 2, 0, StartProc)) { pr_debug("%s: StartProc Response Status %d\n", - sc_adapter[card]->devicename, - rcvmsg.rsp_status); + sc_adapter[card]->devicename, + rcvmsg.rsp_status); continue; } /* * Handle a GetMyNumber Rsp */ - if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ + if (IS_CE_MESSAGE(rcvmsg, Call, 0, GetMyNumber)) { strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, rcvmsg.msg_data.byte_array, sizeof(rcvmsg.msg_data.byte_array)); continue; } - + /* * PhyStatus response */ - if(IS_CE_MESSAGE(rcvmsg, Phy, 2, Status)) { + if (IS_CE_MESSAGE(rcvmsg, Phy, 2, Status)) { unsigned int b1stat, b2stat; /* @@ -204,30 +204,30 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) sc_adapter[card]->nphystat = (b2stat >> 8) | b1stat; /* endian?? */ pr_debug("%s: PhyStat is 0x%2x\n", - sc_adapter[card]->devicename, - sc_adapter[card]->nphystat); + sc_adapter[card]->devicename, + sc_adapter[card]->nphystat); continue; } - /* + /* * Handle a GetFramFormat */ - if(IS_CE_MESSAGE(rcvmsg, Call, 0, GetFrameFormat)) { - if(rcvmsg.msg_data.byte_array[0] != HDLC_PROTO) { + if (IS_CE_MESSAGE(rcvmsg, Call, 0, GetFrameFormat)) { + if (rcvmsg.msg_data.byte_array[0] != HDLC_PROTO) { unsigned int proto = HDLC_PROTO; /* * Set board format to HDLC if it wasn't already */ pr_debug("%s: current frame format: 0x%x, will change to HDLC\n", - sc_adapter[card]->devicename, - rcvmsg.msg_data.byte_array[0]); + sc_adapter[card]->devicename, + rcvmsg.msg_data.byte_array[0]); sendmessage(card, CEPID, ceReqTypeCall, - ceReqClass0, - ceReqCallSetFrameFormat, - (unsigned char) channel +1, - 1,&proto); - } + ceReqClass0, + ceReqCallSetFrameFormat, + (unsigned char)channel + 1, + 1, &proto); + } continue; } |