diff options
-rw-r--r-- | gpio/gpio.c | 22 | ||||
-rw-r--r-- | xhfc/xhfc.c | 56 | ||||
-rw-r--r-- | xhfc/xhfc_leb.h | 4 | ||||
-rw-r--r-- | xhfc/xhfc_tdm_iface.h | 2 | ||||
-rw-r--r-- | xivovp/base.c | 38 |
5 files changed, 61 insertions, 61 deletions
diff --git a/gpio/gpio.c b/gpio/gpio.c index a7e544d..d35e192 100644 --- a/gpio/gpio.c +++ b/gpio/gpio.c @@ -85,7 +85,7 @@ MODULE_VERSION("1.0.0"); struct drvr_data g_drvr_data; #ifdef GPIO_TEST -#define debug(code) if(code < 0) printk(#code " FAILE\n"); +#define debug(code) if (code < 0) printk(#code " FAILE\n"); void gpio_test(void) { debug(gpio_set_to_gpio(21)); @@ -197,7 +197,7 @@ int gpio_set_to_gpio_(int signal, int gpio) { u32 bitstr, io_addr; - if(signal >= MAX_GPIO_SIGNALS) + if (signal >= MAX_GPIO_SIGNALS) return -EINVAL; /* set register to use */ @@ -208,7 +208,7 @@ int gpio_set_to_gpio_(int signal, int gpio) /* get the register contents */ bitstr = inl(io_addr); - if(gpio) + if (gpio) /* set bit to use pin for gpio */ set_bit(signal%GPIO_REG_BITS, (void*)&bitstr); else @@ -227,7 +227,7 @@ int gpio_set_direction(int signal, int direction) { u32 bitstr, io_addr; - if(signal >= MAX_GPIO_SIGNALS) + if (signal >= MAX_GPIO_SIGNALS) return -EINVAL; /* set register to use */ @@ -255,7 +255,7 @@ int gpio_set_level(int signal, int high) { u32 bitstr, io_addr; - if(signal >= MAX_GPIO_SIGNALS) + if (signal >= MAX_GPIO_SIGNALS) return -EINVAL; signal < (MAX_GPIO_SIGNALS/LVL) ? @@ -265,7 +265,7 @@ int gpio_set_level(int signal, int high) /* get the register contents */ bitstr = inl(io_addr); - if(high) + if (high) /* write a 1 to output pin */ set_bit(signal%GPIO_REG_BITS, (void*)&bitstr); else @@ -285,7 +285,7 @@ int gpio_get_level(int signal) { u32 bitstr, io_addr; - if(signal >= MAX_GPIO_SIGNALS) + if (signal >= MAX_GPIO_SIGNALS) return -EINVAL; /* set register to use */ @@ -303,12 +303,12 @@ int gpio_set_blink(int signal, int blink) { u32 bitstr; - if(signal >= MAX_GPIO_SIGNALS) + if (signal >= MAX_GPIO_SIGNALS) return -EINVAL; bitstr = inl(g_drvr_data.regs.gpo_blink); - if(blink) + if (blink) /* set pin to blink mode */ set_bit(signal%GPIO_REG_BITS, (void*)&bitstr); else @@ -325,12 +325,12 @@ int gpio_inverted_input(int signal, int inverted) { u32 bitstr; - if(signal >= MAX_GPIO_SIGNALS) + if (signal >= MAX_GPIO_SIGNALS) return -EINVAL; bitstr = inl(g_drvr_data.regs.gpi_inv); - if(inverted) + if (inverted) /* set pin to inverted mode */ set_bit(signal%GPIO_REG_BITS, (void*)&bitstr); else diff --git a/xhfc/xhfc.c b/xhfc/xhfc.c index 702d75c..e2c142a 100644 --- a/xhfc/xhfc.c +++ b/xhfc/xhfc.c @@ -196,16 +196,16 @@ sprintf(buf, "%s(fifo %d): flen=%d, " \ #define DEFINE_GET_LEN(F_or_Z) \ static inline int \ -get_ ## F_or_Z ## len(struct xhfc* x) { \ +get_ ## F_or_Z ## len(struct xhfc* x) { \ u8 _1, _2; \ -int len; \ +int len; \ \ _1 = read_xhfc(x, A_ ## F_or_Z ## 1); \ _2 = read_xhfc(x, A_ ## F_or_Z ## 2); \ len = _1 - _2; \ \ -if(len < 0) \ - len += \ +if (len < 0) \ + len += \ (XHFC_ ## F_or_Z ## MAX - \ XHFC_ ## F_or_Z ## MIN) + 1; \ \ @@ -276,7 +276,7 @@ void xhfc_config_b_chan_on_fifo(struct xhfc *x, int fifo, int slot, int directio void xhfc_config_data_flow(struct xhfc* x) { int i; - for(i = 0; i < SPANS_PER_CHIP; i++) { + for (i = 0; i < SPANS_PER_CHIP; i++) { /* HFC chan, PCM slot, direction */ xhfc_config_b_chan_on_fifo(x, i * 4 + 0, i * 2 + 0, TRANSMIT); xhfc_config_b_chan_on_fifo(x, i * 4 + 0, i * 2 + 0, RECEIVE); @@ -353,11 +353,11 @@ static int hdlc_rx_frame(struct xhfc_span *xhfc_span) debug_fz(x, fifo, __func__, debugbuf); - if(!flen && !zlen) { - if(DBG_VERBOSE_HDLC && DBG_SPANFILTER) + if (!flen && !zlen) { + if (DBG_VERBOSE_HDLC && DBG_SPANFILTER) xhfc_info(x, "%s, nothing to receive (%ld).\n", debugbuf, xhfc_span->non_rx_cnt); xhfc_span->non_rx_cnt++; - if(DBG_HDLC && DBG_SPANFILTER && 0 == xhfc_span->non_rx_cnt % 2000) + if (DBG_HDLC && DBG_SPANFILTER && 0 == xhfc_span->non_rx_cnt % 2000) xhfc_info(x, "%s(fifo %d): Received nothing for %ld seconds.\n", __func__, fifo, xhfc_span->non_rx_cnt / 2000); return 0; @@ -420,7 +420,7 @@ static int hdlc_rx_frame(struct xhfc_span *xhfc_span) } while (zleft > 0); /* Frame received, increment F2 */ - if(flen) + if (flen) xhfc_inc_f(x); /* If this channel is not configured with a signalling span we don't @@ -592,12 +592,12 @@ irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs) struct xhfc_span* s = &xhfc->spans[i]; - if(s->running && s->sigchan) { - while(hdlc_rx_frame(s)) + if (s->running && s->sigchan) { + while (hdlc_rx_frame(s)) break; - if(atomic_read(&s->hdlc_pending)) - while(hdlc_tx_frame(s)) + if (atomic_read(&s->hdlc_pending)) + while (hdlc_tx_frame(s)) break; #if 0 // Why is this commented out? XXX dahdi_receive(&s->span); @@ -611,7 +611,7 @@ irqreturn_t xhfc_interrupt(int irq, void *dev_id, struct pt_regs* ptregs) r_su_irq = read_xhfc(xhfc, R_SU_IRQ); for (i = 0; i < ARRAY_SIZE(xhfc->spans); i++) - if(r_su_irq & (1 << i) || 2 == xhfc->ticks /* bootstrap XXX*/) + if (r_su_irq & (1 << i) || 2 == xhfc->ticks /* bootstrap XXX*/) hfc_handle_state(&xhfc->spans[i]); hfc_update_st_timers(xhfc); @@ -666,7 +666,7 @@ static void enable_interrupts(struct xhfc * xhfc) int xhfc_collect_chip_id(struct xhfc * xhfc) { u8 chip_id = read_xhfc(xhfc, R_CHIP_ID); - switch(chip_id) { + switch (chip_id) { case CHIP_ID_1SU: case CHIP_ID_2SU: case CHIP_ID_2S4U: @@ -717,7 +717,7 @@ void xhfc_init_and_configure(struct xhfc* x) /* "stage 2" */ xhfc_config_pcm(x, XHFC_PCM_MASTER); - for(i = 0; i < SPANS_PER_CHIP; i++) + for (i = 0; i < SPANS_PER_CHIP; i++) xhfc_config_st(x, x->spans[i].port, x->spans[i].nt); /* No we need to setup the flow controller and stuff */ @@ -729,7 +729,7 @@ int xhfc_span_startup(struct dahdi_span* span) { struct xhfc_span *xhfc_span = container_of(span, struct xhfc_span, span); struct xhfc *x = xhfc_span->xhfc; - if(!x->running) + if (!x->running) enable_interrupts(x); xhfc_span->running = 1; @@ -850,7 +850,7 @@ int xhfc_chanconfig(struct dahdi_chan *chan, int sigtype) static int xhfc_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data) { - switch(cmd) { + switch (cmd) { default: return -ENOTTY; } @@ -1032,7 +1032,7 @@ int __devinit xhfc_init_one(struct pci_dev *pdev, xhfc_hard_reset(); - if(exit_after_reset) { + if (exit_after_reset) { rc = -EINVAL; goto exit_after_reset; } @@ -1055,7 +1055,7 @@ int __devinit xhfc_init_one(struct pci_dev *pdev, IRQ_TLP_GPIO_30, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); - if(rc < 0) + if (rc < 0) goto err_acpi_register; pi->xhfc.r_pcm_md0 = 0; @@ -1087,8 +1087,8 @@ int __devinit xhfc_init_one(struct pci_dev *pdev, xhfc_init_and_configure(&pi->xhfc); - for(span = 0; span < SPANS_PER_CHIP; span++) - if(dahdi_register(&pi->xhfc.spans[span].span, /*prefmaster*/ 0)) { + for (span = 0; span < SPANS_PER_CHIP; span++) + if (dahdi_register(&pi->xhfc.spans[span].span, /*prefmaster*/ 0)) { printk(KERN_WARNING "%s %s: couldn't register spans.\n", pi->name, __FUNCTION__); rc = -EINVAL; goto err_dahdi_register; @@ -1099,7 +1099,7 @@ int __devinit xhfc_init_one(struct pci_dev *pdev, return 0; err_dahdi_register: - for(; span >= 0; span--) + for (; span >= 0; span--) dahdi_unregister(&pi->xhfc.spans[span].span); err_request_irq: err_collect_chip_id: @@ -1126,11 +1126,11 @@ void __devexit xhfc_remove_one(struct pci_dev *pdev) pi = pci_get_drvdata(pdev); - if(DBG) + if (DBG) printk(KERN_INFO "%s %s: removing card\n", pi->name, __FUNCTION__); - for(i = 0; i < SPANS_PER_CHIP; i++) + for (i = 0; i < SPANS_PER_CHIP; i++) dahdi_unregister(&pi->xhfc.spans[i].span); release_card_irq(pi); @@ -1152,7 +1152,7 @@ void __devexit xhfc_remove_one(struct pci_dev *pdev) void xhfc_shutdown(struct pci_dev *pdev) { - if(DBG) + if (DBG) printk(KERN_DEBUG "%s: Au revoir.\n", __FUNCTION__); } @@ -1163,7 +1163,7 @@ static int __init xhfc_init(void) { int err; - if(DBG) + if (DBG) printk(KERN_INFO DRIVER_NAME " driver Rev. %s \n", xhfc_rev); @@ -1182,7 +1182,7 @@ static int __init xhfc_init(void) static void __exit xhfc_cleanup(void) { pci_unregister_driver(&xhfc_driver); - if(DBG) + if (DBG) printk(KERN_INFO "%s: driver removed\n", __FUNCTION__); } diff --git a/xhfc/xhfc_leb.h b/xhfc/xhfc_leb.h index 08bd0ed..0c1bfb8 100644 --- a/xhfc/xhfc_leb.h +++ b/xhfc/xhfc_leb.h @@ -55,12 +55,12 @@ static inline void write_xhfc(struct xhfc * xhfc, u8 reg_addr, u8 value) #ifdef DEBUG #define read_xhfc(x, reg) ({ \ u8 _res = read_xhfc(x, reg); \ - if(DBG_REGS) printk(KERN_INFO #reg " -> %02x\n", _res); \ + if (DBG_REGS) printk(KERN_INFO #reg " -> %02x\n", _res);\ _res; \ }) #define write_xhfc(x, reg, val) ({ \ - if(DBG_REGS) printk(KERN_INFO #reg " <- %02x\n", val); \ + if (DBG_REGS) printk(KERN_INFO #reg " <- %02x\n", val); \ write_xhfc(x, reg, val); \ }) #endif diff --git a/xhfc/xhfc_tdm_iface.h b/xhfc/xhfc_tdm_iface.h index 50cc0dc..9314d14 100644 --- a/xhfc/xhfc_tdm_iface.h +++ b/xhfc/xhfc_tdm_iface.h @@ -26,7 +26,7 @@ void xhfc_rxtx(void); /* * And I guess its code would be something like * - for(i = 0; i < NB_PORT; i++) { + for (i = 0; i < NB_PORT; i++) { dahdi_ec_span(spans[i]); dahdi_write(spans[i]); dahdi_read(spans[i]); diff --git a/xivovp/base.c b/xivovp/base.c index b600f87..f767593 100644 --- a/xivovp/base.c +++ b/xivovp/base.c @@ -89,13 +89,13 @@ static struct xivovp_line* xivovp_line_from_ctx(VpLineCtxType* line_ctx) Vp890LineObjectType* line_obj; int i; - if(!line_ctx) + if (!line_ctx) panic(DRV_NAME ": LineCtx == NULL\n"); line_obj = line_ctx->pLineObj; - for(i = 0; i < ARRAY_SIZE(xivovp.line); i++) - if(&xivovp.line[i].line_obj == line_obj) + for (i = 0; i < ARRAY_SIZE(xivovp.line); i++) + if (&xivovp.line[i].line_obj == line_obj) return &xivovp.line[i]; panic(DRV_NAME ": unknown FX line, this shouldn't happen\n"); @@ -107,7 +107,7 @@ static void vp_set_debug_select_running(void) int i; uint32 debug_select; - for(i = 0; i < ARRAY_SIZE(xivovp.line); i++) { + for (i = 0; i < ARRAY_SIZE(xivovp.line); i++) { debug_select = DEBUG_SELECT_RUNNING; VpSetOption(&xivovp.line[i].vp_ctx, NULL, VP_OPTION_ID_DEBUG_SELECT, @@ -127,7 +127,7 @@ static int xivovp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig) struct xivovp_line* line = chan->pvt; unsigned long flags; - if(line->txsig_queue_len >= ARRAY_SIZE(line->txsig_queue)) { + if (line->txsig_queue_len >= ARRAY_SIZE(line->txsig_queue)) { printk(KERN_WARNING DRV_NAME "(chan %d): txsig overrun", chan->chanpos); return -1; } @@ -146,8 +146,8 @@ static int xivovp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig) static void xivovp_hooksig_pvt(struct xivovp_line* line, enum dahdi_txsig txsig) { int chanpos = line->chan.chanpos; - if(line->type == FXO_LINE) { - switch(txsig) { + if (line->type == FXO_LINE) { + switch (txsig) { case DAHDI_TXSIG_START: case DAHDI_TXSIG_OFFHOOK: printk(KERN_WARNING DRV_NAME "(chan %d): transmitting %s state on FXO, setting to TALK.\n", chanpos, txsig == DAHDI_TXSIG_START ? "START" : "OFFHOOK"); @@ -161,7 +161,7 @@ static void xivovp_hooksig_pvt(struct xivovp_line* line, enum dahdi_txsig txsig) printk(KERN_WARNING DRV_NAME "(chan %d): unsupported tx state for FXO: %d\n", chanpos, txsig); } } else /* FXS */ { - switch(txsig) { + switch (txsig) { case DAHDI_TXSIG_START: printk(KERN_WARNING DRV_NAME "(chan %d): transmitting START on FXS, setting to RINGING.\n", chanpos); VpSetLineState(&line->vp_ctx, VP_LINE_RINGING); @@ -191,18 +191,18 @@ static void xivovp_handle_txsig_queue(void) enum dahdi_txsig txsig_queue[TXQUEUE_LEN]; unsigned long flags; - for(i = 0; i < ARRAY_SIZE(xivovp.line); i++) { - if(xivovp.line[i].ready) { + for (i = 0; i < ARRAY_SIZE(xivovp.line); i++) { + if (xivovp.line[i].ready) { spin_lock_irqsave(&xivovp.line[i].lock, flags); - for(j = 0; j < xivovp.line[i].txsig_queue_len; j++) + for (j = 0; j < xivovp.line[i].txsig_queue_len; j++) txsig_queue[j] = xivovp.line[i].txsig_queue[j]; xivovp.line[i].txsig_queue_len = 0; spin_unlock_irqrestore(&xivovp.line[i].lock, flags); - for(k = 0; k < j; k++) + for (k = 0; k < j; k++) xivovp_hooksig_pvt(&xivovp.line[i], txsig_queue[k]); - } else if(!said) { + } else if (!said) { said = 1; printk(KERN_WARNING DRV_NAME ": txsig pending but calibration not done yet! Waiting...\n"); } @@ -405,10 +405,10 @@ span_init(void) init_waitqueue_head(&xivovp.span.maintq); /* still dunno what this is */ - for(l = xivovp.line; l < xivovp.line + NB_LINES; l++) { + for (l = xivovp.line; l < xivovp.line + NB_LINES; l++) { xivovp.chans[l - xivovp.line] = &l->chan; l->chan.pvt = l; - if(l->type == FXO_LINE) + if (l->type == FXO_LINE) /* /!\ FXO uses FXS sig and vice-versa */ l->chan.sigcap = DAHDI_SIG_FXSLS | DAHDI_SIG_FXSGS | DAHDI_SIG_FXSKS; @@ -418,7 +418,7 @@ span_init(void) spin_lock_init(&l->lock); } - if(dahdi_register(&xivovp.span, /*prefmaster*/ 0)) { + if (dahdi_register(&xivovp.span, /*prefmaster*/ 0)) { printk(KERN_WARNING DRV_NAME ": couldn't register span.\n"); return -EINVAL; } @@ -526,16 +526,16 @@ test_evb_ve890_init(void) } rc = xivovp_init(); - if(rc < 0) + if (rc < 0) goto err_xivovp_init; rc = vp_init(); - if(rc < 0) + if (rc < 0) goto err_vp_init; rc = span_init(); - if(rc < 0) { + if (rc < 0) { printk(KERN_ERR DRV_NAME ": ve890_dahdi_init failed\n"); goto err_dahdi_init; } |