diff options
Diffstat (limited to 'drivers/isdn/hardware/avm')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 134 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/avmcard.h | 286 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/b1.c | 192 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/b1dma.c | 178 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/b1isa.c | 18 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/b1pci.c | 44 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/b1pcmcia.c | 28 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/c4.c | 348 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/t1isa.c | 100 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/t1pci.c | 32 |
10 files changed, 680 insertions, 680 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 61f516f376dc..44b50cc645e6 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -44,12 +44,12 @@ static void avmcs_detach(struct pcmcia_device *p_dev); static int avmcs_probe(struct pcmcia_device *p_dev) { - /* General socket configuration */ - p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; - p_dev->config_index = 1; - p_dev->config_regs = PRESENT_OPTION; + /* General socket configuration */ + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + p_dev->config_index = 1; + p_dev->config_regs = PRESENT_OPTION; - return avmcs_config(p_dev); + return avmcs_config(p_dev); } /* avmcs_attach */ @@ -69,75 +69,75 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data) static int avmcs_config(struct pcmcia_device *link) { - int i = -1; - char devname[128]; - int cardtype; - int (*addcard)(unsigned int port, unsigned irq); - - devname[0] = 0; - if (link->prod_id[1]) - strlcpy(devname, link->prod_id[1], sizeof(devname)); - - /* - * find IO port - */ - if (pcmcia_loop_config(link, avmcs_configcheck, NULL)) - return -ENODEV; - - do { - if (!link->irq) { - /* undo */ - pcmcia_disable_device(link); - break; - } + int i = -1; + char devname[128]; + int cardtype; + int (*addcard)(unsigned int port, unsigned irq); + + devname[0] = 0; + if (link->prod_id[1]) + strlcpy(devname, link->prod_id[1], sizeof(devname)); /* - * configure the PCMCIA socket - */ - i = pcmcia_enable_device(link); + * find IO port + */ + if (pcmcia_loop_config(link, avmcs_configcheck, NULL)) + return -ENODEV; + + do { + if (!link->irq) { + /* undo */ + pcmcia_disable_device(link); + break; + } + + /* + * configure the PCMCIA socket + */ + i = pcmcia_enable_device(link); + if (i != 0) { + pcmcia_disable_device(link); + break; + } + + } while (0); + + if (devname[0]) { + char *s = strrchr(devname, ' '); + if (!s) + s = devname; + else s++; + if (strcmp("M1", s) == 0) { + cardtype = AVM_CARDTYPE_M1; + } else if (strcmp("M2", s) == 0) { + cardtype = AVM_CARDTYPE_M2; + } else { + cardtype = AVM_CARDTYPE_B1; + } + } else + cardtype = AVM_CARDTYPE_B1; + + /* If any step failed, release any partially configured state */ if (i != 0) { - pcmcia_disable_device(link); - break; - } - - } while (0); - - if (devname[0]) { - char *s = strrchr(devname, ' '); - if (!s) - s = devname; - else s++; - if (strcmp("M1", s) == 0) { - cardtype = AVM_CARDTYPE_M1; - } else if (strcmp("M2", s) == 0) { - cardtype = AVM_CARDTYPE_M2; - } else { - cardtype = AVM_CARDTYPE_B1; + avmcs_release(link); + return -ENODEV; } - } else - cardtype = AVM_CARDTYPE_B1; - - /* If any step failed, release any partially configured state */ - if (i != 0) { - avmcs_release(link); - return -ENODEV; - } - switch (cardtype) { - case AVM_CARDTYPE_M1: addcard = b1pcmcia_addcard_m1; break; - case AVM_CARDTYPE_M2: addcard = b1pcmcia_addcard_m2; break; + switch (cardtype) { + case AVM_CARDTYPE_M1: addcard = b1pcmcia_addcard_m1; break; + case AVM_CARDTYPE_M2: addcard = b1pcmcia_addcard_m2; break; default: - case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; - } - if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) { - dev_err(&link->dev, - "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", - (unsigned int) link->resource[0]->start, link->irq); - avmcs_release(link); - return -ENODEV; - } - return 0; + case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; + } + if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) { + dev_err(&link->dev, + "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", + (unsigned int) link->resource[0]->start, link->irq); + avmcs_release(link); + return -ENODEV; + } + return 0; } /* avmcs_config */ diff --git a/drivers/isdn/hardware/avm/avmcard.h b/drivers/isdn/hardware/avm/avmcard.h index a70e8854461d..c95712dbfa9f 100644 --- a/drivers/isdn/hardware/avm/avmcard.h +++ b/drivers/isdn/hardware/avm/avmcard.h @@ -44,16 +44,16 @@ enum avmcardtype { }; typedef struct avmcard_dmabuf { - long size; - u8 *dmabuf; - dma_addr_t dmaaddr; + long size; + u8 *dmabuf; + dma_addr_t dmaaddr; } avmcard_dmabuf; typedef struct avmcard_dmainfo { u32 recvlen; - avmcard_dmabuf recvbuf; + avmcard_dmabuf recvbuf; - avmcard_dmabuf sendbuf; + avmcard_dmabuf sendbuf; struct sk_buff_head send_queue; struct pci_dev *pcidev; @@ -61,22 +61,22 @@ typedef struct avmcard_dmainfo { typedef struct avmctrl_info { char cardname[32]; - + int versionlen; char versionbuf[1024]; char *version[AVM_MAXVERSION]; - + char infobuf[128]; /* for function procinfo */ - + struct avmcard *card; struct capi_ctr capi_ctrl; - + struct list_head ncci_head; } avmctrl_info; typedef struct avmcard { char name[32]; - + spinlock_t lock; unsigned int port; unsigned irq; @@ -103,95 +103,95 @@ typedef struct avmcard { extern int b1_irq_table[16]; /* - * LLI Messages to the ISDN-ControllerISDN Controller + * LLI Messages to the ISDN-ControllerISDN Controller */ #define SEND_POLL 0x72 /* - * after load <- RECEIVE_POLL + * after load <- RECEIVE_POLL */ #define SEND_INIT 0x11 /* - * first message <- RECEIVE_INIT - * int32 NumApplications int32 - * NumNCCIs int32 BoardNumber + * first message <- RECEIVE_INIT + * int32 NumApplications int32 + * NumNCCIs int32 BoardNumber */ #define SEND_REGISTER 0x12 /* - * register an application int32 - * ApplIDId int32 NumMessages - * int32 NumB3Connections int32 - * NumB3Blocks int32 B3Size - * - * AnzB3Connection != 0 && - * AnzB3Blocks >= 1 && B3Size >= 1 + * register an application int32 + * ApplIDId int32 NumMessages + * int32 NumB3Connections int32 + * NumB3Blocks int32 B3Size + * + * AnzB3Connection != 0 && + * AnzB3Blocks >= 1 && B3Size >= 1 */ #define SEND_RELEASE 0x14 /* - * deregister an application int32 - * ApplID + * deregister an application int32 + * ApplID */ #define SEND_MESSAGE 0x15 /* - * send capi-message int32 length - * capi-data ... + * send capi-message int32 length + * capi-data ... */ #define SEND_DATA_B3_REQ 0x13 /* - * send capi-data-message int32 - * MsgLength capi-data ... int32 - * B3Length data .... + * send capi-data-message int32 + * MsgLength capi-data ... int32 + * B3Length data .... */ #define SEND_CONFIG 0x21 /* - */ + */ #define SEND_POLLACK 0x73 /* T1 Watchdog */ /* - * LLI Messages from the ISDN-ControllerISDN Controller + * LLI Messages from the ISDN-ControllerISDN Controller */ #define RECEIVE_POLL 0x32 /* - * <- after SEND_POLL + * <- after SEND_POLL */ #define RECEIVE_INIT 0x27 /* - * <- after SEND_INIT int32 length - * byte total length b1struct board - * driver revision b1struct card - * type b1struct reserved b1struct - * serial number b1struct driver - * capability b1struct d-channel - * protocol b1struct CAPI-2.0 - * profile b1struct capi version + * <- after SEND_INIT int32 length + * byte total length b1struct board + * driver revision b1struct card + * type b1struct reserved b1struct + * serial number b1struct driver + * capability b1struct d-channel + * protocol b1struct CAPI-2.0 + * profile b1struct capi version */ #define RECEIVE_MESSAGE 0x21 /* - * <- after SEND_MESSAGE int32 - * AppllID int32 Length capi-data - * .... + * <- after SEND_MESSAGE int32 + * AppllID int32 Length capi-data + * .... */ #define RECEIVE_DATA_B3_IND 0x22 /* - * received data int32 AppllID - * int32 Length capi-data ... - * int32 B3Length data ... + * received data int32 AppllID + * int32 Length capi-data ... + * int32 B3Length data ... */ #define RECEIVE_START 0x23 /* - * Handshake + * Handshake */ #define RECEIVE_STOP 0x24 /* - * Handshake + * Handshake */ #define RECEIVE_NEW_NCCI 0x25 /* - * int32 AppllID int32 NCCI int32 - * WindowSize + * int32 AppllID int32 NCCI int32 + * WindowSize */ #define RECEIVE_FREE_NCCI 0x26 /* - * int32 AppllID int32 NCCI + * int32 AppllID int32 NCCI */ #define RECEIVE_RELEASE 0x26 /* - * int32 AppllID int32 0xffffffff + * int32 AppllID int32 0xffffffff */ #define RECEIVE_TASK_READY 0x31 /* - * int32 tasknr - * int32 Length Taskname ... + * int32 tasknr + * int32 Length Taskname ... */ #define RECEIVE_DEBUGMSG 0x71 /* - * int32 Length message - * + * int32 Length message + * */ #define RECEIVE_POLLDWORD 0x75 /* t1pci in dword mode */ @@ -264,7 +264,7 @@ static inline void b1_put_byte(unsigned int base, unsigned char val) static inline int b1_save_put_byte(unsigned int base, unsigned char val) { unsigned long stop = jiffies + 2 * HZ; - while (!b1_tx_empty(base) && time_before(jiffies,stop)); + while (!b1_tx_empty(base) && time_before(jiffies, stop)); if (!b1_tx_empty(base)) return -1; b1outp(base, B1_WRITE, val); return 0; @@ -298,21 +298,21 @@ static inline void b1_put_slice(unsigned int base, } static void b1_wr_reg(unsigned int base, - unsigned int reg, + unsigned int reg, unsigned int value) { b1_put_byte(base, WRITE_REGISTER); - b1_put_word(base, reg); - b1_put_word(base, value); + b1_put_word(base, reg); + b1_put_word(base, value); } static inline unsigned int b1_rd_reg(unsigned int base, - unsigned int reg) + unsigned int reg) { b1_put_byte(base, READ_REGISTER); - b1_put_word(base, reg); - return b1_get_word(base); - + b1_put_word(base, reg); + return b1_get_word(base); + } static inline void b1_reset(unsigned int base) @@ -338,13 +338,13 @@ static inline void b1_set_test_bit(unsigned int base, enum avmcardtype cardtype, int onoff) { - b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20); + b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20); } static inline int b1_get_test_bit(unsigned int base, - enum avmcardtype cardtype) + enum avmcardtype cardtype) { - return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0; + return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0; } /* ---------------------------------------------------------------- */ @@ -391,7 +391,7 @@ static inline void t1outp(unsigned int base, } static inline unsigned char t1inp(unsigned int base, - unsigned short offset) + unsigned short offset) { return inb(base + offset); } @@ -415,42 +415,42 @@ static inline unsigned int t1_get_slice(unsigned int base, #endif len = i = b1_get_word(base); - if (t1_isfastlink(base)) { + if (t1_isfastlink(base)) { int status; while (i > 0) { - status = t1_fifostatus(base) & (T1F_IREADY|T1F_IHALF); + status = t1_fifostatus(base) & (T1F_IREADY | T1F_IHALF); if (i >= FIFO_INPBSIZE) status |= T1F_IFULL; switch (status) { - case T1F_IREADY|T1F_IHALF|T1F_IFULL: - insb(base+B1_READ, dp, FIFO_INPBSIZE); - dp += FIFO_INPBSIZE; - i -= FIFO_INPBSIZE; + case T1F_IREADY | T1F_IHALF | T1F_IFULL: + insb(base + B1_READ, dp, FIFO_INPBSIZE); + dp += FIFO_INPBSIZE; + i -= FIFO_INPBSIZE; #ifdef FASTLINK_DEBUG - wcnt += FIFO_INPBSIZE; + wcnt += FIFO_INPBSIZE; #endif - break; - case T1F_IREADY|T1F_IHALF: - insb(base+B1_READ,dp, i); + break; + case T1F_IREADY | T1F_IHALF: + insb(base + B1_READ, dp, i); #ifdef FASTLINK_DEBUG - wcnt += i; + wcnt += i; #endif - dp += i; - i = 0; - break; - default: - *dp++ = b1_get_byte(base); - i--; + dp += i; + i = 0; + break; + default: + *dp++ = b1_get_byte(base); + i--; #ifdef FASTLINK_DEBUG - bcnt++; + bcnt++; #endif - break; + break; } - } + } #ifdef FASTLINK_DEBUG - if (wcnt) - printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n", - base, len, wcnt, bcnt); + if (wcnt) + printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n", + base, len, wcnt, bcnt); #endif } else { while (i-- > 0) @@ -464,26 +464,26 @@ static inline void t1_put_slice(unsigned int base, { unsigned i = len; b1_put_word(base, i); - if (t1_isfastlink(base)) { + if (t1_isfastlink(base)) { int status; while (i > 0) { - status = t1_fifostatus(base) & (T1F_OREADY|T1F_OHALF); + status = t1_fifostatus(base) & (T1F_OREADY | T1F_OHALF); if (i >= FIFO_OUTBSIZE) status |= T1F_OEMPTY; switch (status) { - case T1F_OREADY|T1F_OHALF|T1F_OEMPTY: - outsb(base+B1_WRITE, dp, FIFO_OUTBSIZE); - dp += FIFO_OUTBSIZE; - i -= FIFO_OUTBSIZE; - break; - case T1F_OREADY|T1F_OHALF: - outsb(base+B1_WRITE, dp, i); - dp += i; - i = 0; - break; - default: - b1_put_byte(base, *dp++); - i--; - break; + case T1F_OREADY | T1F_OHALF | T1F_OEMPTY: + outsb(base + B1_WRITE, dp, FIFO_OUTBSIZE); + dp += FIFO_OUTBSIZE; + i -= FIFO_OUTBSIZE; + break; + case T1F_OREADY | T1F_OHALF: + outsb(base + B1_WRITE, dp, i); + dp += i; + i = 0; + break; + default: + b1_put_byte(base, *dp++); + i--; + break; } } } else { @@ -494,18 +494,18 @@ static inline void t1_put_slice(unsigned int base, static inline void t1_disable_irq(unsigned int base) { - t1outp(base, T1_IRQMASTER, 0x00); + t1outp(base, T1_IRQMASTER, 0x00); } static inline void t1_reset(unsigned int base) { - /* reset T1 Controller */ - b1_reset(base); - /* disable irq on HEMA */ - t1outp(base, B1_INSTAT, 0x00); - t1outp(base, B1_OUTSTAT, 0x00); - t1outp(base, T1_IRQMASTER, 0x00); - /* reset HEMA board configuration */ + /* reset T1 Controller */ + b1_reset(base); + /* disable irq on HEMA */ + t1outp(base, B1_INSTAT, 0x00); + t1outp(base, B1_OUTSTAT, 0x00); + t1outp(base, T1_IRQMASTER, 0x00); + /* reset HEMA board configuration */ t1outp(base, T1_RESETBOARD, 0xf); } @@ -513,29 +513,29 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq, enum avmcardtype cardtype) { switch (cardtype) { - case avm_t1isa: - t1outp(base, B1_INSTAT, 0x00); - t1outp(base, B1_INSTAT, 0x02); - t1outp(base, T1_IRQMASTER, 0x08); - break; - case avm_b1isa: - b1outp(base, B1_INSTAT, 0x00); - b1outp(base, B1_RESET, b1_irq_table[irq]); - b1outp(base, B1_INSTAT, 0x02); - break; - default: - case avm_m1: - case avm_m2: - case avm_b1pci: - b1outp(base, B1_INSTAT, 0x00); - b1outp(base, B1_RESET, 0xf0); - b1outp(base, B1_INSTAT, 0x02); - break; - case avm_c4: - case avm_t1pci: - b1outp(base, B1_RESET, 0xf0); - break; - } + case avm_t1isa: + t1outp(base, B1_INSTAT, 0x00); + t1outp(base, B1_INSTAT, 0x02); + t1outp(base, T1_IRQMASTER, 0x08); + break; + case avm_b1isa: + b1outp(base, B1_INSTAT, 0x00); + b1outp(base, B1_RESET, b1_irq_table[irq]); + b1outp(base, B1_INSTAT, 0x02); + break; + default: + case avm_m1: + case avm_m2: + case avm_b1pci: + b1outp(base, B1_INSTAT, 0x00); + b1outp(base, B1_RESET, 0xf0); + b1outp(base, B1_INSTAT, 0x02); + break; + case avm_c4: + case avm_t1pci: + b1outp(base, B1_RESET, 0xf0); + break; + } } /* b1.c */ @@ -543,14 +543,14 @@ avmcard *b1_alloc_card(int nr_controllers); void b1_free_card(avmcard *card); int b1_detect(unsigned int base, enum avmcardtype cardtype); void b1_getrevision(avmcard *card); -int b1_load_t4file(avmcard *card, capiloaddatapart * t4file); -int b1_load_config(avmcard *card, capiloaddatapart * config); +int b1_load_t4file(avmcard *card, capiloaddatapart *t4file); +int b1_load_config(avmcard *card, capiloaddatapart *config); int b1_loaded(avmcard *card); int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data); void b1_reset_ctr(struct capi_ctr *ctrl); void b1_register_appl(struct capi_ctr *ctrl, u16 appl, - capi_register_params *rp); + capi_register_params *rp); void b1_release_appl(struct capi_ctr *ctrl, u16 appl); u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); void b1_parse_version(avmctrl_info *card); @@ -572,8 +572,8 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data); void b1dma_reset_ctr(struct capi_ctr *ctrl); void b1dma_remove_ctr(struct capi_ctr *ctrl); void b1dma_register_appl(struct capi_ctr *ctrl, - u16 appl, - capi_register_params *rp); + u16 appl, + capi_register_params *rp); void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl); u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); extern const struct file_operations b1dmactl_proc_fops; diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index 2a57da590d79..821f7ac33b37 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c @@ -1,7 +1,7 @@ /* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ - * + * * Common module for AVM B1 cards. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> * * This software may be used and distributed according to the terms @@ -60,7 +60,7 @@ int b1_irq_table[16] = 112, /* irq 15 */ }; -/* ------------------------------------------------------------- */ +/* ------------------------------------------------------------- */ avmcard *b1_alloc_card(int nr_controllers) { @@ -104,13 +104,13 @@ int b1_detect(unsigned int base, enum avmcardtype cardtype) int onoff, i; /* - * Statusregister 0000 00xx + * Statusregister 0000 00xx */ if ((inb(base + B1_INSTAT) & 0xfc) || (inb(base + B1_OUTSTAT) & 0xfc)) return 1; /* - * Statusregister 0000 001x + * Statusregister 0000 001x */ b1outp(base, B1_INSTAT, 0x2); /* enable irq */ /* b1outp(base, B1_OUTSTAT, 0x2); */ @@ -118,38 +118,38 @@ int b1_detect(unsigned int base, enum avmcardtype cardtype) /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */) return 2; /* - * Statusregister 0000 000x + * Statusregister 0000 000x */ b1outp(base, B1_INSTAT, 0x0); /* disable irq */ b1outp(base, B1_OUTSTAT, 0x0); if ((inb(base + B1_INSTAT) & 0xfe) || (inb(base + B1_OUTSTAT) & 0xfe)) return 3; - - for (onoff = !0, i= 0; i < 10 ; i++) { + + for (onoff = !0, i = 0; i < 10; i++) { b1_set_test_bit(base, cardtype, onoff); if (b1_get_test_bit(base, cardtype) != onoff) - return 4; + return 4; onoff = !onoff; } if (cardtype == avm_m1) - return 0; + return 0; - if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01) - return 5; + if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01) + return 5; return 0; } void b1_getrevision(avmcard *card) { - card->class = inb(card->port + B1_ANALYSE); - card->revision = inb(card->port + B1_REVISION); + card->class = inb(card->port + B1_ANALYSE); + card->revision = inb(card->port + B1_REVISION); } #define FWBUF_SIZE 256 -int b1_load_t4file(avmcard *card, capiloaddatapart * t4file) +int b1_load_t4file(avmcard *card, capiloaddatapart *t4file) { unsigned char buf[FWBUF_SIZE]; unsigned char *dp; @@ -168,7 +168,7 @@ int b1_load_t4file(avmcard *card, capiloaddatapart * t4file) for (i = 0; i < FWBUF_SIZE; i++) if (b1_save_put_byte(base, buf[i]) < 0) { printk(KERN_ERR "%s: corrupted firmware file ?\n", - card->name); + card->name); return -EIO; } left -= FWBUF_SIZE; @@ -184,14 +184,14 @@ int b1_load_t4file(avmcard *card, capiloaddatapart * t4file) for (i = 0; i < left; i++) if (b1_save_put_byte(base, buf[i]) < 0) { printk(KERN_ERR "%s: corrupted firmware file ?\n", - card->name); + card->name); return -EIO; } } return 0; } -int b1_load_config(avmcard *card, capiloaddatapart * config) +int b1_load_config(avmcard *card, capiloaddatapart *config) { unsigned char buf[FWBUF_SIZE]; unsigned char *dp; @@ -202,9 +202,9 @@ int b1_load_config(avmcard *card, capiloaddatapart * config) left = config->len; if (left) { b1_put_byte(base, SEND_CONFIG); - b1_put_word(base, 1); + b1_put_word(base, 1); b1_put_byte(base, SEND_CONFIG); - b1_put_word(base, left); + b1_put_word(base, left); } while (left > FWBUF_SIZE) { if (config->user) { @@ -215,7 +215,7 @@ int b1_load_config(avmcard *card, capiloaddatapart * config) } for (i = 0; i < FWBUF_SIZE; ) { b1_put_byte(base, SEND_CONFIG); - for (j=0; j < 4; j++) { + for (j = 0; j < 4; j++) { b1_put_byte(base, buf[i++]); } } @@ -231,7 +231,7 @@ int b1_load_config(avmcard *card, capiloaddatapart * config) } for (i = 0; i < left; ) { b1_put_byte(base, SEND_CONFIG); - for (j=0; j < 4; j++) { + for (j = 0; j < 4; j++) { if (i < left) b1_put_byte(base, buf[i++]); else @@ -255,7 +255,7 @@ int b1_loaded(avmcard *card) } if (!b1_tx_empty(base)) { printk(KERN_ERR "%s: b1_loaded: tx err, corrupted t4 file ?\n", - card->name); + card->name); return 0; } b1_put_byte(base, SEND_POLL); @@ -265,7 +265,7 @@ int b1_loaded(avmcard *card) return 1; } printk(KERN_ERR "%s: b1_loaded: got 0x%x, firmware not running\n", - card->name, ans); + card->name, ans); return 0; } } @@ -288,7 +288,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = b1_load_t4file(card, &data->firmware))) { b1_reset(port); printk(KERN_ERR "%s: failed to load t4file!!\n", - card->name); + card->name); return retval; } @@ -298,7 +298,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = b1_load_config(card, &data->configuration))) { b1_reset(port); printk(KERN_ERR "%s: failed to load config!!\n", - card->name); + card->name); return retval; } } @@ -312,7 +312,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) b1_setinterrupt(port, card->irq, card->cardtype); b1_put_byte(port, SEND_INIT); b1_put_word(port, CAPI_MAXAPPL); - b1_put_word(port, AVM_NCCI_PER_CHANNEL*2); + b1_put_word(port, AVM_NCCI_PER_CHANNEL * 2); b1_put_word(port, ctrl->cnr - 1); spin_unlock_irqrestore(&card->lock, flags); @@ -337,8 +337,8 @@ void b1_reset_ctr(struct capi_ctr *ctrl) } void b1_register_appl(struct capi_ctr *ctrl, - u16 appl, - capi_register_params *rp) + u16 appl, + capi_register_params *rp) { avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmcard *card = cinfo->card; @@ -353,7 +353,7 @@ void b1_register_appl(struct capi_ctr *ctrl, spin_lock_irqsave(&card->lock, flags); b1_put_byte(port, SEND_REGISTER); b1_put_word(port, appl); - b1_put_word(port, 1024 * (nconn+1)); + b1_put_word(port, 1024 * (nconn + 1)); b1_put_word(port, nconn); b1_put_word(port, rp->datablkcnt); b1_put_word(port, rp->datablklen); @@ -430,7 +430,7 @@ void b1_parse_version(avmctrl_info *cinfo) cinfo->version[j] = &cinfo->versionbuf[i + 1]; strlcpy(ctrl->serial, cinfo->version[VER_SERIAL], sizeof(ctrl->serial)); - memcpy(&ctrl->profile, cinfo->version[VER_PROFILE],sizeof(capi_profile)); + memcpy(&ctrl->profile, cinfo->version[VER_PROFILE], sizeof(capi_profile)); strlcpy(ctrl->manu, "AVM GmbH", sizeof(ctrl->manu)); dversion = cinfo->version[VER_DRIVER]; ctrl->version.majorversion = 2; @@ -439,49 +439,49 @@ void b1_parse_version(avmctrl_info *cinfo) ctrl->version.majormanuversion |= ((dversion[2] - '0') & 0xf); ctrl->version.minormanuversion = (dversion[3] - '0') << 4; ctrl->version.minormanuversion |= - (dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf); + (dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf); profp = &ctrl->profile; flag = ((u8 *)(profp->manu))[1]; switch (flag) { case 0: if (cinfo->version[VER_CARDTYPE]) - strcpy(cinfo->cardname, cinfo->version[VER_CARDTYPE]); - else strcpy(cinfo->cardname, "B1"); + strcpy(cinfo->cardname, cinfo->version[VER_CARDTYPE]); + else strcpy(cinfo->cardname, "B1"); break; - case 3: strcpy(cinfo->cardname,"PCMCIA B"); break; - case 4: strcpy(cinfo->cardname,"PCMCIA M1"); break; - case 5: strcpy(cinfo->cardname,"PCMCIA M2"); break; - case 6: strcpy(cinfo->cardname,"B1 V3.0"); break; - case 7: strcpy(cinfo->cardname,"B1 PCI"); break; + case 3: strcpy(cinfo->cardname, "PCMCIA B"); break; + case 4: strcpy(cinfo->cardname, "PCMCIA M1"); break; + case 5: strcpy(cinfo->cardname, "PCMCIA M2"); break; + case 6: strcpy(cinfo->cardname, "B1 V3.0"); break; + case 7: strcpy(cinfo->cardname, "B1 PCI"); break; default: sprintf(cinfo->cardname, "AVM?%u", (unsigned int)flag); break; - } - printk(KERN_NOTICE "%s: card %d \"%s\" ready.\n", - card->name, ctrl->cnr, cinfo->cardname); + } + printk(KERN_NOTICE "%s: card %d \"%s\" ready.\n", + card->name, ctrl->cnr, cinfo->cardname); - flag = ((u8 *)(profp->manu))[3]; - if (flag) + flag = ((u8 *)(profp->manu))[3]; + if (flag) printk(KERN_NOTICE "%s: card %d Protocol:%s%s%s%s%s%s%s\n", - card->name, - ctrl->cnr, - (flag & 0x01) ? " DSS1" : "", - (flag & 0x02) ? " CT1" : "", - (flag & 0x04) ? " VN3" : "", - (flag & 0x08) ? " NI1" : "", - (flag & 0x10) ? " AUSTEL" : "", - (flag & 0x20) ? " ESS" : "", - (flag & 0x40) ? " 1TR6" : "" + card->name, + ctrl->cnr, + (flag & 0x01) ? " DSS1" : "", + (flag & 0x02) ? " CT1" : "", + (flag & 0x04) ? " VN3" : "", + (flag & 0x08) ? " NI1" : "", + (flag & 0x10) ? " AUSTEL" : "", + (flag & 0x20) ? " ESS" : "", + (flag & 0x40) ? " 1TR6" : "" ); - flag = ((u8 *)(profp->manu))[5]; + flag = ((u8 *)(profp->manu))[5]; if (flag) printk(KERN_NOTICE "%s: card %d Linetype:%s%s%s%s\n", - card->name, - ctrl->cnr, - (flag & 0x01) ? " point to point" : "", - (flag & 0x02) ? " point to multipoint" : "", - (flag & 0x08) ? " leased line without D-channel" : "", - (flag & 0x04) ? " leased line with D-channel" : "" + card->name, + ctrl->cnr, + (flag & 0x01) ? " point to point" : "", + (flag & 0x02) ? " point to multipoint" : "", + (flag & 0x08) ? " leased line without D-channel" : "", + (flag & 0x04) ? " leased line with D-channel" : "" ); } @@ -521,13 +521,13 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) spin_unlock_irqrestore(&card->lock, flags); if (MsgLen < 30) { /* not CAPI 64Bit */ - memset(card->msgbuf+MsgLen, 0, 30-MsgLen); + memset(card->msgbuf + MsgLen, 0, 30-MsgLen); MsgLen = 30; CAPIMSG_SETLEN(card->msgbuf, 30); } if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); @@ -541,7 +541,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) MsgLen = b1_get_slice(card->port, card->msgbuf); if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); spin_unlock_irqrestore(&card->lock, flags); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); @@ -573,7 +573,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) break; case RECEIVE_START: - /* b1_put_byte(card->port, SEND_POLLACK); */ + /* b1_put_byte(card->port, SEND_POLLACK); */ spin_unlock_irqrestore(&card->lock, flags); capi_ctr_resume_output(ctrl); break; @@ -600,24 +600,24 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) MsgLen = b1_get_slice(card->port, card->msgbuf); spin_unlock_irqrestore(&card->lock, flags); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: task %d \"%s\" ready.\n", - card->name, ApplId, card->msgbuf); + card->name, ApplId, card->msgbuf); break; case RECEIVE_DEBUGMSG: MsgLen = b1_get_slice(card->port, card->msgbuf); spin_unlock_irqrestore(&card->lock, flags); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); @@ -630,7 +630,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) default: spin_unlock_irqrestore(&card->lock, flags); printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", - card->name, b1cmd); + card->name, b1cmd); return IRQ_HANDLED; } return IRQ_HANDLED; @@ -671,29 +671,29 @@ static int b1ctl_proc_show(struct seq_file *m, void *v) seq_printf(m, "%-16s %s\n", "ver_serial", s); if (card->cardtype != avm_m1) { - flag = ((u8 *)(ctrl->profile.manu))[3]; - if (flag) + flag = ((u8 *)(ctrl->profile.manu))[3]; + if (flag) seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", - "protocol", - (flag & 0x01) ? " DSS1" : "", - (flag & 0x02) ? " CT1" : "", - (flag & 0x04) ? " VN3" : "", - (flag & 0x08) ? " NI1" : "", - (flag & 0x10) ? " AUSTEL" : "", - (flag & 0x20) ? " ESS" : "", - (flag & 0x40) ? " 1TR6" : "" - ); + "protocol", + (flag & 0x01) ? " DSS1" : "", + (flag & 0x02) ? " CT1" : "", + (flag & 0x04) ? " VN3" : "", + (flag & 0x08) ? " NI1" : "", + (flag & 0x10) ? " AUSTEL" : "", + (flag & 0x20) ? " ESS" : "", + (flag & 0x40) ? " 1TR6" : "" + ); } if (card->cardtype != avm_m1) { - flag = ((u8 *)(ctrl->profile.manu))[5]; + flag = ((u8 *)(ctrl->profile.manu))[5]; if (flag) seq_printf(m, "%-16s%s%s%s%s\n", - "linetype", - (flag & 0x01) ? " point to point" : "", - (flag & 0x02) ? " point to multipoint" : "", - (flag & 0x08) ? " leased line without D-channel" : "", - (flag & 0x04) ? " leased line with D-channel" : "" - ); + "linetype", + (flag & 0x01) ? " point to point" : "", + (flag & 0x02) ? " point to multipoint" : "", + (flag & 0x08) ? " leased line without D-channel" : "", + (flag & 0x04) ? " leased line with D-channel" : "" + ); } seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); @@ -750,12 +750,12 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize) return p; - err_free_consistent: +err_free_consistent: pci_free_consistent(p->pcidev, p->recvbuf.size, p->recvbuf.dmabuf, p->recvbuf.dmaaddr); - err_kfree: +err_kfree: kfree(p); - err: +err: return NULL; } @@ -800,7 +800,7 @@ static int __init b1_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index a0ed668d4d2a..0896aa86fc08 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c @@ -1,9 +1,9 @@ /* $Id: b1dma.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ - * + * * Common module for AVM B1 cards that support dma with AMCC - * + * * Copyright 2000 by Carsten Paeth <calle@calle.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -110,11 +110,11 @@ static int b1dma_tolink(avmcard *card, void *buf, unsigned int len) unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */ unsigned char *s = (unsigned char *)buf; while (len--) { - while ( !b1dma_tx_empty(card->port) + while (!b1dma_tx_empty(card->port) && time_before(jiffies, stop)); - if (!b1dma_tx_empty(card->port)) + if (!b1dma_tx_empty(card->port)) return -1; - t1outp(card->port, 0x01, *s++); + t1outp(card->port, 0x01, *s++); } return 0; } @@ -124,11 +124,11 @@ static int b1dma_fromlink(avmcard *card, void *buf, unsigned int len) unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */ unsigned char *s = (unsigned char *)buf; while (len--) { - while ( !b1dma_rx_full(card->port) + while (!b1dma_rx_full(card->port) && time_before(jiffies, stop)); - if (!b1dma_rx_full(card->port)) + if (!b1dma_rx_full(card->port)) return -1; - *s++ = t1inp(card->port, 0x00); + *s++ = t1inp(card->port, 0x00); } return 0; } @@ -136,7 +136,7 @@ static int b1dma_fromlink(avmcard *card, void *buf, unsigned int len) static int WriteReg(avmcard *card, u32 reg, u8 val) { u8 cmd = 0x00; - if ( b1dma_tolink(card, &cmd, 1) == 0 + if (b1dma_tolink(card, &cmd, 1) == 0 && b1dma_tolink(card, ®, 4) == 0) { u32 tmp = val; return b1dma_tolink(card, &tmp, 4); @@ -147,7 +147,7 @@ static int WriteReg(avmcard *card, u32 reg, u8 val) static u8 ReadReg(avmcard *card, u32 reg) { u8 cmd = 0x01; - if ( b1dma_tolink(card, &cmd, 1) == 0 + if (b1dma_tolink(card, &cmd, 1) == 0 && b1dma_tolink(card, ®, 4) == 0) { u32 tmp; if (b1dma_fromlink(card, &tmp, 4) == 0) @@ -258,30 +258,30 @@ static int b1dma_detect(avmcard *card) b1dma_writel(card, 0xffffffff, AMCC_RXPTR); b1dma_writel(card, 0xffffffff, AMCC_TXPTR); - if ( b1dma_readl(card, AMCC_RXPTR) != 0xfffffffc + if (b1dma_readl(card, AMCC_RXPTR) != 0xfffffffc || b1dma_readl(card, AMCC_TXPTR) != 0xfffffffc) return 2; b1dma_writel(card, 0x0, AMCC_RXPTR); b1dma_writel(card, 0x0, AMCC_TXPTR); - if ( b1dma_readl(card, AMCC_RXPTR) != 0x0 + if (b1dma_readl(card, AMCC_RXPTR) != 0x0 || b1dma_readl(card, AMCC_TXPTR) != 0x0) return 3; t1outp(card->port, 0x10, 0x00); t1outp(card->port, 0x07, 0x00); - + t1outp(card->port, 0x02, 0x02); t1outp(card->port, 0x03, 0x02); - if ( (t1inp(card->port, 0x02) & 0xFE) != 0x02 + if ((t1inp(card->port, 0x02) & 0xFE) != 0x02 || t1inp(card->port, 0x3) != 0x03) return 4; t1outp(card->port, 0x02, 0x00); t1outp(card->port, 0x03, 0x00); - if ( (t1inp(card->port, 0x02) & 0xFE) != 0x00 + if ((t1inp(card->port, 0x02) & 0xFE) != 0x00 || t1inp(card->port, 0x3) != 0x01) return 5; @@ -294,28 +294,28 @@ int t1pci_detect(avmcard *card) if ((ret = b1dma_detect(card)) != 0) return ret; - + /* Transputer test */ - - if ( WriteReg(card, 0x80001000, 0x11) != 0 + + if (WriteReg(card, 0x80001000, 0x11) != 0 || WriteReg(card, 0x80101000, 0x22) != 0 || WriteReg(card, 0x80201000, 0x33) != 0 || WriteReg(card, 0x80301000, 0x44) != 0) return 6; - if ( ReadReg(card, 0x80001000) != 0x11 + if (ReadReg(card, 0x80001000) != 0x11 || ReadReg(card, 0x80101000) != 0x22 || ReadReg(card, 0x80201000) != 0x33 || ReadReg(card, 0x80301000) != 0x44) return 7; - if ( WriteReg(card, 0x80001000, 0x55) != 0 + if (WriteReg(card, 0x80001000, 0x55) != 0 || WriteReg(card, 0x80101000, 0x66) != 0 || WriteReg(card, 0x80201000, 0x77) != 0 || WriteReg(card, 0x80301000, 0x88) != 0) return 8; - if ( ReadReg(card, 0x80001000) != 0x55 + if (ReadReg(card, 0x80001000) != 0x55 || ReadReg(card, 0x80101000) != 0x66 || ReadReg(card, 0x80201000) != 0x77 || ReadReg(card, 0x80301000) != 0x88) @@ -330,20 +330,20 @@ int b1pciv4_detect(avmcard *card) if ((ret = b1dma_detect(card)) != 0) return ret; - - for (i=0; i < 5 ; i++) { + + for (i = 0; i < 5; i++) { if (WriteReg(card, 0x80A00000, 0x21) != 0) return 6; if ((ReadReg(card, 0x80A00000) & 0x01) != 0x01) return 7; } - for (i=0; i < 5 ; i++) { + for (i = 0; i < 5; i++) { if (WriteReg(card, 0x80A00000, 0x20) != 0) return 8; if ((ReadReg(card, 0x80A00000) & 0x01) != 0x00) return 9; } - + return 0; } @@ -373,7 +373,7 @@ static void b1dma_dispatch_tx(avmcard *card) u16 len; u32 txlen; void *p; - + skb = skb_dequeue(&dma->send_queue); len = CAPIMSG_LEN(skb->data); @@ -398,13 +398,13 @@ static void b1dma_dispatch_tx(avmcard *card) printk(KERN_DEBUG "tx: put msg len=%d\n", txlen); #endif } else { - txlen = skb->len-2; + txlen = skb->len - 2; #ifdef AVM_B1DMA_POLLDEBUG if (skb->data[2] == SEND_POLLACK) printk(KERN_INFO "%s: send ack\n", card->name); #endif #ifdef AVM_B1DMA_DEBUG - printk(KERN_DEBUG "tx: put 0x%x len=%d\n", + printk(KERN_DEBUG "tx: put 0x%x len=%d\n", skb->data[2], txlen); #endif skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, @@ -430,7 +430,7 @@ static void queue_pollack(avmcard *card) skb = alloc_skb(3, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost poll ack\n", - card->name); + card->name); return; } p = skb->data; @@ -450,14 +450,14 @@ static void b1dma_handle_rx(avmcard *card) avmcard_dmainfo *dma = card->dma; struct capi_ctr *ctrl = &cinfo->capi_ctrl; struct sk_buff *skb; - void *p = dma->recvbuf.dmabuf+4; + void *p = dma->recvbuf.dmabuf + 4; u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize; u8 b1cmd = _get_byte(&p); #ifdef AVM_B1DMA_DEBUG printk(KERN_DEBUG "rx: 0x%x %lu\n", b1cmd, (unsigned long)dma->recvlen); #endif - + switch (b1cmd) { case RECEIVE_DATA_B3_IND: @@ -466,13 +466,13 @@ static void b1dma_handle_rx(avmcard *card) DataB3Len = _get_slice(&p, card->databuf); if (MsgLen < 30) { /* not CAPI 64Bit */ - memset(card->msgbuf+MsgLen, 0, 30-MsgLen); + memset(card->msgbuf + MsgLen, 0, 30 - MsgLen); MsgLen = 30; CAPIMSG_SETLEN(card->msgbuf, 30); } - if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) { + if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); @@ -486,14 +486,14 @@ static void b1dma_handle_rx(avmcard *card) MsgLen = _get_slice(&p, card->msgbuf); if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) { spin_lock(&card->lock); capilib_data_b3_conf(&cinfo->ncci_head, ApplId, - CAPIMSG_NCCI(skb->data), - CAPIMSG_MSGID(skb->data)); + CAPIMSG_NCCI(skb->data), + CAPIMSG_MSGID(skb->data)); spin_unlock(&card->lock); } capi_ctr_handle_message(ctrl, ApplId, skb); @@ -550,23 +550,23 @@ static void b1dma_handle_rx(avmcard *card) ApplId = (unsigned) _get_word(&p); MsgLen = _get_slice(&p, card->msgbuf); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: task %d \"%s\" ready.\n", - card->name, ApplId, card->msgbuf); + card->name, ApplId, card->msgbuf); break; case RECEIVE_DEBUGMSG: MsgLen = _get_slice(&p, card->msgbuf); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); @@ -574,7 +574,7 @@ static void b1dma_handle_rx(avmcard *card) default: printk(KERN_ERR "%s: b1dma_interrupt: 0x%x ???\n", - card->name, b1cmd); + card->name, b1cmd); return; } } @@ -594,7 +594,7 @@ static void b1dma_handle_interrupt(avmcard *card) return; } - newcsr = card->csr | (status & ALL_INT); + newcsr = card->csr | (status & ALL_INT); if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT; if (status & RX_TC_INT) newcsr &= ~EN_RX_TC_INT; b1dma_writel(card, newcsr, AMCC_INTCSR); @@ -602,23 +602,23 @@ static void b1dma_handle_interrupt(avmcard *card) if ((status & RX_TC_INT) != 0) { struct avmcard_dmainfo *dma = card->dma; u32 rxlen; - if (card->dma->recvlen == 0) { - rxlen = b1dma_readl(card, AMCC_RXLEN); + if (card->dma->recvlen == 0) { + rxlen = b1dma_readl(card, AMCC_RXLEN); if (rxlen == 0) { dma->recvlen = *((u32 *)dma->recvbuf.dmabuf); rxlen = (dma->recvlen + 3) & ~3; - b1dma_writel(card, dma->recvbuf.dmaaddr+4, AMCC_RXPTR); + b1dma_writel(card, dma->recvbuf.dmaaddr + 4, AMCC_RXPTR); b1dma_writel(card, rxlen, AMCC_RXLEN); #ifdef AVM_B1DMA_DEBUG } else { printk(KERN_ERR "%s: rx not complete (%d).\n", - card->name, rxlen); + card->name, rxlen); #endif } } else { spin_unlock(&card->lock); b1dma_handle_rx(card); - dma->recvlen = 0; + dma->recvlen = 0; spin_lock(&card->lock); b1dma_writel(card, dma->recvbuf.dmaaddr, AMCC_RXPTR); b1dma_writel(card, 4, AMCC_RXLEN); @@ -659,7 +659,7 @@ static int b1dma_loaded(avmcard *card) } if (!b1_tx_empty(base)) { printk(KERN_ERR "%s: b1dma_loaded: tx err, corrupted t4 file ?\n", - card->name); + card->name); return 0; } b1_put_byte(base, SEND_POLLACK); @@ -686,7 +686,7 @@ static void b1dma_send_init(avmcard *card) skb = alloc_skb(15, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost register appl.\n", - card->name); + card->name); return; } p = skb->data; @@ -694,7 +694,7 @@ static void b1dma_send_init(avmcard *card) _put_byte(&p, 0); _put_byte(&p, SEND_INIT); _put_word(&p, CAPI_MAXAPPL); - _put_word(&p, AVM_NCCI_PER_CHANNEL*30); + _put_word(&p, AVM_NCCI_PER_CHANNEL * 30); _put_word(&p, card->cardnr - 1); skb_put(skb, (u8 *)p - (u8 *)skb->data); @@ -712,7 +712,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = b1_load_t4file(card, &data->firmware))) { b1dma_reset(card); printk(KERN_ERR "%s: failed to load t4file!!\n", - card->name); + card->name); return retval; } @@ -720,7 +720,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = b1_load_config(card, &data->configuration))) { b1dma_reset(card); printk(KERN_ERR "%s: failed to load config!!\n", - card->name); + card->name); return retval; } } @@ -733,8 +733,8 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) card->csr = AVM_FLAG; b1dma_writel(card, card->csr, AMCC_INTCSR); - b1dma_writel(card, EN_A2P_TRANSFERS|EN_P2A_TRANSFERS|A2P_HI_PRIORITY| - P2A_HI_PRIORITY|RESET_A2P_FLAGS|RESET_P2A_FLAGS, + b1dma_writel(card, EN_A2P_TRANSFERS | EN_P2A_TRANSFERS | A2P_HI_PRIORITY | + P2A_HI_PRIORITY | RESET_A2P_FLAGS | RESET_P2A_FLAGS, AMCC_MCSR); t1outp(card->port, 0x07, 0x30); t1outp(card->port, 0x10, 0xF0); @@ -745,7 +745,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) card->csr |= EN_RX_TC_INT; b1dma_writel(card, card->csr, AMCC_INTCSR); - b1dma_send_init(card); + b1dma_send_init(card); return 0; } @@ -757,7 +757,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) unsigned long flags; spin_lock_irqsave(&card->lock, flags); - b1dma_reset(card); + b1dma_reset(card); memset(cinfo->version, 0, sizeof(cinfo->version)); capilib_release(&cinfo->ncci_head); @@ -768,8 +768,8 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) /* ------------------------------------------------------------- */ void b1dma_register_appl(struct capi_ctr *ctrl, - u16 appl, - capi_register_params *rp) + u16 appl, + capi_register_params *rp) { avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmcard *card = cinfo->card; @@ -785,7 +785,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl, skb = alloc_skb(23, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost register appl.\n", - card->name); + card->name); return; } p = skb->data; @@ -793,7 +793,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl, _put_byte(&p, 0); _put_byte(&p, SEND_REGISTER); _put_word(&p, appl); - _put_word(&p, 1024 * (nconn+1)); + _put_word(&p, 1024 * (nconn + 1)); _put_word(&p, nconn); _put_word(&p, rp->datablkcnt); _put_word(&p, rp->datablklen); @@ -819,7 +819,7 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl) skb = alloc_skb(7, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost release appl.\n", - card->name); + card->name); return; } p = skb->data; @@ -841,7 +841,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) avmcard *card = cinfo->card; u16 retval = CAPI_NOERROR; - if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { + if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { unsigned long flags; spin_lock_irqsave(&card->lock, flags); retval = capilib_data_b3_req(&cinfo->ncci_head, @@ -850,7 +850,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) CAPIMSG_MSGID(skb->data)); spin_unlock_irqrestore(&card->lock, flags); } - if (retval == CAPI_NOERROR) + if (retval == CAPI_NOERROR) b1dma_queue_tx(card, skb); return retval; @@ -893,29 +893,29 @@ static int b1dmactl_proc_show(struct seq_file *m, void *v) seq_printf(m, "%-16s %s\n", "ver_serial", s); if (card->cardtype != avm_m1) { - flag = ((u8 *)(ctrl->profile.manu))[3]; - if (flag) + flag = ((u8 *)(ctrl->profile.manu))[3]; + if (flag) seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", - "protocol", - (flag & 0x01) ? " DSS1" : "", - (flag & 0x02) ? " CT1" : "", - (flag & 0x04) ? " VN3" : "", - (flag & 0x08) ? " NI1" : "", - (flag & 0x10) ? " AUSTEL" : "", - (flag & 0x20) ? " ESS" : "", - (flag & 0x40) ? " 1TR6" : "" - ); + "protocol", + (flag & 0x01) ? " DSS1" : "", + (flag & 0x02) ? " CT1" : "", + (flag & 0x04) ? " VN3" : "", + (flag & 0x08) ? " NI1" : "", + (flag & 0x10) ? " AUSTEL" : "", + (flag & 0x20) ? " ESS" : "", + (flag & 0x40) ? " 1TR6" : "" + ); } if (card->cardtype != avm_m1) { - flag = ((u8 *)(ctrl->profile.manu))[5]; + flag = ((u8 *)(ctrl->profile.manu))[5]; if (flag) seq_printf(m, "%-16s%s%s%s%s\n", - "linetype", - (flag & 0x01) ? " point to point" : "", - (flag & 0x02) ? " point to multipoint" : "", - (flag & 0x08) ? " leased line without D-channel" : "", - (flag & 0x04) ? " leased line with D-channel" : "" - ); + "linetype", + (flag & 0x01) ? " point to point" : "", + (flag & 0x02) ? " point to multipoint" : "", + (flag & 0x08) ? " leased line without D-channel" : "", + (flag & 0x04) ? " leased line with D-channel" : "" + ); } seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); @@ -977,7 +977,7 @@ static int __init b1dma_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, sizeof(rev)); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c index ff5390546f92..31ef8130a87f 100644 --- a/drivers/isdn/hardware/avm/b1isa.c +++ b/drivers/isdn/hardware/avm/b1isa.c @@ -1,9 +1,9 @@ /* $Id: b1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ - * + * * Module for AVM B1 ISA-card. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -80,7 +80,7 @@ static int b1isa_probe(struct pci_dev *pdev) card->cardtype = avm_b1isa; sprintf(card->name, "b1isa-%x", card->port); - if ( card->port != 0x150 && card->port != 0x250 + if (card->port != 0x150 && card->port != 0x250 && card->port != 0x300 && card->port != 0x340) { printk(KERN_WARNING "b1isa: invalid port 0x%x.\n", card->port); retval = -EINVAL; @@ -136,13 +136,13 @@ static int b1isa_probe(struct pci_dev *pdev) pci_set_drvdata(pdev, cinfo); return 0; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_release_region: +err_release_region: release_region(card->port, AVMB1_PORTLEN); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -206,7 +206,7 @@ static int __init b1isa_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c index c97e4315079d..b305e6b2b8ee 100644 --- a/drivers/isdn/hardware/avm/b1pci.c +++ b/drivers/isdn/hardware/avm/b1pci.c @@ -1,9 +1,9 @@ /* $Id: b1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ - * + * * Module for AVM B1 PCI-card. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -79,7 +79,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) card->port = p->port; card->irq = p->irq; card->cardtype = avm_b1pci; - + if (!request_region(card->port, AVMB1_PORTLEN, card->name)) { printk(KERN_WARNING "b1pci: ports 0x%03x-0x%03x in use.\n", card->port, card->port + AVMB1_PORTLEN); @@ -96,14 +96,14 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) } b1_reset(card->port); b1_getrevision(card); - + retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card); if (retval) { printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq); retval = -EBUSY; goto err_release_region; } - + cinfo->capi_ctrl.driver_name = "b1pci"; cinfo->capi_ctrl.driverdata = cinfo; cinfo->capi_ctrl.register_appl = b1_register_appl; @@ -133,13 +133,13 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) pci_set_drvdata(pdev, card); return 0; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_release_region: +err_release_region: release_region(card->port, AVMB1_PORTLEN); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -193,7 +193,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) goto err; } - card->dma = avmcard_dma_alloc("b1pci", pdev, 2048+128, 2048+128); + card->dma = avmcard_dma_alloc("b1pci", pdev, 2048 + 128, 2048 + 128); if (!card->dma) { printk(KERN_WARNING "b1pci: dma alloc.\n"); retval = -ENOMEM; @@ -267,17 +267,17 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) pci_set_drvdata(pdev, card); return 0; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_unmap: +err_unmap: iounmap(card->mbase); - err_release_region: +err_release_region: release_region(card->port, AVMB1_PORTLEN); - err_free_dma: +err_free_dma: avmcard_dma_free(card->dma); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -287,13 +287,13 @@ static void b1pciv4_remove(struct pci_dev *pdev) avmcard *card = pci_get_drvdata(pdev); avmctrl_info *cinfo = card->ctrlinfo; - b1dma_reset(card); + b1dma_reset(card); detach_capi_ctr(&cinfo->capi_ctrl); free_irq(card->irq, card); iounmap(card->mbase); release_region(card->port, AVMB1_PORTLEN); - avmcard_dma_free(card->dma); + avmcard_dma_free(card->dma); b1_free_card(card); } @@ -326,7 +326,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev, retval = b1pci_probe(¶m, pdev); #endif if (retval != 0) { - printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n", + printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n", param.port, param.irq, param.membase); } } else { @@ -337,7 +337,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev, param.port, param.irq); retval = b1pci_probe(¶m, pdev); if (retval != 0) { - printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n", + printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n", param.port, param.irq); } } @@ -385,7 +385,7 @@ static int __init b1pci_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c index d6391e0afeea..6b0d19d963d5 100644 --- a/drivers/isdn/hardware/avm/b1pcmcia.c +++ b/drivers/isdn/hardware/avm/b1pcmcia.c @@ -1,9 +1,9 @@ /* $Id: b1pcmcia.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ - * + * * Module for AVM B1/M1/M2 PCMCIA-card. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -74,9 +74,9 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, cinfo = card->ctrlinfo; switch (cardtype) { - case avm_m1: sprintf(card->name, "m1-%x", port); break; - case avm_m2: sprintf(card->name, "m2-%x", port); break; - default: sprintf(card->name, "b1pcmcia-%x", port); break; + case avm_m1: sprintf(card->name, "m1-%x", port); break; + case avm_m2: sprintf(card->name, "m2-%x", port); break; + default: sprintf(card->name, "b1pcmcia-%x", port); break; } card->port = port; card->irq = irq; @@ -117,9 +117,9 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, goto err_free_irq; } switch (cardtype) { - case avm_m1: cardname = "M1"; break; - case avm_m2: cardname = "M2"; break; - default : cardname = "B1 PCMCIA"; break; + case avm_m1: cardname = "M1"; break; + case avm_m2: cardname = "M2"; break; + default: cardname = "B1 PCMCIA"; break; } printk(KERN_INFO "b1pcmcia: AVM %s at i/o %#x, irq %d, revision %d\n", @@ -128,11 +128,11 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, list_add(&card->list, &cards); return cinfo->capi_ctrl.cnr; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -175,7 +175,7 @@ int b1pcmcia_delcard(unsigned int port, unsigned irq) { struct list_head *l; avmcard *card; - + list_for_each(l, &cards) { card = list_entry(l, avmcard, list); if (card->port == port && card->irq == irq) { @@ -204,7 +204,7 @@ static int __init b1pcmcia_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 9743b24ef9d6..98f18812441d 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c @@ -1,7 +1,7 @@ /* $Id: c4.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ - * + * * Module for AVM C4 & C2 card. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> * * This software may be used and distributed according to the terms @@ -129,8 +129,8 @@ static void c4_dispatch_tx(avmcard *card); /* ------------------------------------------------------------- */ -#define RESET_TIMEOUT (15*HZ) /* 15 sec */ -#define PEEK_POKE_TIMEOUT (HZ/10) /* 0.1 sec */ +#define RESET_TIMEOUT (15 * HZ) /* 15 sec */ +#define PEEK_POKE_TIMEOUT (HZ / 10) /* 0.1 sec */ /* ------------------------------------------------------------- */ @@ -148,7 +148,7 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t) unsigned long stop; stop = jiffies + t; - while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { + while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) { if (!time_before(jiffies, stop)) return -1; mb(); @@ -159,40 +159,40 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t) static int c4_poke(avmcard *card, unsigned long off, unsigned long value) { - if (wait_for_doorbell(card, HZ/10) < 0) + if (wait_for_doorbell(card, HZ / 10) < 0) return -1; - - c4outmeml(card->mbase+MBOX_PEEK_POKE, off); - c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); - if (wait_for_doorbell(card, HZ/10) < 0) + c4outmeml(card->mbase + MBOX_PEEK_POKE, off); + c4outmeml(card->mbase + DOORBELL, DBELL_ADDR); + + if (wait_for_doorbell(card, HZ / 10) < 0) return -1; - c4outmeml(card->mbase+MBOX_PEEK_POKE, value); - c4outmeml(card->mbase+DOORBELL, DBELL_DATA | DBELL_ADDR); + c4outmeml(card->mbase + MBOX_PEEK_POKE, value); + c4outmeml(card->mbase + DOORBELL, DBELL_DATA | DBELL_ADDR); return 0; } static int c4_peek(avmcard *card, unsigned long off, unsigned long *valuep) { - if (wait_for_doorbell(card, HZ/10) < 0) + if (wait_for_doorbell(card, HZ / 10) < 0) return -1; - c4outmeml(card->mbase+MBOX_PEEK_POKE, off); - c4outmeml(card->mbase+DOORBELL, DBELL_RNWR | DBELL_ADDR); + c4outmeml(card->mbase + MBOX_PEEK_POKE, off); + c4outmeml(card->mbase + DOORBELL, DBELL_RNWR | DBELL_ADDR); - if (wait_for_doorbell(card, HZ/10) < 0) + if (wait_for_doorbell(card, HZ / 10) < 0) return -1; - *valuep = c4inmeml(card->mbase+MBOX_PEEK_POKE); + *valuep = c4inmeml(card->mbase + MBOX_PEEK_POKE); return 0; } /* ------------------------------------------------------------- */ -static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) +static int c4_load_t4file(avmcard *card, capiloaddatapart *t4file) { u32 val; unsigned char *dp; @@ -202,7 +202,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) dp = t4file->data; left = t4file->len; while (left >= sizeof(u32)) { - if (t4file->user) { + if (t4file->user) { if (copy_from_user(&val, dp, sizeof(val))) return -EFAULT; } else { @@ -210,7 +210,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) } if (c4_poke(card, loadoff, val)) { printk(KERN_ERR "%s: corrupted firmware file ?\n", - card->name); + card->name); return -EIO; } left -= sizeof(u32); @@ -227,7 +227,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file) } if (c4_poke(card, loadoff, val)) { printk(KERN_ERR "%s: corrupted firmware file ?\n", - card->name); + card->name); return -EIO; } } @@ -297,13 +297,13 @@ static void c4_reset(avmcard *card) { unsigned long stop; - c4outmeml(card->mbase+DOORBELL, DBELL_RESET_ARM); + c4outmeml(card->mbase + DOORBELL, DBELL_RESET_ARM); - stop = jiffies + HZ*10; - while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { + stop = jiffies + HZ * 10; + while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) { if (!time_before(jiffies, stop)) return; - c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); + c4outmeml(card->mbase + DOORBELL, DBELL_ADDR); mb(); } @@ -317,89 +317,89 @@ static int c4_detect(avmcard *card) { unsigned long stop, dummy; - c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c); - if (c4inmeml(card->mbase+PCI_OUT_INT_MASK) != 0x0c) + c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x0c); + if (c4inmeml(card->mbase + PCI_OUT_INT_MASK) != 0x0c) return 1; - c4outmeml(card->mbase+DOORBELL, DBELL_RESET_ARM); + c4outmeml(card->mbase + DOORBELL, DBELL_RESET_ARM); - stop = jiffies + HZ*10; - while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { + stop = jiffies + HZ * 10; + while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) { if (!time_before(jiffies, stop)) return 2; - c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); + c4outmeml(card->mbase + DOORBELL, DBELL_ADDR); mb(); } c4_poke(card, DC21285_ARMCSR_BASE + CHAN_1_CONTROL, 0); c4_poke(card, DC21285_ARMCSR_BASE + CHAN_2_CONTROL, 0); - c4outmeml(card->mbase+MAILBOX_0, 0x55aa55aa); - if (c4inmeml(card->mbase+MAILBOX_0) != 0x55aa55aa) return 3; + c4outmeml(card->mbase + MAILBOX_0, 0x55aa55aa); + if (c4inmeml(card->mbase + MAILBOX_0) != 0x55aa55aa) return 3; - c4outmeml(card->mbase+MAILBOX_0, 0xaa55aa55); - if (c4inmeml(card->mbase+MAILBOX_0) != 0xaa55aa55) return 4; + c4outmeml(card->mbase + MAILBOX_0, 0xaa55aa55); + if (c4inmeml(card->mbase + MAILBOX_0) != 0xaa55aa55) return 4; - if (c4_poke(card, DC21285_ARMCSR_BASE+DBELL_SA_MASK, 0)) return 5; - if (c4_poke(card, DC21285_ARMCSR_BASE+DBELL_PCI_MASK, 0)) return 6; - if (c4_poke(card, DC21285_ARMCSR_BASE+SA_CONTROL, SA_CTL_ALLRIGHT)) + if (c4_poke(card, DC21285_ARMCSR_BASE + DBELL_SA_MASK, 0)) return 5; + if (c4_poke(card, DC21285_ARMCSR_BASE + DBELL_PCI_MASK, 0)) return 6; + if (c4_poke(card, DC21285_ARMCSR_BASE + SA_CONTROL, SA_CTL_ALLRIGHT)) return 7; - if (c4_poke(card, DC21285_ARMCSR_BASE+XBUS_CYCLE, INIT_XBUS_CYCLE)) + if (c4_poke(card, DC21285_ARMCSR_BASE + XBUS_CYCLE, INIT_XBUS_CYCLE)) return 8; - if (c4_poke(card, DC21285_ARMCSR_BASE+XBUS_STROBE, INIT_XBUS_STROBE)) + if (c4_poke(card, DC21285_ARMCSR_BASE + XBUS_STROBE, INIT_XBUS_STROBE)) return 8; - if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_TIMING, 0)) return 9; + if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_TIMING, 0)) return 9; - mdelay(1); + mdelay(1); if (c4_peek(card, DC21285_DRAM_A0MR, &dummy)) return 10; if (c4_peek(card, DC21285_DRAM_A1MR, &dummy)) return 11; if (c4_peek(card, DC21285_DRAM_A2MR, &dummy)) return 12; if (c4_peek(card, DC21285_DRAM_A3MR, &dummy)) return 13; - if (c4_poke(card, DC21285_DRAM_A0MR+CAS_OFFSET, 0)) return 14; - if (c4_poke(card, DC21285_DRAM_A1MR+CAS_OFFSET, 0)) return 15; - if (c4_poke(card, DC21285_DRAM_A2MR+CAS_OFFSET, 0)) return 16; - if (c4_poke(card, DC21285_DRAM_A3MR+CAS_OFFSET, 0)) return 17; + if (c4_poke(card, DC21285_DRAM_A0MR + CAS_OFFSET, 0)) return 14; + if (c4_poke(card, DC21285_DRAM_A1MR + CAS_OFFSET, 0)) return 15; + if (c4_poke(card, DC21285_DRAM_A2MR + CAS_OFFSET, 0)) return 16; + if (c4_poke(card, DC21285_DRAM_A3MR + CAS_OFFSET, 0)) return 17; - mdelay(1); + mdelay(1); - if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_TIMING, DRAM_TIMING_DEF)) + if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_TIMING, DRAM_TIMING_DEF)) return 18; - if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_0,DRAM_AD_SZ_DEF0)) + if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_0, DRAM_AD_SZ_DEF0)) return 19; - if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_1,DRAM_AD_SZ_NULL)) + if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_1, DRAM_AD_SZ_NULL)) return 20; - if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_2,DRAM_AD_SZ_NULL)) + if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_2, DRAM_AD_SZ_NULL)) return 21; - if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_3,DRAM_AD_SZ_NULL)) + if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_3, DRAM_AD_SZ_NULL)) return 22; /* Transputer test */ - - if ( c4_poke(card, 0x000000, 0x11111111) + + if (c4_poke(card, 0x000000, 0x11111111) || c4_poke(card, 0x400000, 0x22222222) - || c4_poke(card, 0x800000, 0x33333333) - || c4_poke(card, 0xC00000, 0x44444444)) + || c4_poke(card, 0x800000, 0x33333333) + || c4_poke(card, 0xC00000, 0x44444444)) return 23; - if ( c4_peek(card, 0x000000, &dummy) || dummy != 0x11111111 + if (c4_peek(card, 0x000000, &dummy) || dummy != 0x11111111 || c4_peek(card, 0x400000, &dummy) || dummy != 0x22222222 - || c4_peek(card, 0x800000, &dummy) || dummy != 0x33333333 - || c4_peek(card, 0xC00000, &dummy) || dummy != 0x44444444) + || c4_peek(card, 0x800000, &dummy) || dummy != 0x33333333 + || c4_peek(card, 0xC00000, &dummy) || dummy != 0x44444444) return 24; - if ( c4_poke(card, 0x000000, 0x55555555) + if (c4_poke(card, 0x000000, 0x55555555) || c4_poke(card, 0x400000, 0x66666666) - || c4_poke(card, 0x800000, 0x77777777) - || c4_poke(card, 0xC00000, 0x88888888)) + || c4_poke(card, 0x800000, 0x77777777) + || c4_poke(card, 0xC00000, 0x88888888)) return 25; - if ( c4_peek(card, 0x000000, &dummy) || dummy != 0x55555555 + if (c4_peek(card, 0x000000, &dummy) || dummy != 0x55555555 || c4_peek(card, 0x400000, &dummy) || dummy != 0x66666666 - || c4_peek(card, 0x800000, &dummy) || dummy != 0x77777777 - || c4_peek(card, 0xC00000, &dummy) || dummy != 0x88888888) + || c4_peek(card, 0x800000, &dummy) || dummy != 0x77777777 + || c4_peek(card, 0xC00000, &dummy) || dummy != 0x88888888) return 26; return 0; @@ -451,26 +451,26 @@ static void c4_dispatch_tx(avmcard *card) printk(KERN_DEBUG "%s: tx put msg len=%d\n", card->name, txlen); #endif } else { - txlen = skb->len-2; + txlen = skb->len - 2; #ifdef AVM_C4_POLLDEBUG if (skb->data[2] == SEND_POLLACK) printk(KERN_INFO "%s: ack to c4\n", card->name); #endif #ifdef AVM_C4_DEBUG printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", - card->name, skb->data[2], txlen); + card->name, skb->data[2], txlen); #endif skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, skb->len - 2); } txlen = (txlen + 3) & ~3; - c4outmeml(card->mbase+MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr); - c4outmeml(card->mbase+MBOX_DOWN_LEN, txlen); + c4outmeml(card->mbase + MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr); + c4outmeml(card->mbase + MBOX_DOWN_LEN, txlen); card->csr |= DBELL_DOWN_ARM; - c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM); + c4outmeml(card->mbase + DOORBELL, DBELL_DOWN_ARM); dev_kfree_skb_any(skb); } @@ -485,7 +485,7 @@ static void queue_pollack(avmcard *card) skb = alloc_skb(3, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost poll ack\n", - card->name); + card->name); return; } p = skb->data; @@ -514,9 +514,9 @@ static void c4_handle_rx(avmcard *card) #ifdef AVM_C4_DEBUG printk(KERN_DEBUG "%s: rx 0x%x len=%lu\n", card->name, - b1cmd, (unsigned long)dma->recvlen); + b1cmd, (unsigned long)dma->recvlen); #endif - + switch (b1cmd) { case RECEIVE_DATA_B3_IND: @@ -528,13 +528,13 @@ static void c4_handle_rx(avmcard *card) ctrl = &card->ctrlinfo[cidx].capi_ctrl; if (MsgLen < 30) { /* not CAPI 64Bit */ - memset(card->msgbuf+MsgLen, 0, 30-MsgLen); + memset(card->msgbuf + MsgLen, 0, 30 - MsgLen); MsgLen = 30; CAPIMSG_SETLEN(card->msgbuf, 30); } - if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) { + if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); @@ -553,7 +553,7 @@ static void c4_handle_rx(avmcard *card) if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) @@ -570,7 +570,7 @@ static void c4_handle_rx(avmcard *card) ApplId = _get_word(&p); NCCI = _get_word(&p); WindowSize = _get_word(&p); - cidx = (NCCI&0x7f) - card->cardnr; + cidx = (NCCI & 0x7f) - card->cardnr; if (cidx >= card->nlogcontr) cidx = 0; capilib_new_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI, WindowSize); @@ -583,7 +583,7 @@ static void c4_handle_rx(avmcard *card) NCCI = _get_word(&p); if (NCCI != 0xffffffff) { - cidx = (NCCI&0x7f) - card->cardnr; + cidx = (NCCI & 0x7f) - card->cardnr; if (cidx >= card->nlogcontr) cidx = 0; capilib_free_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI); } @@ -595,14 +595,14 @@ static void c4_handle_rx(avmcard *card) #endif if (!suppress_pollack) queue_pollack(card); - for (cidx=0; cidx < card->nr_controllers; cidx++) { + for (cidx = 0; cidx < card->nr_controllers; cidx++) { ctrl = &card->ctrlinfo[cidx].capi_ctrl; capi_ctr_resume_output(ctrl); } break; case RECEIVE_STOP: - for (cidx=0; cidx < card->nr_controllers; cidx++) { + for (cidx = 0; cidx < card->nr_controllers; cidx++) { ctrl = &card->ctrlinfo[cidx].capi_ctrl; capi_ctr_suspend_output(ctrl); } @@ -610,14 +610,14 @@ static void c4_handle_rx(avmcard *card) case RECEIVE_INIT: - cidx = card->nlogcontr; + cidx = card->nlogcontr; if (cidx >= card->nr_controllers) { printk(KERN_ERR "%s: card with %d controllers ??\n", - card->name, cidx+1); + card->name, cidx + 1); break; } - card->nlogcontr++; - cinfo = &card->ctrlinfo[cidx]; + card->nlogcontr++; + cinfo = &card->ctrlinfo[cidx]; ctrl = &cinfo->capi_ctrl; cinfo->versionlen = _get_slice(&p, cinfo->versionbuf); b1_parse_version(cinfo); @@ -632,23 +632,23 @@ static void c4_handle_rx(avmcard *card) ApplId = (unsigned) _get_word(&p); MsgLen = _get_slice(&p, card->msgbuf); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: task %d \"%s\" ready.\n", - card->name, ApplId, card->msgbuf); + card->name, ApplId, card->msgbuf); break; case RECEIVE_DEBUGMSG: MsgLen = _get_slice(&p, card->msgbuf); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); @@ -656,7 +656,7 @@ static void c4_handle_rx(avmcard *card) default: printk(KERN_ERR "%s: c4_interrupt: 0x%x ???\n", - card->name, b1cmd); + card->name, b1cmd); return; } } @@ -669,16 +669,16 @@ static irqreturn_t c4_handle_interrupt(avmcard *card) u32 status; spin_lock_irqsave(&card->lock, flags); - status = c4inmeml(card->mbase+DOORBELL); + status = c4inmeml(card->mbase + DOORBELL); if (status & DBELL_RESET_HOST) { u_int i; - c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c); + c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x0c); spin_unlock_irqrestore(&card->lock, flags); if (card->nlogcontr == 0) return IRQ_HANDLED; printk(KERN_ERR "%s: unexpected reset\n", card->name); - for (i=0; i < card->nr_controllers; i++) { + for (i = 0; i < card->nr_controllers; i++) { avmctrl_info *cinfo = &card->ctrlinfo[i]; memset(cinfo->version, 0, sizeof(cinfo->version)); spin_lock_irqsave(&card->lock, flags); @@ -695,23 +695,23 @@ static irqreturn_t c4_handle_interrupt(avmcard *card) spin_unlock_irqrestore(&card->lock, flags); return IRQ_HANDLED; } - c4outmeml(card->mbase+DOORBELL, status); + c4outmeml(card->mbase + DOORBELL, status); if ((status & DBELL_UP_HOST) != 0) { - card->dma->recvlen = c4inmeml(card->mbase+MBOX_UP_LEN); - c4outmeml(card->mbase+MBOX_UP_LEN, 0); + card->dma->recvlen = c4inmeml(card->mbase + MBOX_UP_LEN); + c4outmeml(card->mbase + MBOX_UP_LEN, 0); c4_handle_rx(card); card->dma->recvlen = 0; - c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size); - c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM); + c4outmeml(card->mbase + MBOX_UP_LEN, card->dma->recvbuf.size); + c4outmeml(card->mbase + DOORBELL, DBELL_UP_ARM); } if ((status & DBELL_DOWN_HOST) != 0) { card->csr &= ~DBELL_DOWN_ARM; - c4_dispatch_tx(card); + c4_dispatch_tx(card); } else if (card->csr & DBELL_DOWN_HOST) { - if (c4inmeml(card->mbase+MBOX_DOWN_LEN) == 0) { - card->csr &= ~DBELL_DOWN_ARM; + if (c4inmeml(card->mbase + MBOX_DOWN_LEN) == 0) { + card->csr &= ~DBELL_DOWN_ARM; c4_dispatch_tx(card); } } @@ -737,7 +737,7 @@ static void c4_send_init(avmcard *card) skb = alloc_skb(15, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost register appl.\n", - card->name); + card->name); return; } p = skb->data; @@ -745,7 +745,7 @@ static void c4_send_init(avmcard *card) _put_byte(&p, 0); _put_byte(&p, SEND_INIT); _put_word(&p, CAPI_MAXAPPL); - _put_word(&p, AVM_NCCI_PER_CHANNEL*30); + _put_word(&p, AVM_NCCI_PER_CHANNEL * 30); _put_word(&p, card->cardnr - 1); skb_put(skb, (u8 *)p - (u8 *)skb->data); @@ -761,10 +761,10 @@ static int queue_sendconfigword(avmcard *card, u32 val) unsigned long flags; void *p; - skb = alloc_skb(3+4, GFP_ATOMIC); + skb = alloc_skb(3 + 4, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, send config\n", - card->name); + card->name); return -ENOMEM; } p = skb->data; @@ -787,10 +787,10 @@ static int queue_sendconfig(avmcard *card, char cval[4]) unsigned long flags; void *p; - skb = alloc_skb(3+4, GFP_ATOMIC); + skb = alloc_skb(3 + 4, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, send config\n", - card->name); + card->name); return -ENOMEM; } p = skb->data; @@ -804,20 +804,20 @@ static int queue_sendconfig(avmcard *card, char cval[4]) skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_queue_tail(&card->dma->send_queue, skb); - + spin_lock_irqsave(&card->lock, flags); c4_dispatch_tx(card); spin_unlock_irqrestore(&card->lock, flags); return 0; } -static int c4_send_config(avmcard *card, capiloaddatapart * config) +static int c4_send_config(avmcard *card, capiloaddatapart *config) { u8 val[4]; unsigned char *dp; u_int left; int retval; - + if ((retval = queue_sendconfigword(card, 1)) != 0) return retval; if ((retval = queue_sendconfigword(card, config->len)) != 0) @@ -826,7 +826,7 @@ static int c4_send_config(avmcard *card, capiloaddatapart * config) dp = config->data; left = config->len; while (left >= sizeof(u32)) { - if (config->user) { + if (config->user) { if (copy_from_user(val, dp, sizeof(val))) return -EFAULT; } else { @@ -860,37 +860,37 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = c4_load_t4file(card, &data->firmware))) { printk(KERN_ERR "%s: failed to load t4file!!\n", - card->name); + card->name); c4_reset(card); return retval; } card->csr = 0; - c4outmeml(card->mbase+MBOX_UP_LEN, 0); - c4outmeml(card->mbase+MBOX_DOWN_LEN, 0); - c4outmeml(card->mbase+DOORBELL, DBELL_INIT); + c4outmeml(card->mbase + MBOX_UP_LEN, 0); + c4outmeml(card->mbase + MBOX_DOWN_LEN, 0); + c4outmeml(card->mbase + DOORBELL, DBELL_INIT); mdelay(1); - c4outmeml(card->mbase+DOORBELL, - DBELL_UP_HOST | DBELL_DOWN_HOST | DBELL_RESET_HOST); + c4outmeml(card->mbase + DOORBELL, + DBELL_UP_HOST | DBELL_DOWN_HOST | DBELL_RESET_HOST); - c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x08); + c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x08); card->dma->recvlen = 0; - c4outmeml(card->mbase+MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr); - c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size); - c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM); + c4outmeml(card->mbase + MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr); + c4outmeml(card->mbase + MBOX_UP_LEN, card->dma->recvbuf.size); + c4outmeml(card->mbase + DOORBELL, DBELL_UP_ARM); if (data->configuration.len > 0 && data->configuration.data) { retval = c4_send_config(card, &data->configuration); if (retval) { printk(KERN_ERR "%s: failed to set config!!\n", - card->name); + card->name); c4_reset(card); return retval; } } - c4_send_init(card); + c4_send_init(card); return 0; } @@ -905,11 +905,11 @@ static void c4_reset_ctr(struct capi_ctr *ctrl) spin_lock_irqsave(&card->lock, flags); - c4_reset(card); + c4_reset(card); spin_unlock_irqrestore(&card->lock, flags); - for (i=0; i < card->nr_controllers; i++) { + for (i = 0; i < card->nr_controllers; i++) { cinfo = &card->ctrlinfo[i]; memset(cinfo->version, 0, sizeof(cinfo->version)); capi_ctr_down(&cinfo->capi_ctrl); @@ -926,9 +926,9 @@ static void c4_remove(struct pci_dev *pdev) if (!card) return; - c4_reset(card); + c4_reset(card); - for (i=0; i < card->nr_controllers; i++) { + for (i = 0; i < card->nr_controllers; i++) { cinfo = &card->ctrlinfo[i]; detach_capi_ctr(&cinfo->capi_ctrl); } @@ -936,8 +936,8 @@ static void c4_remove(struct pci_dev *pdev) free_irq(card->irq, card); iounmap(card->mbase); release_region(card->port, AVMB1_PORTLEN); - avmcard_dma_free(card->dma); - pci_set_drvdata(pdev, NULL); + avmcard_dma_free(card->dma); + pci_set_drvdata(pdev, NULL); b1_free_card(card); } @@ -945,8 +945,8 @@ static void c4_remove(struct pci_dev *pdev) static void c4_register_appl(struct capi_ctr *ctrl, - u16 appl, - capi_register_params *rp) + u16 appl, + capi_register_params *rp) { avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmcard *card = cinfo->card; @@ -965,7 +965,7 @@ static void c4_register_appl(struct capi_ctr *ctrl, skb = alloc_skb(23, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost register appl.\n", - card->name); + card->name); return; } p = skb->data; @@ -973,14 +973,14 @@ static void c4_register_appl(struct capi_ctr *ctrl, _put_byte(&p, 0); _put_byte(&p, SEND_REGISTER); _put_word(&p, appl); - _put_word(&p, 1024 * (nconn+1)); + _put_word(&p, 1024 * (nconn + 1)); _put_word(&p, nconn); _put_word(&p, rp->datablkcnt); _put_word(&p, rp->datablklen); skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_queue_tail(&card->dma->send_queue, skb); - + spin_lock_irqsave(&card->lock, flags); c4_dispatch_tx(card); spin_unlock_irqrestore(&card->lock, flags); @@ -1005,7 +1005,7 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl) skb = alloc_skb(7, GFP_ATOMIC); if (!skb) { printk(KERN_CRIT "%s: no memory, lost release appl.\n", - card->name); + card->name); return; } p = skb->data; @@ -1098,29 +1098,29 @@ static int c4_proc_show(struct seq_file *m, void *v) seq_printf(m, "%-16s %s\n", "ver_serial", s); if (card->cardtype != avm_m1) { - flag = ((u8 *)(ctrl->profile.manu))[3]; - if (flag) + flag = ((u8 *)(ctrl->profile.manu))[3]; + if (flag) seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", - "protocol", - (flag & 0x01) ? " DSS1" : "", - (flag & 0x02) ? " CT1" : "", - (flag & 0x04) ? " VN3" : "", - (flag & 0x08) ? " NI1" : "", - (flag & 0x10) ? " AUSTEL" : "", - (flag & 0x20) ? " ESS" : "", - (flag & 0x40) ? " 1TR6" : "" - ); + "protocol", + (flag & 0x01) ? " DSS1" : "", + (flag & 0x02) ? " CT1" : "", + (flag & 0x04) ? " VN3" : "", + (flag & 0x08) ? " NI1" : "", + (flag & 0x10) ? " AUSTEL" : "", + (flag & 0x20) ? " ESS" : "", + (flag & 0x40) ? " 1TR6" : "" + ); } if (card->cardtype != avm_m1) { - flag = ((u8 *)(ctrl->profile.manu))[5]; + flag = ((u8 *)(ctrl->profile.manu))[5]; if (flag) seq_printf(m, "%-16s%s%s%s%s\n", - "linetype", - (flag & 0x01) ? " point to point" : "", - (flag & 0x02) ? " point to multipoint" : "", - (flag & 0x08) ? " leased line without D-channel" : "", - (flag & 0x04) ? " leased line with D-channel" : "" - ); + "linetype", + (flag & 0x01) ? " point to point" : "", + (flag & 0x02) ? " point to multipoint" : "", + (flag & 0x08) ? " leased line without D-channel" : "", + (flag & 0x04) ? " leased line with D-channel" : "" + ); } seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); @@ -1156,7 +1156,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, retval = -ENOMEM; goto err; } - card->dma = avmcard_dma_alloc("c4", dev, 2048+128, 2048+128); + card->dma = avmcard_dma_alloc("c4", dev, 2048 + 128, 2048 + 128); if (!card->dma) { printk(KERN_WARNING "c4: no memory.\n"); retval = -ENOMEM; @@ -1195,12 +1195,12 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, retval = request_irq(card->irq, c4_interrupt, IRQF_SHARED, card->name, card); if (retval) { - printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq); + printk(KERN_ERR "c4: unable to get IRQ %d.\n", card->irq); retval = -EBUSY; goto err_unmap; } - for (i=0; i < nr_controllers ; i++) { + for (i = 0; i < nr_controllers; i++) { cinfo = &card->ctrlinfo[i]; cinfo->capi_ctrl.owner = THIS_MODULE; cinfo->capi_ctrl.driver_name = "c4"; @@ -1233,17 +1233,17 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, pci_set_drvdata(dev, card); return 0; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_unmap: +err_unmap: iounmap(card->mbase); - err_release_region: +err_release_region: release_region(card->port, AVMB1_PORTLEN); - err_free_dma: +err_free_dma: avmcard_dma_free(card->dma); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -1265,10 +1265,10 @@ static int __devinit c4_probe(struct pci_dev *dev, param.port = pci_resource_start(dev, 1); param.irq = dev->irq; param.membase = pci_resource_start(dev, 0); - + printk(KERN_INFO "c4: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n", nr, param.port, param.irq, param.membase); - + retval = c4_add_card(¶m, dev, nr); if (retval != 0) { printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n", @@ -1280,10 +1280,10 @@ static int __devinit c4_probe(struct pci_dev *dev, } static struct pci_driver c4_pci_driver = { - .name = "c4", - .id_table = c4_pci_tbl, - .probe = c4_probe, - .remove = c4_remove, + .name = "c4", + .id_table = c4_pci_tbl, + .probe = c4_probe, + .remove = c4_remove, }; static struct capi_driver capi_driver_c2 = { @@ -1305,7 +1305,7 @@ static int __init c4_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 08216b14be13..72ef18853951 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c @@ -1,9 +1,9 @@ /* $Id: t1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $ - * + * * Module for AVM T1 HEMA-card. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -67,7 +67,7 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) int i; reverse_cardnr = ((cardnr & 0x01) << 3) | ((cardnr & 0x02) << 1) - | ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3); + | ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3); cregs[0] = (HEMA_VERSION_ID << 4) | (reverse_cardnr & 0xf); cregs[1] = 0x00; /* fast & slow link connected to CON1 */ cregs[2] = 0x05; /* fast link 20MBit, slow link 20 MBit */ @@ -86,50 +86,50 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) /* board reset */ t1outp(base, T1_RESETBOARD, 0xf); mdelay(100); - dummy = t1inp(base, T1_FASTLINK+T1_OUTSTAT); /* first read */ + dummy = t1inp(base, T1_FASTLINK + T1_OUTSTAT); /* first read */ /* write config */ dummy = (base >> 4) & 0xff; - for (i=1;i<=0xf;i++) t1outp(base, i, dummy); + for (i = 1; i <= 0xf; i++) t1outp(base, i, dummy); t1outp(base, HEMA_PAL_ID & 0xf, dummy); t1outp(base, HEMA_PAL_ID >> 4, cregs[0]); - for(i=1;i<7;i++) t1outp(base, 0, cregs[i]); + for (i = 1; i < 7; i++) t1outp(base, 0, cregs[i]); t1outp(base, ((base >> 4)) & 0x3, cregs[7]); /* restore_flags(flags); */ mdelay(100); - t1outp(base, T1_FASTLINK+T1_RESETLINK, 0); - t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0); + t1outp(base, T1_FASTLINK + T1_RESETLINK, 0); + t1outp(base, T1_SLOWLINK + T1_RESETLINK, 0); mdelay(10); - t1outp(base, T1_FASTLINK+T1_RESETLINK, 1); - t1outp(base, T1_SLOWLINK+T1_RESETLINK, 1); + t1outp(base, T1_FASTLINK + T1_RESETLINK, 1); + t1outp(base, T1_SLOWLINK + T1_RESETLINK, 1); mdelay(100); - t1outp(base, T1_FASTLINK+T1_RESETLINK, 0); - t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0); + t1outp(base, T1_FASTLINK + T1_RESETLINK, 0); + t1outp(base, T1_SLOWLINK + T1_RESETLINK, 0); mdelay(10); - t1outp(base, T1_FASTLINK+T1_ANALYSE, 0); + t1outp(base, T1_FASTLINK + T1_ANALYSE, 0); mdelay(5); - t1outp(base, T1_SLOWLINK+T1_ANALYSE, 0); + t1outp(base, T1_SLOWLINK + T1_ANALYSE, 0); - if (t1inp(base, T1_FASTLINK+T1_OUTSTAT) != 0x1) /* tx empty */ + if (t1inp(base, T1_FASTLINK + T1_OUTSTAT) != 0x1) /* tx empty */ return 1; - if (t1inp(base, T1_FASTLINK+T1_INSTAT) != 0x0) /* rx empty */ + if (t1inp(base, T1_FASTLINK + T1_INSTAT) != 0x0) /* rx empty */ return 2; - if (t1inp(base, T1_FASTLINK+T1_IRQENABLE) != 0x0) + if (t1inp(base, T1_FASTLINK + T1_IRQENABLE) != 0x0) return 3; - if ((t1inp(base, T1_FASTLINK+T1_FIFOSTAT) & 0xf0) != 0x70) + if ((t1inp(base, T1_FASTLINK + T1_FIFOSTAT) & 0xf0) != 0x70) return 4; - if ((t1inp(base, T1_FASTLINK+T1_IRQMASTER) & 0x0e) != 0) + if ((t1inp(base, T1_FASTLINK + T1_IRQMASTER) & 0x0e) != 0) return 5; - if ((t1inp(base, T1_FASTLINK+T1_IDENT) & 0x7d) != 1) + if ((t1inp(base, T1_FASTLINK + T1_IDENT) & 0x7d) != 1) return 6; - if (t1inp(base, T1_SLOWLINK+T1_OUTSTAT) != 0x1) /* tx empty */ + if (t1inp(base, T1_SLOWLINK + T1_OUTSTAT) != 0x1) /* tx empty */ return 7; - if ((t1inp(base, T1_SLOWLINK+T1_IRQMASTER) & 0x0e) != 0) + if ((t1inp(base, T1_SLOWLINK + T1_IRQMASTER) & 0x0e) != 0) return 8; - if ((t1inp(base, T1_SLOWLINK+T1_IDENT) & 0x7d) != 0) + if ((t1inp(base, T1_SLOWLINK + T1_IDENT) & 0x7d) != 0) return 9; - return 0; + return 0; } static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) @@ -163,13 +163,13 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) spin_unlock_irqrestore(&card->lock, flags); if (MsgLen < 30) { /* not CAPI 64Bit */ - memset(card->msgbuf+MsgLen, 0, 30-MsgLen); + memset(card->msgbuf + MsgLen, 0, 30 - MsgLen); MsgLen = 30; CAPIMSG_SETLEN(card->msgbuf, 30); } - if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) { + if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); @@ -184,7 +184,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { spin_unlock_irqrestore(&card->lock, flags); printk(KERN_ERR "%s: incoming packet dropped\n", - card->name); + card->name); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3) @@ -242,24 +242,24 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) MsgLen = t1_get_slice(card->port, card->msgbuf); spin_unlock_irqrestore(&card->lock, flags); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: task %d \"%s\" ready.\n", - card->name, ApplId, card->msgbuf); + card->name, ApplId, card->msgbuf); break; case RECEIVE_DEBUGMSG: MsgLen = t1_get_slice(card->port, card->msgbuf); spin_unlock_irqrestore(&card->lock, flags); card->msgbuf[MsgLen] = 0; - while ( MsgLen > 0 - && ( card->msgbuf[MsgLen-1] == '\n' - || card->msgbuf[MsgLen-1] == '\r')) { - card->msgbuf[MsgLen-1] = 0; + while (MsgLen > 0 + && (card->msgbuf[MsgLen - 1] == '\n' + || card->msgbuf[MsgLen - 1] == '\r')) { + card->msgbuf[MsgLen - 1] = 0; MsgLen--; } printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf); @@ -273,7 +273,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr) default: spin_unlock_irqrestore(&card->lock, flags); printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", - card->name, b1cmd); + card->name, b1cmd); return IRQ_NONE; } } @@ -296,7 +296,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = b1_load_t4file(card, &data->firmware))) { b1_reset(port); printk(KERN_ERR "%s: failed to load t4file!!\n", - card->name); + card->name); return retval; } @@ -304,7 +304,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) if ((retval = b1_load_config(card, &data->configuration))) { b1_reset(port); printk(KERN_ERR "%s: failed to load config!!\n", - card->name); + card->name); return retval; } } @@ -318,7 +318,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) b1_setinterrupt(port, card->irq, card->cardtype); b1_put_byte(port, SEND_INIT); b1_put_word(port, CAPI_MAXAPPL); - b1_put_word(port, AVM_NCCI_PER_CHANNEL*30); + b1_put_word(port, AVM_NCCI_PER_CHANNEL * 30); b1_put_word(port, ctrl->cnr - 1); spin_unlock_irqrestore(&card->lock, flags); @@ -347,7 +347,7 @@ static void t1isa_remove(struct pci_dev *pdev) { avmctrl_info *cinfo = pci_get_drvdata(pdev); avmcard *card; - + if (!cinfo) return; @@ -393,7 +393,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) printk(KERN_WARNING "t1isa: invalid port 0x%x.\n", card->port); retval = -EINVAL; goto err_free; - } + } if (hema_irq_table[card->irq & 0xf] == 0) { printk(KERN_WARNING "t1isa: irq %d not valid.\n", card->irq); retval = -EINVAL; @@ -412,7 +412,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) goto err_release_region; } - if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) { + if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) { printk(KERN_INFO "t1isa: NO card at 0x%x (%d)\n", card->port, retval); retval = -ENODEV; @@ -445,13 +445,13 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) pci_set_drvdata(pdev, cinfo); return 0; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_release_region: +err_release_region: release_region(card->port, AVMB1_PORTLEN); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -555,7 +555,7 @@ static int __init t1isa_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c index a79eb5afb92d..cb9a30427bd2 100644 --- a/drivers/isdn/hardware/avm/t1pci.c +++ b/drivers/isdn/hardware/avm/t1pci.c @@ -1,9 +1,9 @@ /* $Id: t1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $ - * + * * Module for AVM T1 PCI-card. - * + * * Copyright 1999 by Carsten Paeth <calle@calle.de> - * + * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * @@ -59,7 +59,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) goto err; } - card->dma = avmcard_dma_alloc("t1pci", pdev, 2048+128, 2048+128); + card->dma = avmcard_dma_alloc("t1pci", pdev, 2048 + 128, 2048 + 128); if (!card->dma) { printk(KERN_WARNING "t1pci: no memory.\n"); retval = -ENOMEM; @@ -136,17 +136,17 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) pci_set_drvdata(pdev, card); return 0; - err_free_irq: +err_free_irq: free_irq(card->irq, card); - err_unmap: +err_unmap: iounmap(card->mbase); - err_release_region: +err_release_region: release_region(card->port, AVMB1_PORTLEN); - err_free_dma: +err_free_dma: avmcard_dma_free(card->dma); - err_free: +err_free: b1_free_card(card); - err: +err: return retval; } @@ -157,7 +157,7 @@ static void t1pci_remove(struct pci_dev *pdev) avmcard *card = pci_get_drvdata(pdev); avmctrl_info *cinfo = card->ctrlinfo; - b1dma_reset(card); + b1dma_reset(card); detach_capi_ctr(&cinfo->capi_ctrl); free_irq(card->irq, card); @@ -217,10 +217,10 @@ static int __devinit t1pci_probe(struct pci_dev *dev, } static struct pci_driver t1pci_pci_driver = { - .name = "t1pci", - .id_table = t1pci_pci_tbl, - .probe = t1pci_probe, - .remove = t1pci_remove, + .name = "t1pci", + .id_table = t1pci_pci_tbl, + .probe = t1pci_probe, + .remove = t1pci_remove, }; static struct capi_driver capi_driver_t1pci = { @@ -237,7 +237,7 @@ static int __init t1pci_init(void) if ((p = strchr(revision, ':')) != NULL && p[1]) { strlcpy(rev, p + 2, 32); if ((p = strchr(rev, '$')) != NULL && p > rev) - *(p-1) = 0; + *(p - 1) = 0; } else strcpy(rev, "1.0"); |