Index: dahdi-linux-2.5.0/drivers/dahdi/xpp/card_bri.c =================================================================== --- dahdi-linux-2.5.0.orig/drivers/dahdi/xpp/card_bri.c 2011-08-15 14:42:29.000000000 +0300 +++ dahdi-linux-2.5.0/drivers/dahdi/xpp/card_bri.c 2011-08-15 14:51:37.000000000 +0300 @@ -274,7 +274,6 @@ int frame_begin; priv = xpd->priv; - BUG_ON(!priv); if(transmit) { direction = "TX"; frame_begin = priv->txframe_begin; @@ -312,9 +311,7 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); if(priv->dchan_alive == up) return; if(up) { @@ -332,9 +329,7 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); if(priv->layer1_up == up) return; priv->layer1_up = up; @@ -348,9 +343,7 @@ struct BRI_priv_data *priv; byte curr_state; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); curr_state = priv->state_register.bits.v_su_sta; XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF"); if(on) { @@ -391,9 +384,7 @@ struct BRI_priv_data *priv; byte curr_state; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); curr_state = priv->state_register.bits.v_su_sta; XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF"); if(on) { @@ -443,7 +434,6 @@ struct BRI_priv_data *priv; priv = xpd->priv; - BUG_ON(!priv); #ifdef CONFIG_DAHDI_BRI_DCHANS if(debug & DBG_COMMANDS) dump_hex_buf(xpd, "D-Chan(abort) RX: dchan_rbuf", @@ -460,7 +450,6 @@ byte status; priv = xpd->priv; - BUG_ON(!priv); #ifdef CONFIG_DAHDI_BRI_DCHANS if(priv->dchan_r_idx < 4) { XPD_NOTICE(xpd, "D-Chan RX short frame (dchan_r_idx=%d)\n", @@ -503,7 +492,6 @@ int idx; priv = xpd->priv; - BUG_ON(!priv); dchan_buf = dchan->readchunk; idx = priv->dchan_r_idx; if(idx + len >= DCHAN_BUFSIZE) { @@ -527,7 +515,6 @@ struct BRI_priv_data *priv; priv = xpd->priv; - BUG_ON(!priv); #ifdef CONFIG_DAHDI_BRI_DCHANS dchan->bytes2receive = priv->dchan_r_idx - 1; dchan->eofrx = 1; @@ -556,10 +543,7 @@ return 0; if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */ return 0; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); - xbus = xpd->xbus; dchan = XPD_CHAN(xpd, 2); if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */ static int rate_limit; @@ -629,9 +613,7 @@ return 0; if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */ return 0; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); dchan = XPD_CHAN(xpd, 2); if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */ static int rate_limit; @@ -677,7 +659,6 @@ struct BRI_priv_data *priv; priv = xpd->priv; - BUG_ON(!priv); dchan = XPD_CHAN(xpd, 2); if (dchan == chan) { atomic_inc(&priv->hdlc_pending); @@ -716,7 +697,6 @@ int ret; priv = xpd->priv; - BUG_ON(!priv); #ifndef CONFIG_DAHDI_BRI_DCHANS if(atomic_read(&priv->hdlc_pending) == 0) return 0; @@ -769,7 +749,6 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; XPD_DBG(PROC, xpd, "\n"); #ifdef CONFIG_PROC_FS @@ -784,7 +763,6 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; XPD_DBG(PROC, xpd, "\n"); #ifdef CONFIG_PROC_FS @@ -828,7 +806,6 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); XPD_DBG(GENERAL, xpd, "\n"); priv = xpd->priv; DO_LED(xpd, GREEN_LED, BRI_LED_OFF); @@ -841,7 +818,6 @@ static int BRI_card_remove(xbus_t *xbus, xpd_t *xpd) { - BUG_ON(!xpd); XPD_DBG(GENERAL, xpd, "\n"); bri_proc_remove(xbus, xpd); return 0; @@ -877,10 +853,8 @@ struct BRI_priv_data *priv; int i; - BUG_ON(!xpd); xbus = xpd->xbus; priv = xpd->priv; - BUG_ON(!xbus); XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); if(!on) { /* Nothing to do yet */ @@ -927,11 +901,6 @@ static int BRI_card_dahdi_postregistration(xpd_t *xpd, bool on) { - xbus_t *xbus; - - BUG_ON(!xpd); - xbus = xpd->xbus; - BUG_ON(!xbus); XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); return(0); } @@ -956,7 +925,6 @@ int other_led; int mod; - BUG_ON(!xpd); if(IS_NT(xpd)) { which_led = RED_LED; other_led = GREEN_LED; @@ -965,7 +933,6 @@ other_led = RED_LED; } priv = xpd->priv; - BUG_ON(!priv); timer_count = xpd->timer_count; if(xpd->blink_mode) { if((timer_count % DEFAULT_LED_PERIOD) == 0) { @@ -1014,9 +981,7 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); if(IS_NT(xpd)) { if (priv->t1 > HFC_TIMER_OFF) { if (--priv->t1 == 0) { @@ -1053,9 +1018,7 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); if(!priv->initialized || !xbus->self_ticking) return 0; if(poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) { @@ -1111,7 +1074,6 @@ static int BRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg) { - BUG_ON(!xpd); if(!XBUS_IS(xpd->xbus, READY)) return -ENODEV; switch (cmd) { @@ -1131,7 +1093,6 @@ static int BRI_card_open(xpd_t *xpd, lineno_t pos) { - BUG_ON(!xpd); if(pos == 2) { LINE_DBG(SIGNAL, xpd, pos, "OFFHOOK the whole span\n"); BIT_SET(PHONEDEV(xpd).offhook_state, 0); @@ -1230,12 +1191,8 @@ { struct phonedev *phonedev = container_of(span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); - struct BRI_priv_data *priv; struct dahdi_chan *dchan; - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); if(!XBUS_IS(xpd->xbus, READY)) { XPD_DBG(GENERAL, xpd, "Startup called by dahdi. No Hardware. Ignored\n"); return -ENODEV; @@ -1267,11 +1224,7 @@ { struct phonedev *phonedev = container_of(span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); - struct BRI_priv_data *priv; - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); if(!XBUS_IS(xpd->xbus, READY)) { XPD_DBG(GENERAL, xpd, "Shutdown called by dahdi. No Hardware. Ignored\n"); return -ENODEV; @@ -1292,7 +1245,6 @@ xpd_t *main_xpd; unsigned long flags; - BUG_ON(!xpd); main_xpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, 0); if(!main_xpd) { XPD_DBG(DEVICES, xpd, "Unit 0 is already gone. Ignore request\n"); @@ -1350,8 +1302,6 @@ xpp_line_t wanted_lines; - BUG_ON(!xpd); - BUG_ON(!pack); pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm); for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) { xpd_t *tmp_xpd; @@ -1435,12 +1385,8 @@ static int BRI_echocancel_setmask(xpd_t *xpd, xpp_line_t ec_mask) { - struct BRI_priv_data *priv; int i; - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); XPD_DBG(GENERAL, xpd, "0x%8X\n", ec_mask); if (!ECHOOPS(xpd->xbus)) { XPD_DBG(GENERAL, xpd, @@ -1466,9 +1412,7 @@ struct bri_leds *bri_leds; struct BRI_priv_data *priv; - BUG_ON(!xbus); priv = xpd->priv; - BUG_ON(!priv); XPD_DBG(LEDS, xpd, "%s -> %d\n", (which_led)?"RED":"GREEN", to_led_state); @@ -1507,9 +1451,7 @@ struct BRI_priv_data *priv; su_rd_sta_t new_state; - BUG_ON(!xpd); priv = xpd->priv; - BUG_ON(!priv); if(!priv->initialized) { XPD_ERR(xpd, "%s called on uninitialized AB\n", __FUNCTION__); return; @@ -1621,7 +1563,6 @@ } spin_lock_irqsave(&xpd->lock, flags); priv = xpd->priv; - BUG_ON(!priv); if(REG_FIELD(info, do_subreg)) { XPD_DBG(REGS, xpd, "RI %02X %02X %02X\n", REG_FIELD(info, regnum), REG_FIELD(info, subreg), REG_FIELD(info, data_low)); @@ -1665,7 +1606,6 @@ { struct BRI_priv_data *priv; - BUG_ON(!xpd); priv = xpd->priv; XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF"); if(on) { @@ -1745,7 +1685,6 @@ return -ENODEV; spin_lock_irqsave(&xpd->lock, flags); priv = xpd->priv; - BUG_ON(!priv); len += sprintf(page + len, "%05d Layer 1: ", priv->poll_counter); if(priv->reg30_good) { len += sprintf(page + len, "%-5s ", (priv->layer1_up) ? "UP" : "DOWN");