[dahdi-commits] tzafrir: linux/trunk r10425 - /linux/trunk/drivers/dahdi/xpp/

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Jan 11 09:20:08 CST 2012


Author: tzafrir
Date: Wed Jan 11 09:20:05 2012
New Revision: 10425

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10425
Log:
xpp: style - insert space afer if/while/for/switch

* Applied via:
  perl -pi -e 's/\b(if|while|for|switch)\b\(/$1 (/g' "$@"

Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    linux/trunk/drivers/dahdi/xpp/card_bri.c
    linux/trunk/drivers/dahdi/xpp/card_fxo.c
    linux/trunk/drivers/dahdi/xpp/card_fxs.c
    linux/trunk/drivers/dahdi/xpp/card_global.c
    linux/trunk/drivers/dahdi/xpp/card_pri.c
    linux/trunk/drivers/dahdi/xpp/dahdi_debug.c
    linux/trunk/drivers/dahdi/xpp/dahdi_debug.h
    linux/trunk/drivers/dahdi/xpp/mmapdrv.c
    linux/trunk/drivers/dahdi/xpp/parport_debug.c
    linux/trunk/drivers/dahdi/xpp/xbus-core.c
    linux/trunk/drivers/dahdi/xpp/xbus-pcm.c
    linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
    linux/trunk/drivers/dahdi/xpp/xdefs.h
    linux/trunk/drivers/dahdi/xpp/xframe_queue.c
    linux/trunk/drivers/dahdi/xpp/xpd.h
    linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c
    linux/trunk/drivers/dahdi/xpp/xpp_usb.c
    linux/trunk/drivers/dahdi/xpp/xproto.c
    linux/trunk/drivers/dahdi/xpp/xproto.h

Modified: linux/trunk/drivers/dahdi/xpp/card_bri.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_bri.c?view=diff&rev=10425&r1=10424&r2=10425
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_bri.c Wed Jan 11 09:20:05 2012
@@ -84,7 +84,7 @@
 		_E(NT_DEACTIVTING),
 	};
 #undef	_E
-	if(is_nt) {
+	if (is_nt) {
 		if (state > ST_NT_DEACTIVTING)
 			p = "NT ???";
 		else
@@ -242,7 +242,7 @@
 	int	n = 0;
 
 	debug_buf[0] = '\0';
-	for(i = 0; i < len && n < DEBUG_BUF_SIZE; i++)
+	for (i = 0; i < len && n < DEBUG_BUF_SIZE; i++)
 		n += snprintf(&debug_buf[n], DEBUG_BUF_SIZE - n, "%02X ", buf[i]);
 	XPD_NOTICE(xpd, "%s[0..%zd]: %s%s\n", msg, len-1, debug_buf,
 			(n >= DEBUG_BUF_SIZE)?"...":"");
@@ -258,19 +258,19 @@
 
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(transmit) {
+	if (transmit) {
 		direction = "TX";
 		frame_begin = priv->txframe_begin;
 	} else {
 		direction = "RX";
 		frame_begin = 1;
 	}
-	if(frame_begin) {	/* Packet start */
-		if(!IS_SET(buf[0], 7))
+	if (frame_begin) {	/* Packet start */
+		if (!IS_SET(buf[0], 7))
 			ftype = 'I';	/* Information */
-		else if(IS_SET(buf[0], 7) && !IS_SET(buf[0], 6))
+		else if (IS_SET(buf[0], 7) && !IS_SET(buf[0], 6))
 			ftype = 'S';	/* Supervisory */
-		else if(IS_SET(buf[0], 7) && IS_SET(buf[0], 6))
+		else if (IS_SET(buf[0], 7) && IS_SET(buf[0], 6))
 			ftype = 'U';	/* Unnumbered */
 		else
 			XPD_NOTICE(xpd, "Unknown frame type 0x%X\n", buf[0]);
@@ -284,7 +284,7 @@
 
 static void set_bri_timer(xpd_t *xpd, const char *name, int *bri_timer, int value)
 {
-	if(value == HFC_TIMER_OFF)
+	if (value == HFC_TIMER_OFF)
 		XPD_DBG(SIGNAL, xpd, "Timer %s DISABLE\n", name);
 	else
 		XPD_DBG(SIGNAL, xpd, "Timer %s: set to %d\n", name, value);
@@ -298,9 +298,9 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(priv->dchan_alive == up)
+	if (priv->dchan_alive == up)
 		return;
-	if(up) {
+	if (up) {
 		XPD_DBG(SIGNAL, xpd, "STATE CHANGE: D-Channel RUNNING\n");
 		priv->dchan_alive = 1;
 	} else {
@@ -318,11 +318,11 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(priv->layer1_up == up)
+	if (priv->layer1_up == up)
 		return;
 	priv->layer1_up = up;
 	XPD_DBG(SIGNAL, xpd, "STATE CHANGE: Layer1 %s\n", (up)?"UP":"DOWN");
-	if(!up)
+	if (!up)
 		dchan_state(xpd, 0);
 }
 
@@ -336,8 +336,8 @@
 	BUG_ON(!priv);
 	curr_state = priv->state_register.bits.v_su_sta;
 	XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF");
-	if(on) {
-		if(curr_state == ST_TE_DEACTIVATED) {
+	if (on) {
+		if (curr_state == ST_TE_DEACTIVATED) {
 			XPD_DBG(SIGNAL, xpd, "HFC_L1_ACTIVATE_TE\n");
 			set_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
 			write_state_register(xpd, STA_ACTIVATE);
@@ -379,8 +379,8 @@
 	BUG_ON(!priv);
 	curr_state = priv->state_register.bits.v_su_sta;
 	XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF");
-	if(on) {
-		switch(curr_state) {
+	if (on) {
+		switch (curr_state) {
 			case ST_RESET:			/* F/G 0 */
 			case ST_NT_DEACTIVATED:		/* G1 */
 			case ST_NT_DEACTIVTING:		/* G4 */
@@ -397,7 +397,7 @@
 				break;
 		}
 	} else {
-		switch(curr_state) {
+		switch (curr_state) {
 			case ST_RESET:			/* F/G 0 */
 			case ST_NT_DEACTIVATED:		/* G1 */
 			case ST_NT_DEACTIVTING:		/* G4 */
@@ -428,16 +428,16 @@
 
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(len <= 0) {
+	if (len <= 0) {
 		XPD_NOTICE(xpd, "D-Chan RX DROP: short frame (len=%d)\n", len);
 		dahdi_hdlc_abort(dchan, DAHDI_EVENT_ABORT);
 		return -EPROTO;
 	}
 	status = buf[len-1];
-	if(status) {
+	if (status) {
 		int	event = DAHDI_EVENT_ABORT;
 
-		if(status == 0xFF) {
+		if (status == 0xFF) {
 			XPD_NOTICE(xpd, "D-Chan RX DROP: ABORT: %d\n", status);
 		} else {
 			XPD_NOTICE(xpd, "D-Chan RX DROP: BADFCS: %d\n", status);
@@ -462,31 +462,31 @@
 	src = REG_XDATA(regcmd);
 	len = regcmd->bytes;
 	eoframe = regcmd->eoframe;
-	if(len <= 0)
+	if (len <= 0)
 		return 0;
-	if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */
+	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? */
+	if (!IS_OFFHOOK(xpd, 2)) {	/* D-chan is used? */
 		static int rate_limit;
 
-		if((rate_limit++ % 1000) == 0)
+		if ((rate_limit++ % 1000) == 0)
 			XPD_DBG(SIGNAL, xpd, "D-Chan unused\n");
 		goto out;
 	}
 	XPD_DBG(GENERAL, xpd, "D-Chan RX: eoframe=%d len=%d\n", eoframe, len);
 	dahdi_hdlc_putbuf(dchan, src, (eoframe) ? len - 1 : len);
-	if(!eoframe)
+	if (!eoframe)
 		goto out;
-	if((ret = bri_check_stat(xpd, dchan, src, len)) < 0)
+	if ((ret = bri_check_stat(xpd, dchan, src, len)) < 0)
 		goto out;
 	/*
 	 * Tell Dahdi that we received len-1 bytes. They include the data and a 2-byte checksum.
 	 * The last byte (that we don't pass on) is 0 if the checksum is correct. If it were wrong,
-	 * we would drop the packet in the "if(src[len-1])" above.
+	 * we would drop the packet in the "if (src[len-1])" above.
 	 */
 	dahdi_hdlc_finish(dchan);
 	priv->dchan_rx_counter++;
@@ -645,7 +645,7 @@
 	priv = xpd->priv;
 	XPD_DBG(PROC, xpd, "\n");
 #ifdef	CONFIG_PROC_FS
-	if(priv->bri_info) {
+	if (priv->bri_info) {
 		XPD_DBG(PROC, xpd, "Removing '%s'\n", PROC_BRI_INFO_FNAME);
 		remove_proc_entry(PROC_BRI_INFO_FNAME, xpd->proc_xpd_dir);
 	}
@@ -662,7 +662,7 @@
 #ifdef	CONFIG_PROC_FS
 	XPD_DBG(PROC, xpd, "Creating '%s'\n", PROC_BRI_INFO_FNAME);
 	priv->bri_info = create_proc_read_entry(PROC_BRI_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_bri_info_read, xpd);
-	if(!priv->bri_info) {
+	if (!priv->bri_info) {
 		XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_BRI_INFO_FNAME);
 		bri_proc_remove(xbus, xpd);
 		return -EINVAL;
@@ -678,17 +678,17 @@
 	xpd_t		*xpd = NULL;
 	int		channels = min(3, CHANNELS_PERXPD);
 
-	if(subunit_ports != 1) {
+	if (subunit_ports != 1) {
 		XBUS_ERR(xbus, "Bad subunit_ports=%d\n", subunit_ports);
 		return NULL;
 	}
 	XBUS_DBG(GENERAL, xbus, "\n");
 	xpd = xpd_alloc(xbus, unit, subunit, subtype, subunits, sizeof(struct BRI_priv_data), proto_table, channels);
-	if(!xpd)
+	if (!xpd)
 		return NULL;
 	PHONEDEV(xpd).direction = (to_phone) ? TO_PHONE : TO_PSTN;
 	xpd->type_name = (to_phone) ? "BRI_NT" : "BRI_TE";
-	if(bri_proc_create(xbus, xpd) < 0)
+	if (bri_proc_create(xbus, xpd) < 0)
 		goto err;
 	return xpd;
 err:
@@ -753,7 +753,7 @@
 	priv = xpd->priv;
 	BUG_ON(!xbus);
 	XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off");
-	if(!on) {
+	if (!on) {
 		/* Nothing to do yet */
 		return 0;
 	}
@@ -770,7 +770,7 @@
 				xpd->addr.unit, xpd->addr.subunit, i);
 		cur_chan->chanpos = i + 1;
 		cur_chan->pvt = xpd;
-		if(i == 2) {	/* D-CHAN */
+		if (i == 2) {	/* D-CHAN */
 			cur_chan->sigcap = BRI_DCHAN_SIGCAP;
 			clear_bit(DAHDI_FLAGBIT_HDLC, &cur_chan->flags);
 			priv->txframe_begin = 1;
@@ -816,7 +816,7 @@
 	int			mod;
 
 	BUG_ON(!xpd);
-	if(IS_NT(xpd)) {
+	if (IS_NT(xpd)) {
 		which_led = RED_LED;
 		other_led = GREEN_LED;
 	} else {
@@ -826,10 +826,10 @@
 	priv = xpd->priv;
 	BUG_ON(!priv);
 	timer_count = xpd->timer_count;
-	if(xpd->blink_mode) {
-		if((timer_count % DEFAULT_LED_PERIOD) == 0) {
+	if (xpd->blink_mode) {
+		if ((timer_count % DEFAULT_LED_PERIOD) == 0) {
 			// led state is toggled
-			if(priv->ledstate[which_led] == BRI_LED_OFF) {
+			if (priv->ledstate[which_led] == BRI_LED_OFF) {
 				DO_LED(xpd, which_led, BRI_LED_ON);
 				DO_LED(xpd, other_led, BRI_LED_ON);
 			} else {
@@ -839,11 +839,11 @@
 		}
 		return;
 	}
-	if(priv->ledstate[other_led] != BRI_LED_OFF)
+	if (priv->ledstate[other_led] != BRI_LED_OFF)
 		DO_LED(xpd, other_led, BRI_LED_OFF);
-	if(priv->dchan_alive) {
+	if (priv->dchan_alive) {
 		mod = timer_count % 1000;
-		switch(mod) {
+		switch (mod) {
 			case 0:
 				DO_LED(xpd, which_led, BRI_LED_ON);
 				break;
@@ -851,9 +851,9 @@
 				DO_LED(xpd, which_led, BRI_LED_OFF);
 				break;
 		}
-	} else if(priv->layer1_up) {
+	} else if (priv->layer1_up) {
 		mod = timer_count % 1000;
-		switch(mod) {
+		switch (mod) {
 			case 0:
 			case 100:
 				DO_LED(xpd, which_led, BRI_LED_ON);
@@ -864,7 +864,7 @@
 				break;
 		}
 	} else {
-		if(priv->ledstate[which_led] != BRI_LED_ON)
+		if (priv->ledstate[which_led] != BRI_LED_ON)
 			DO_LED(xpd, which_led, BRI_LED_ON);
 	}
 }
@@ -876,12 +876,12 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(IS_NT(xpd)) {
+	if (IS_NT(xpd)) {
 		if (priv->t1 > HFC_TIMER_OFF) {
 			if (--priv->t1 == 0) {
 				set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_OFF);
-				if(!nt_keepalive) {
-					if(priv->state_register.bits.v_su_sta == ST_NT_ACTIVATING) {	/* G2 */
+				if (!nt_keepalive) {
+					if (priv->state_register.bits.v_su_sta == ST_NT_ACTIVATING) {	/* G2 */
 						XPD_DBG(SIGNAL, xpd, "T1 Expired. Deactivate NT\n");
 						clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
 						nt_activation(xpd, 0);	/* Deactivate NT */
@@ -915,9 +915,9 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(!priv->initialized || !xbus->self_ticking)
+	if (!priv->initialized || !xbus->self_ticking)
 		return 0;
-	if(poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) {
+	if (poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) {
 		// XPD_DBG(GENERAL, xpd, "%d\n", priv->tick_counter);
 		priv->poll_counter++;
 		xpp_register_request(xbus, xpd,
@@ -932,7 +932,7 @@
 				0		/* should_reply	*/
 				);
 
-		if(IS_NT(xpd) && nt_keepalive &&
+		if (IS_NT(xpd) && nt_keepalive &&
 			!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags) &&
 			!test_bit(HFC_L1_ACTIVATING, &priv->l1_flags)) {
 			XPD_DBG(SIGNAL, xpd, "Kick NT D-Channel\n");
@@ -943,18 +943,18 @@
 	priv->dchan_notx_ticks++;
 	priv->dchan_norx_ticks++;
 	priv->dchan_alive_ticks++;
-	if(priv->dchan_alive && (priv->dchan_notx_ticks > DCHAN_LOST || priv->dchan_norx_ticks > DCHAN_LOST)) {
+	if (priv->dchan_alive && (priv->dchan_notx_ticks > DCHAN_LOST || priv->dchan_norx_ticks > DCHAN_LOST)) {
 		/*
 		 * No tx_dchan() or rx_dchan() for many ticks
 		 * This D-Channel is probabelly dead.
 		 */
 		dchan_state(xpd, 0);
-	} else if(priv->dchan_rx_counter > 1 &&  priv->dchan_tx_counter > 1) {
-		if(!priv->dchan_alive)
+	} else if (priv->dchan_rx_counter > 1 &&  priv->dchan_tx_counter > 1) {
+		if (!priv->dchan_alive)
 			dchan_state(xpd, 1);
 	}
 	/* Detect Layer1 disconnect */
-	if(priv->reg30_good && priv->reg30_ticks > poll_interval * REG30_LOST) {
+	if (priv->reg30_good && priv->reg30_ticks > poll_interval * REG30_LOST) {
 		/* No reply for 1/2 a second */
 		XPD_ERR(xpd, "Lost state tracking for %d ticks\n", priv->reg30_ticks);
 		priv->reg30_good = 0;
@@ -971,7 +971,7 @@
 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))
+	if (!XBUS_IS(xpd->xbus, READY))
 		return -ENODEV;
 	switch (cmd) {
 		case DAHDI_TONEDETECT:
@@ -991,7 +991,7 @@
 static int BRI_card_open(xpd_t *xpd, lineno_t pos)
 {
 	BUG_ON(!xpd);
-	if(pos == 2) {
+	if (pos == 2) {
 		LINE_DBG(SIGNAL, xpd, pos, "OFFHOOK the whole span\n");
 		BIT_SET(PHONEDEV(xpd).offhook_state, 0);
 		BIT_SET(PHONEDEV(xpd).offhook_state, 1);
@@ -1004,7 +1004,7 @@
 static int BRI_card_close(xpd_t *xpd, lineno_t pos)
 {
 	/* Clear D-Channel pending data */
-	if(pos == 2) {
+	if (pos == 2) {
 		LINE_DBG(SIGNAL, xpd, pos, "ONHOOK the whole span\n");
 		BIT_CLR(PHONEDEV(xpd).offhook_state, 0);
 		BIT_CLR(PHONEDEV(xpd).offhook_state, 1);
@@ -1088,14 +1088,14 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(!XBUS_IS(xpd->xbus, READY)) {
+	if (!XBUS_IS(xpd->xbus, READY)) {
 		XPD_DBG(GENERAL, xpd, "Startup called by dahdi. No Hardware. Ignored\n");
 		return -ENODEV;
 	}
 	XPD_DBG(GENERAL, xpd, "STARTUP\n");
 	// Turn on all channels
 	CALL_PHONE_METHOD(card_state, xpd, 1);
-	if(SPAN_REGISTERED(xpd)) {
+	if (SPAN_REGISTERED(xpd)) {
 		dchan = XPD_CHAN(xpd, 2);
 		span->flags |= DAHDI_FLAG_RUNNING;
 		/*
@@ -1121,7 +1121,7 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(!XBUS_IS(xpd->xbus, READY)) {
+	if (!XBUS_IS(xpd->xbus, READY)) {
 		XPD_DBG(GENERAL, xpd, "Shutdown called by dahdi. No Hardware. Ignored\n");
 		return -ENODEV;
 	}
@@ -1143,7 +1143,7 @@
 
 	BUG_ON(!xpd);
 	main_xpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, 0);
-	if(!main_xpd) {
+	if (!main_xpd) {
 		XPD_DBG(DEVICES, xpd, "Unit 0 is already gone. Ignore request\n");
 		return;
 	}
@@ -1154,19 +1154,19 @@
 	spin_lock_irqsave(&PHONEDEV(main_xpd).lock_recompute_pcm, flags);
 	line_count = 0;
 	pcm_mask = 0;
-	for(i = 0; i < MAX_SUBUNIT; i++) {
+	for (i = 0; i < MAX_SUBUNIT; i++) {
 		xpd_t		*sub_xpd = xpd_byaddr(xpd->xbus, main_xpd->addr.unit, i);
 
-		if(sub_xpd) {
+		if (sub_xpd) {
 			xpp_line_t	lines =
 				PHONEDEV(sub_xpd).offhook_state & ~(PHONEDEV(sub_xpd).digital_signalling);
 
-			if(lines) {
+			if (lines) {
 				pcm_mask |= PCM_SHIFT(lines, i);
 				line_count += 2;
 			}
 			/* subunits have fake pcm_len and wanted_pcm_mask */
-			if(i > 0) {
+			if (i > 0) {
 				update_wanted_pcm_mask(sub_xpd, lines, 0);
 			}
 		}
@@ -1175,7 +1175,7 @@
 	 * FIXME: Workaround a bug in sync code of the Astribank.
 	 *        Send dummy PCM for sync.
 	 */
-	if(main_xpd->addr.unit == 0 && line_count == 0) {
+	if (main_xpd->addr.unit == 0 && line_count == 0) {
 		pcm_mask = BIT(0);
 		line_count = 1;
 	}
@@ -1202,23 +1202,23 @@
 	BUG_ON(!xpd);
 	BUG_ON(!pack);
 	pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm);
-	for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) {
+	for (subunit = 0; subunit < MAX_SUBUNIT; subunit++) {
 		xpd_t		*tmp_xpd;
 
 		tmp_xpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, subunit);
-		if(!tmp_xpd || !tmp_xpd->card_present)
+		if (!tmp_xpd || !tmp_xpd->card_present)
 			continue;
 		spin_lock_irqsave(&tmp_xpd->lock, flags);
 		wanted_lines = PHONEDEV(tmp_xpd).wanted_pcm_mask;
 		for_each_line(tmp_xpd, i) {
 			struct dahdi_chan	*chan = XPD_CHAN(tmp_xpd, i);
 
-			if(IS_SET(wanted_lines, i)) {
-				if(SPAN_REGISTERED(tmp_xpd)) {
+			if (IS_SET(wanted_lines, i)) {
+				if (SPAN_REGISTERED(tmp_xpd)) {
 #ifdef	DEBUG_PCMTX
 					int	channo = chan->channo;
 
-					if(pcmtx >= 0 && pcmtx_chan == channo)
+					if (pcmtx >= 0 && pcmtx_chan == channo)
 						memset((u_char *)pcm, pcmtx, DAHDI_CHUNKSIZE);
 					else
 #endif
@@ -1246,26 +1246,26 @@
 	/*
 	 * Subunit 0 handle all other subunits
 	 */
-	if(xpd->addr.subunit != 0)
+	if (xpd->addr.subunit != 0)
 		return;
-	if(!SPAN_REGISTERED(xpd))
+	if (!SPAN_REGISTERED(xpd))
 		return;
 	pcm = RPACKET_FIELD(pack, GLOBAL, PCM_READ, pcm);
 	pcm_mask = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines);
-	for(subunit = 0; subunit < MAX_SUBUNIT; subunit++, pcm_mask >>= SUBUNIT_PCM_SHIFT) {
+	for (subunit = 0; subunit < MAX_SUBUNIT; subunit++, pcm_mask >>= SUBUNIT_PCM_SHIFT) {
 		xpd_t		*tmp_xpd;
 
-		if(!pcm_mask)
+		if (!pcm_mask)
 			break;	/* optimize */
 		tmp_xpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, subunit);
-		if(!tmp_xpd || !tmp_xpd->card_present || !SPAN_REGISTERED(tmp_xpd))
+		if (!tmp_xpd || !tmp_xpd->card_present || !SPAN_REGISTERED(tmp_xpd))
 			continue;
 		spin_lock_irqsave(&tmp_xpd->lock, flags);
 		for (i = 0; i < 2; i++) {
 			xpp_line_t	tmp_mask = pcm_mask & (BIT(0) | BIT(1));
 			volatile u_char	*r;
 
-			if(IS_SET(tmp_mask, i)) {
+			if (IS_SET(tmp_mask, i)) {
 				r = XPD_CHAN(tmp_xpd, i)->readchunk;
 				// memset((u_char *)r, 0x5A, DAHDI_CHUNKSIZE);	// DEBUG
 				memcpy((u_char *)r, pcm, DAHDI_CHUNKSIZE);
@@ -1371,12 +1371,12 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(!priv->initialized) {
+	if (!priv->initialized) {
 		XPD_ERR(xpd, "%s called on uninitialized AB\n", __func__);
 		return;
 	}
 	new_state.reg = reg_x30;
-	if(new_state.bits.v_su_t2_exp) {
+	if (new_state.bits.v_su_t2_exp) {
 		XPD_NOTICE(xpd, "T2 Expired\n");
 	}
 	priv->reg30_ticks = 0;
@@ -1389,7 +1389,7 @@
 		new_state.bits.v_su_info0,
 		IS_NT(xpd)?"G":"F",
 		new_state.bits.v_su_sta);
-	if(!IS_NT(xpd)) {
+	if (!IS_NT(xpd)) {
 		switch (new_state.bits.v_su_sta) {
 			case ST_TE_DEACTIVATED:		/* F3 */
 				XPD_DBG(SIGNAL, xpd, "State ST_TE_DEACTIVATED (F3)\n");
@@ -1436,7 +1436,7 @@
 			case ST_NT_ACTIVATING:		/* G2 */
 				XPD_DBG(SIGNAL, xpd, "State ST_NT_ACTIVATING (G2)\n");
 				layer1_state(xpd, 0);
-				if(!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags))
+				if (!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags))
 					nt_activation(xpd, 1);
 				break;
 			case ST_NT_ACTIVATED:		/* G3 */
@@ -1473,17 +1473,17 @@
 	addr.unit = orig_xpd->addr.unit;
 	addr.subunit = info->portnum;
 	xpd = xpd_byaddr(xbus, addr.unit, addr.subunit);
-	if(!xpd) {
+	if (!xpd) {
 		static int	rate_limit;
 
-		if((rate_limit++ % 1003) < 5)
+		if ((rate_limit++ % 1003) < 5)
 			notify_bad_xpd(__func__, xbus, addr , orig_xpd->xpdname);
 		return -EPROTO;
 	}
 	spin_lock_irqsave(&xpd->lock, flags);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(REG_FIELD(info, do_subreg)) {
+	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));
 	} else {
@@ -1494,23 +1494,23 @@
 			XPD_DBG(REGS, xpd, "Got SU_RD_STA=%02X\n",
 					REG_FIELD(info, data_low));
 	}
-	if(info->is_multibyte) {
+	if (info->is_multibyte) {
 		XPD_DBG(REGS, xpd, "Got Multibyte: %d bytes, eoframe: %d\n",
 				info->bytes, info->eoframe);
 		ret = rx_dchan(xpd, info);
 		if (ret < 0) {
 			priv->dchan_rx_drops++;
-			if(atomic_read(&PHONEDEV(xpd).open_counter) > 0)
+			if (atomic_read(&PHONEDEV(xpd).open_counter) > 0)
 				XPD_NOTICE(xpd, "Multibyte Drop: errno=%d\n", ret);
 		}
 		goto end;
 	}
-	if(REG_FIELD(info, regnum) == A_SU_RD_STA) {
+	if (REG_FIELD(info, regnum) == A_SU_RD_STA) {
 		su_new_state(xpd, REG_FIELD(info, data_low));
 	}
 
 	/* Update /proc info only if reply relate to the last slic read request */
-	if(
+	if (
 			REG_FIELD(&xpd->requested_reply, regnum) == REG_FIELD(info, regnum) &&
 			REG_FIELD(&xpd->requested_reply, do_subreg) == REG_FIELD(info, do_subreg) &&
 			REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) {
@@ -1529,14 +1529,14 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF");
-	if(on) {
-		if(!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags)) {
-			if( ! IS_NT(xpd))
+	if (on) {
+		if (!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags)) {
+			if ( ! IS_NT(xpd))
 				te_activation(xpd, 1);
 			else
 				nt_activation(xpd, 1);
 		}
-	} else if(IS_NT(xpd))
+	} else if (IS_NT(xpd))
 		nt_activation(xpd, 0);
 	return 0;
 }
@@ -1602,13 +1602,13 @@
 	struct BRI_priv_data	*priv;
 
 	DBG(PROC, "\n");
-	if(!xpd)
+	if (!xpd)
 		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) {
+	if (priv->reg30_good) {
 		len += sprintf(page + len, "%-5s ", (priv->layer1_up) ? "UP" : "DOWN");
 		len += sprintf(page + len, "%c%d %-15s -- fr_sync=%d t2_exp=%d info0=%d g2_g3=%d\n",
 					IS_NT(xpd)?'G':'F',
@@ -1620,7 +1620,7 @@
 					priv->state_register.bits.v_g2_g3);
 	} else
 		len += sprintf(page + len, "Unknown\n");
-	if(IS_NT(xpd)) {
+	if (IS_NT(xpd)) {
 		len += sprintf(page + len, "T1 Timer: %d\n", priv->t1);
 	} else {
 		len += sprintf(page + len, "T3 Timer: %d\n", priv->t3);
@@ -1630,7 +1630,7 @@
 	len += sprintf(page + len, "reg30_good=%d\n", priv->reg30_good);
 	len += sprintf(page + len, "D-Channel: TX=[%5d]    RX=[%5d]    BAD=[%5d] ",
 			priv->dchan_tx_counter, priv->dchan_rx_counter, priv->dchan_rx_drops);
-	if(priv->dchan_alive) {
+	if (priv->dchan_alive) {
 		len += sprintf(page + len, "(alive %d K-ticks)\n",
 			priv->dchan_alive_ticks/1000);
 	} else {
@@ -1661,7 +1661,7 @@
 
 	xpd = dev_to_xpd(dev);
 	/* Is it our device? */
-	if(xpd->type != XPD_TYPE_BRI) {
+	if (xpd->type != XPD_TYPE_BRI) {
 		XPD_ERR(xpd, "drop suggestion for %s (%d)\n",
 			dev_name(dev), xpd->type);
 		return -EINVAL;
@@ -1695,7 +1695,7 @@
 {
 	int	ret;
 
-	if((ret = xpd_driver_register(&bri_driver.driver)) < 0)
+	if ((ret = xpd_driver_register(&bri_driver.driver)) < 0)
 		return ret;
 	INFO("revision %s\n", XPP_VERSION);
 	xproto_register(&PROTO_TABLE(BRI));

Modified: linux/trunk/drivers/dahdi/xpp/card_fxo.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxo.c?view=diff&rev=10425&r1=10424&r2=10425
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxo.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxo.c Wed Jan 11 09:20:05 2012
@@ -160,8 +160,8 @@
 #define	LED_COUNTER(priv,pos,color)	((priv)->led_counter[color][pos])
 #define	IS_BLINKING(priv,pos,color)	(LED_COUNTER(priv,pos,color) > 0)
 #define	MARK_BLINK(priv,pos,color,t)	((priv)->led_counter[color][pos] = (t))
-#define	MARK_OFF(priv,pos,color)	do { BIT_CLR((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0)
-#define	MARK_ON(priv,pos,color)		do { BIT_SET((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0)
+#define	MARK_OFF(priv,pos,color)	do { BIT_CLR((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while (0)
+#define	MARK_ON(priv,pos,color)		do { BIT_SET((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while (0)
 
 #define	LED_BLINK_RING			(1000/8)	/* in ticks */
 
@@ -169,7 +169,7 @@
 
 static const char *power2str(enum power_state pw)
 {
-	switch(pw) {
+	switch (pw) {
 		case POWER_UNKNOWN:	return "UNKNOWN";
 		case POWER_OFF:		return "OFF";
 		case POWER_ON:		return "ON";
@@ -213,12 +213,12 @@
 	xbus = xpd->xbus;
 	priv = xpd->priv;
 	which = which % NUM_LEDS;
-	if(IS_SET(PHONEDEV(xpd).digital_outputs, chan) || IS_SET(PHONEDEV(xpd).digital_inputs, chan))
+	if (IS_SET(PHONEDEV(xpd).digital_outputs, chan) || IS_SET(PHONEDEV(xpd).digital_inputs, chan))
 		goto out;
-	if(chan == PORT_BROADCAST) {
+	if (chan == PORT_BROADCAST) {
 		priv->ledstate[which] = (on) ? ~0 : 0;
 	} else {
-		if(on) {
+		if (on) {
 			BIT_SET(priv->ledstate[which], chan);
 		} else {
 			BIT_CLR(priv->ledstate[which], chan);
@@ -247,27 +247,27 @@
 	spin_lock_irqsave(&xpd->lock, flags);
 	priv = xpd->priv;
 	timer_count = xpd->timer_count;
-	for(color = 0; color < ARRAY_SIZE(colors); color++) {
+	for (color = 0; color < ARRAY_SIZE(colors); color++) {
 		for_each_line(xpd, i) {
-			if(IS_SET(PHONEDEV(xpd).digital_outputs, i) || IS_SET(PHONEDEV(xpd).digital_inputs, i))
+			if (IS_SET(PHONEDEV(xpd).digital_outputs, i) || IS_SET(PHONEDEV(xpd).digital_inputs, i))
 				continue;
-			if((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) {		// Blinking
+			if ((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) {		// Blinking
 				int	mod_value = LED_COUNTER(priv, i, color);
 
-				if(!mod_value)
+				if (!mod_value)
 					mod_value = DEFAULT_LED_PERIOD;		/* safety value */
 				// led state is toggled
-				if((timer_count % mod_value) == 0) {
+				if ((timer_count % mod_value) == 0) {
 					LINE_DBG(LEDS, xpd, i, "ledstate=%s\n", (IS_SET(priv->ledstate[color], i))?"ON":"OFF");
-					if(!IS_SET(priv->ledstate[color], i)) {
+					if (!IS_SET(priv->ledstate[color], i)) {
 						do_led(xpd, i, color, 1);
 					} else {
 						do_led(xpd, i, color, 0);
 					}
 				}
-			} else if(IS_SET(priv->ledcontrol[color], i) && !IS_SET(priv->ledstate[color], i)) {
+			} else if (IS_SET(priv->ledcontrol[color], i) && !IS_SET(priv->ledstate[color], i)) {
 				do_led(xpd, i, color, 1);
-			} else if(!IS_SET(priv->ledcontrol[color], i) && IS_SET(priv->ledstate[color], i)) {
+			} else if (!IS_SET(priv->ledcontrol[color], i) && IS_SET(priv->ledstate[color], i)) {
 				do_led(xpd, i, color, 0);
 			}
 		}
@@ -278,7 +278,7 @@
 static void update_dahdi_ring(xpd_t *xpd, int pos, bool on)
 {
 	BUG_ON(!xpd);
-	if(caller_id_style == CID_STYLE_BELL)
+	if (caller_id_style == CID_STYLE_BELL)
 		oht_pcm(xpd, pos, !on);
 	/*
 	 * We should not spinlock before calling dahdi_hooksig() as
@@ -300,20 +300,20 @@
 	 * due to voltage fluctuations.
 	 */
 	reset_battery_readings(xpd, pos);
-	if(on && !PHONEDEV(xpd).ringing[pos]) {
+	if (on && !PHONEDEV(xpd).ringing[pos]) {
 		LINE_DBG(SIGNAL, xpd, pos, "START\n");
 		PHONEDEV(xpd).ringing[pos] = 1;
 		priv->cidtimer[pos] = xpd->timer_count;
 		MARK_BLINK(priv, pos, LED_GREEN, LED_BLINK_RING);
-		if(update_dahdi)
+		if (update_dahdi)
 			update_dahdi_ring(xpd, pos, on);
-	} else if(!on && PHONEDEV(xpd).ringing[pos]) {
+	} else if (!on && PHONEDEV(xpd).ringing[pos]) {
 		LINE_DBG(SIGNAL, xpd, pos, "STOP\n");
 		PHONEDEV(xpd).ringing[pos] = 0;
 		priv->cidtimer[pos] = xpd->timer_count;
-		if(IS_BLINKING(priv, pos, LED_GREEN))
+		if (IS_BLINKING(priv, pos, LED_GREEN))
 			MARK_BLINK(priv, pos, LED_GREEN, 0);
-		if(update_dahdi)
+		if (update_dahdi)
 			update_dahdi_ring(xpd, pos, on);
 	}
 }
@@ -331,23 +331,23 @@
 	xbus = xpd->xbus;
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(priv->battery[pos] != BATTERY_ON && to_offhook) {
+	if (priv->battery[pos] != BATTERY_ON && to_offhook) {
 		LINE_NOTICE(xpd, pos, "Cannot take offhook while battery is off!\n");
 		return -EINVAL;
 	}
 	spin_lock_irqsave(&xpd->lock, flags);
 	mark_ring(xpd, pos, 0, 0);				// No more rings
 	value = REG_DAA_CONTROL1_ONHM;				/* Bit 3 is for CID */
-	if(to_offhook)
+	if (to_offhook)
 		value |= REG_DAA_CONTROL1_OH;
 	LINE_DBG(SIGNAL, xpd, pos, "SETHOOK: value=0x%02X %s\n", value, (to_offhook)?"OFFHOOK":"ONHOOK");
-	if(to_offhook)
+	if (to_offhook)
 		MARK_ON(priv, pos, LED_GREEN);
 	else
 		MARK_OFF(priv, pos, LED_GREEN);
 	ret = DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, REG_DAA_CONTROL1, value);
 	mark_offhook(xpd, pos, to_offhook);
-	if(caller_id_style != CID_STYLE_ETSI_DTMF)
+	if (caller_id_style != CID_STYLE_ETSI_DTMF)
 		oht_pcm(xpd, pos, 0);
 #ifdef	WITH_METERING
 	priv->metering_count[pos] = 0;
@@ -355,7 +355,7 @@
 	DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, DAA_REG_METERING, 0x2D);
 #endif
 	reset_battery_readings(xpd, pos);	/* unstable during hook changes */
-	if(to_offhook) {
+	if (to_offhook) {
 		priv->power_denial_safezone[pos] = power_denial_safezone;
 	} else {
 		priv->power_denial_length[pos] = 0;
@@ -377,14 +377,14 @@
 	XPD_DBG(PROC, xpd, "\n");
 #ifdef	CONFIG_PROC_FS
 #ifdef	WITH_METERING
-	if(priv->meteringfile) {
+	if (priv->meteringfile) {
 		XPD_DBG(PROC, xpd, "Removing xpd metering tone file\n");
 		priv->meteringfile->data = NULL;
 		remove_proc_entry(PROC_METERING_FNAME, xpd->proc_xpd_dir);
 		priv->meteringfile = NULL;
 	}
 #endif
-	if(priv->fxo_info) {
+	if (priv->fxo_info) {
 		XPD_DBG(PROC, xpd, "Removing xpd FXO_INFO file\n");
 		remove_proc_entry(PROC_FXO_INFO_FNAME, xpd->proc_xpd_dir);
 		priv->fxo_info = NULL;
@@ -401,7 +401,7 @@
 #ifdef	CONFIG_PROC_FS
 	XPD_DBG(PROC, xpd, "Creating FXO_INFO file\n");
 	priv->fxo_info = create_proc_read_entry(PROC_FXO_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_fxo_info_read, xpd);
-	if(!priv->fxo_info) {
+	if (!priv->fxo_info) {
 		XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXO_INFO_FNAME);
 		fxo_proc_remove(xbus, xpd);
 		return -EINVAL;
@@ -411,7 +411,7 @@
 	XPD_DBG(PROC, xpd, "Creating Metering tone file\n");
 	priv->meteringfile = create_proc_read_entry(PROC_METERING_FNAME, 0444, xpd->proc_xpd_dir,
 			proc_xpd_metering_read, xpd);
-	if(!priv->meteringfile) {
+	if (!priv->meteringfile) {
 		XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME);
 		fxo_proc_remove(xbus, xpd);
 		return -EINVAL;
@@ -428,22 +428,22 @@
 	xpd_t		*xpd = NULL;
 	int		channels;
 
-	if(to_phone) {
+	if (to_phone) {
 		XBUS_NOTICE(xbus,
 			"XPD=%d%d: try to instanciate FXO with reverse direction\n",
 			unit, subunit);
 		return NULL;
 	}
-	if(subtype == 2)
+	if (subtype == 2)
 		channels = min(2, subunit_ports);
 	else
 		channels = min(8, subunit_ports);
 	xpd = xpd_alloc(xbus, unit, subunit, subtype, subunits, sizeof(struct FXO_priv_data), proto_table, channels);
-	if(!xpd)
+	if (!xpd)
 		return NULL;
 	PHONEDEV(xpd).direction = TO_PSTN;
 	xpd->type_name = "FXO";
-	if(fxo_proc_create(xbus, xpd) < 0)
+	if (fxo_proc_create(xbus, xpd) < 0)
 		goto err;
 	return xpd;
 err:
@@ -465,7 +465,7 @@
 		priv->polarity_debounce[i] = 0;
 		priv->battery[i] = BATTERY_UNKNOWN;	/* will be updated on next battery sample */
 		priv->power[i] = POWER_UNKNOWN;	/* will be updated on next battery sample */
-		if(caller_id_style == CID_STYLE_ETSI_DTMF)
+		if (caller_id_style == CID_STYLE_ETSI_DTMF)
 			oht_pcm(xpd, i, 1);
 	}
 	XPD_DBG(GENERAL, xpd, "done\n");
@@ -560,7 +560,7 @@
 	LINE_DBG(SIGNAL, xpd, pos, "%s\n", txsig2str(txsig));
 	BUG_ON(PHONEDEV(xpd).direction != TO_PSTN);
 	/* XXX Enable hooksig for FXO XXX */
-	switch(txsig) {
+	switch (txsig) {
 		case DAHDI_TXSIG_START:
 		case DAHDI_TXSIG_OFFHOOK:
 			ret = do_sethook(xpd, pos, 1);
@@ -582,8 +582,8 @@
 
 	BUG_ON(!xpd);
 	priv = xpd->priv;
-	if(SPAN_REGISTERED(xpd)) {
-		switch(priv->battery[chan]) {
+	if (SPAN_REGISTERED(xpd)) {
+		switch (priv->battery[chan]) {
 			case BATTERY_UNKNOWN:
 				/* no-op */
 				break;
@@ -633,13 +633,13 @@
 
 	priv = xpd->priv;
 	for_each_line(xpd, i) {
-		if(atomic_read(&priv->ring_debounce[i]) > 0) {
+		if (atomic_read(&priv->ring_debounce[i]) > 0) {
 			/* Maybe start ring */
-			if(atomic_dec_and_test(&priv->ring_debounce[i]))
+			if (atomic_dec_and_test(&priv->ring_debounce[i]))
 				mark_ring(xpd, i, 1, 1);
 		} else if (atomic_read(&priv->ring_debounce[i]) < 0) {
 			/* Maybe stop ring */
-			if(atomic_inc_and_test(&priv->ring_debounce[i]))
+			if (atomic_inc_and_test(&priv->ring_debounce[i]))
 				mark_ring(xpd, i, 0, 1);
 		}
 	}
@@ -650,16 +650,16 @@
 	struct FXO_priv_data	*priv;
 	int			i;
 
-	if(!power_denial_safezone)
+	if (!power_denial_safezone)
 		return;		/* Ignore power denials */
 	priv = xpd->priv;
 	for_each_line(xpd, i) {
-		if(PHONEDEV(xpd).ringing[i] || !IS_OFFHOOK(xpd, i)) {
+		if (PHONEDEV(xpd).ringing[i] || !IS_OFFHOOK(xpd, i)) {
 			priv->power_denial_delay[i] = 0;
 			continue;
 		}
-		if(priv->power_denial_safezone[i] > 0) {
-			if(--priv->power_denial_safezone[i] == 0) {
+		if (priv->power_denial_safezone[i] > 0) {
+			if (--priv->power_denial_safezone[i] == 0) {
 				/*
 				 * Poll current, previous answers are meaningless
 				 */
@@ -667,9 +667,9 @@
 			}
 			continue;
 		}
-		if(priv->power_denial_length[i] > 0) {
+		if (priv->power_denial_length[i] > 0) {
 			priv->power_denial_length[i]--;
-			if(priv->power_denial_length[i] <= 0) {
+			if (priv->power_denial_length[i] <= 0) {
 				/*
 				 * But maybe the FXS started to ring (and the firmware haven't
 				 * detected it yet). This would cause false power denials.
@@ -712,17 +712,17 @@
 	int			portno;
 	unsigned int		timer_count;
 
-	if(!SPAN_REGISTERED(xpd))
+	if (!SPAN_REGISTERED(xpd))
 		return;
 	priv = xpd->priv;
 	BUG_ON(!priv);
 	timer_count = xpd->timer_count;
 	for_each_line(xpd, portno) {
 		/* Skip offhook and ringing ports */
-		if(IS_OFFHOOK(xpd, portno) || PHONEDEV(xpd).ringing[portno])
+		if (IS_OFFHOOK(xpd, portno) || PHONEDEV(xpd).ringing[portno])
 			continue;
-		if(IS_SET(priv->cidfound, portno)) {
-			if(timer_count > priv->cidtimer[portno] + 4000) {
+		if (IS_SET(priv->cidfound, portno)) {
+			if (timer_count > priv->cidtimer[portno] + 4000) {
 				/* reset flags if it's been a while */
 				priv->cidtimer[portno] = timer_count;
 				BIT_CLR(priv->cidfound, portno);
@@ -730,14 +730,14 @@
 			}
 			continue;
 		}
-		if(timer_count > priv->cidtimer[portno] + 400) {
+		if (timer_count > priv->cidtimer[portno] + 400) {
 			struct dahdi_chan	*chan = XPD_CHAN(xpd, portno);
 			int			sample;
 			int			i;
 
-			for(i = 0; i < DAHDI_CHUNKSIZE; i++) {
+			for (i = 0; i < DAHDI_CHUNKSIZE; i++) {
 				sample = DAHDI_XLAW(chan->readchunk[i], chan);
-				if(sample > 16000 || sample < -16000) {
+				if (sample > 16000 || sample < -16000) {
 					priv->cidtimer[portno] = timer_count;
 					BIT_SET(priv->cidfound, portno);
 					LINE_DBG(SIGNAL, xpd, portno, "Found DTMF CLIP (%d)\n", i);
@@ -756,16 +756,16 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	if(poll_battery_interval != 0 && (priv->poll_counter % poll_battery_interval) == 0)
+	if (poll_battery_interval != 0 && (priv->poll_counter % poll_battery_interval) == 0)
 		poll_battery(xbus, xpd);
 #ifdef	WITH_METERING
-	if(poll_metering_interval != 0 && (priv->poll_counter % poll_metering_interval) == 0)
+	if (poll_metering_interval != 0 && (priv->poll_counter % poll_metering_interval) == 0)
 		poll_metering(xbus, xpd);
 #endif
 	handle_fxo_leds(xpd);
 	handle_fxo_ring(xpd);
 	handle_fxo_power_denial(xpd);
-	if(caller_id_style == CID_STYLE_ETSI_DTMF && likely(xpd->card_present))
+	if (caller_id_style == CID_STYLE_ETSI_DTMF && likely(xpd->card_present))
 		check_etsi_dtmf(xpd);
 	priv->poll_counter++;
 	return 0;
@@ -785,7 +785,7 @@
 	unsigned char		echotune_data[ARRAY_SIZE(echotune_regs)];
 
 	BUG_ON(!xpd);
-	if(!XBUS_IS(xpd->xbus, READY))
+	if (!XBUS_IS(xpd->xbus, READY))
 		return -ENODEV;
 	switch (cmd) {
 		case WCTDM_SET_ECHOTUNE:
@@ -834,7 +834,7 @@
 	int		i;
 	struct FXO_priv_data	*priv;
 
-	if(!xpd) {
+	if (!xpd) {
 		notify_bad_xpd(__func__, xbus, XPACKET_ADDR(pack), cmd->name);
 		return -EPROTO;
 	}
@@ -845,8 +845,8 @@
 	for_each_line(xpd, i) {
 		int	debounce;
 
-		if(IS_SET(sig_toggles, i)) {
-			if(priv->battery[i] == BATTERY_OFF) {
+		if (IS_SET(sig_toggles, i)) {
+			if (priv->battery[i] == BATTERY_OFF) {
 				/*
 				 * With poll_battery_interval==0 we cannot have BATTERY_OFF
 				 * so we won't get here
@@ -856,7 +856,7 @@
 			}
 			/* First report false ring alarms */
 			debounce = atomic_read(&priv->ring_debounce[i]);
-			if(debounce)
+			if (debounce)
 				LINE_NOTICE(xpd, i, "debounced false ring (only %d ticks)\n", debounce);
 			/*
 			 * Now set a new ring alarm.
@@ -880,18 +880,18 @@
 	priv = xpd->priv;
 	BUG_ON(!priv);
 	priv->battery_voltage[portno] = volts;
-	if(PHONEDEV(xpd).ringing[portno])
+	if (PHONEDEV(xpd).ringing[portno])
 		goto ignore_reading;	/* ring voltage create false alarms */
-	if(abs(volts) < battery_threshold) {
+	if (abs(volts) < battery_threshold) {
 		/*
 		 * Check for battery voltage fluctuations
 		 */
-		if(priv->battery[portno] != BATTERY_OFF) {
+		if (priv->battery[portno] != BATTERY_OFF) {
 			int	milliseconds;
 
 			milliseconds = priv->nobattery_debounce[portno]++ *
 				poll_battery_interval;
-			if(milliseconds > battery_debounce) {
+			if (milliseconds > battery_debounce) {
 				LINE_DBG(SIGNAL, xpd, portno, "BATTERY OFF voltage=%d\n", volts);
 				priv->battery[portno] = BATTERY_OFF;
 				dahdi_report_battery(xpd, portno);
@@ -909,7 +909,7 @@
 		}
 	} else {
 		priv->nobattery_debounce[portno] = 0;
-		if(priv->battery[portno] != BATTERY_ON) {
+		if (priv->battery[portno] != BATTERY_ON) {
 			LINE_DBG(SIGNAL, xpd, portno, "BATTERY ON voltage=%d\n", volts);
 			priv->battery[portno] = BATTERY_ON;
 			dahdi_report_battery(xpd, portno);
@@ -919,25 +919,25 @@
 	/*
 	 * Mark FXO ports without battery!
 	 */
-	if(priv->battery[portno] != BATTERY_ON)
+	if (priv->battery[portno] != BATTERY_ON)
 		MARK_ON(priv, portno, LED_RED);
 	else
 		MARK_OFF(priv, portno, LED_RED);
 #endif
-	if(priv->battery[portno] != BATTERY_ON) {
+	if (priv->battery[portno] != BATTERY_ON) {
 		priv->polarity[portno] = POL_UNKNOWN;	/* What's the polarity ? */
 		return;
 	}
 	/*
 	 * Handle reverse polarity
 	 */
-	if(volts == 0)
+	if (volts == 0)
 		pol = POL_UNKNOWN;
-	else if(volts < 0)
+	else if (volts < 0)
 		pol = POL_NEGATIVE;
 	else
 		pol = POL_POSITIVE;
-	if(priv->polarity[portno] == pol) {
+	if (priv->polarity[portno] == pol) {
 		/*
 		 * Same polarity, reset debounce counter
 		 */
@@ -951,12 +951,12 @@
 	msec = priv->polarity_debounce[portno]++ * poll_battery_interval;
 	if (msec >= POLREV_THRESHOLD) {
 		priv->polarity_debounce[portno] = 0;
-		if(pol != POL_UNKNOWN && priv->polarity[portno] != POL_UNKNOWN) {
+		if (pol != POL_UNKNOWN && priv->polarity[portno] != POL_UNKNOWN) {
 			char	*polname = NULL;
 
-			if(pol == POL_POSITIVE)
+			if (pol == POL_POSITIVE)
 				polname = "Positive";
-			else if(pol == POL_NEGATIVE)
+			else if (pol == POL_NEGATIVE)
 				polname = "Negative";
 			else
 				BUG();
@@ -968,9 +968,9 @@
 			 * 2. In some countries used to report caller-id during onhook
 			 *    but before first ring.
 			 */
-			if(caller_id_style == CID_STYLE_ETSI_FSK)
+			if (caller_id_style == CID_STYLE_ETSI_FSK)
 				oht_pcm(xpd, portno, 1);	/* will be cleared on ring/offhook */
-			if(SPAN_REGISTERED(xpd)) {
+			if (SPAN_REGISTERED(xpd)) {
 				LINE_DBG(SIGNAL, xpd, portno,
 					"Send DAHDI_EVENT_POLARITY: %s\n", polname);
 				dahdi_qevent_lock(XPD_CHAN(xpd, portno), DAHDI_EVENT_POLARITY);
@@ -997,23 +997,23 @@
 	 * During ringing, current is not stable.
 	 * During onhook there should not be current anyway.
 	 */
-	if(PHONEDEV(xpd).ringing[portno] || !IS_OFFHOOK(xpd, portno))
+	if (PHONEDEV(xpd).ringing[portno] || !IS_OFFHOOK(xpd, portno))
 		goto ignore_it;
 	/*
 	 * Power denial with no battery voltage is meaningless
 	 */
-	if(priv->battery[portno] != BATTERY_ON)
+	if (priv->battery[portno] != BATTERY_ON)
 		goto ignore_it;
 	/* Safe zone after offhook */
-	if(priv->power_denial_safezone[portno] > 0)
+	if (priv->power_denial_safezone[portno] > 0)
 		goto ignore_it;
-	if(data_low < POWER_DENIAL_CURRENT) {
-		if(priv->power[portno] == POWER_ON) {
+	if (data_low < POWER_DENIAL_CURRENT) {
+		if (priv->power[portno] == POWER_ON) {
 			power_change(xpd, portno, POWER_OFF);
 			priv->power_denial_length[portno] = power_denial_minlen;
 		}
 	} else {
-		if(priv->power[portno] != POWER_ON) {
+		if (priv->power[portno] != POWER_ON) {
 			power_change(xpd, portno, POWER_ON);
 			priv->power_denial_length[portno] = 0;
 			/* We are now OFFHOOK */
@@ -1040,13 +1040,13 @@
 	LINE_DBG(SIGNAL, xpd, portno, "METERING: %s [dL=0x%X] (%d)\n",
 		(metering_tone) ? "ON" : "OFF",
 		data_low, priv->metering_count[portno]);
-	if(metering_tone && !old_metering_tone) {
+	if (metering_tone && !old_metering_tone) {
 		/* Rising edge */
 		priv->metering_count[portno]++;
 		BIT_SET(priv->metering_tone_state, portno);
-	} else if(!metering_tone && old_metering_tone)
+	} else if (!metering_tone && old_metering_tone)
 		BIT_CLR(priv->metering_tone_state, portno);
-	if(metering_tone) {
+	if (metering_tone) {
 		/* Clear the BTD bit */
 		data_low &= ~BTD_BIT;
 		DAA_DIRECT_REQUEST(xpd->xbus, xpd, portno, DAA_WRITE, DAA_REG_METERING, data_low);
@@ -1062,7 +1062,7 @@
 	priv = xpd->priv;
 	BUG_ON(!priv);
 	portno = info->portnum;
-	switch(REG_FIELD(info, regnum)) {
+	switch (REG_FIELD(info, regnum)) {
 		case DAA_REG_VBAT:
 			update_battery_voltage(xpd, REG_FIELD(info, data_low), portno);
 			break;
@@ -1081,7 +1081,7 @@

[... 5923 lines stripped ...]



More information about the dahdi-commits mailing list