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

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Jan 11 13:56:40 CST 2012


Author: tzafrir
Date: Wed Jan 11 13:56:35 2012
New Revision: 10430

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10430
Log:
xpp: style - clean many long lines (manually)

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_echo.c
    linux/trunk/drivers/dahdi/xpp/card_fxo.c
    linux/trunk/drivers/dahdi/xpp/card_fxo.h
    linux/trunk/drivers/dahdi/xpp/card_fxs.c
    linux/trunk/drivers/dahdi/xpp/card_fxs.h
    linux/trunk/drivers/dahdi/xpp/card_global.c
    linux/trunk/drivers/dahdi/xpp/card_pri.c
    linux/trunk/drivers/dahdi/xpp/dahdi_debug.h
    linux/trunk/drivers/dahdi/xpp/mmapdrv.c
    linux/trunk/drivers/dahdi/xpp/print_fxo_modes.c
    linux/trunk/drivers/dahdi/xpp/xbus-core.c
    linux/trunk/drivers/dahdi/xpp/xbus-core.h
    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=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_bri.c Wed Jan 11 13:56:35 2012
@@ -39,7 +39,8 @@
 #error Cannot build BRI without HARDHDLC supprt
 #endif
 
-static DEF_PARM(int, debug, 0, 0644, "Print DBG statements");	/* must be before dahdi_debug.h */
+/* must be before dahdi_debug.h */
+static DEF_PARM(int, debug, 0, 0644, "Print DBG statements");
 static DEF_PARM(uint, poll_interval, 500, 0644,
 		"Poll channel state interval in milliseconds (0 - disable)");
 static DEF_PARM_BOOL(nt_keepalive, 1, 0644,
@@ -113,7 +114,7 @@
 #define	HFC_TIMER_T3		8000	/* 8s activation timer T3 */
 #define	HFC_TIMER_OFF		-1	/* timer disabled */
 
-#define	A_SU_WR_STA		0x30	/* ST/Up state machine register         */
+#define	A_SU_WR_STA		0x30	/* ST/Up state machine register */
 #define		V_SU_LD_STA	0x10
 #define	V_SU_ACT	0x60	/* start activation/deactivation        */
 #define	STA_DEACTIVATE	0x40	/* start deactivation in A_SU_WR_STA */
@@ -232,8 +233,8 @@
 static /* 0x33 */ DECLARE_CMD(BRI, SET_LED, enum bri_led_names which_led,
 			      enum led_state to_led_state);
 
-#define	DO_LED(xpd, which, tostate)	\
-			CALL_PROTO(BRI, SET_LED, (xpd)->xbus, (xpd), (which), (tostate))
+#define	DO_LED(xpd, which, tostate) \
+		CALL_PROTO(BRI, SET_LED, (xpd)->xbus, (xpd), (which), (tostate))
 
 #define DEBUG_BUF_SIZE (100)
 static void dump_hex_buf(xpd_t *xpd, char *msg, __u8 *buf, size_t len)
@@ -358,7 +359,8 @@
 		case ST_TE_SYNCED:	/* F6   */
 		case ST_TE_ACTIVATED:	/* F7   */
 			XPD_DBG(SIGNAL, xpd,
-				"HFC_L1_FORCE_DEACTIVATE_TE (state %d, ignored)\n",
+				"HFC_L1_FORCE_DEACTIVATE_TE "
+				"(state %d, ignored)\n",
 				curr_state);
 			break;
 		case ST_TE_SIGWAIT:	/* F4   */
@@ -489,9 +491,11 @@
 	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.
+	 * 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.
 	 */
 	dahdi_hdlc_finish(dchan);
 	priv->dchan_rx_counter++;
@@ -503,7 +507,10 @@
 /*
  * D-Chan transmit
  */
-/* DAHDI calls this when it has data it wants to send to the HDLC controller */
+/*
+ * DAHDI calls this when it has data it wants to send to
+ * the HDLC controller
+ */
 static void bri_hdlc_hard_xmit(struct dahdi_chan *chan)
 {
 	xpd_t *xpd = chan->pvt;
@@ -551,8 +558,8 @@
 /*
  * Fill a single multibyte REGISTER_REQUEST
  */
-static void fill_multibyte(xpd_t *xpd, xpacket_t *pack, bool eoframe, char *buf,
-			   int len)
+static void fill_multibyte(xpd_t *xpd, xpacket_t *pack,
+	bool eoframe, char *buf, int len)
 {
 	reg_cmd_t *reg_cmd;
 	char *p;
@@ -628,8 +635,8 @@
 			 */
 			if (printk_ratelimit())
 				XPD_ERR(xpd,
-					"%s: hdlc_pending, but nothing to transmit?\n",
-					__func__);
+					"%s: hdlc_pending, but nothing "
+					"to transmit?\n", __func__);
 			FREE_SEND_XFRAME(xpd->xbus, xframe);
 			return -EINVAL;
 		}
@@ -893,15 +900,19 @@
 				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 */
+					/* G2 */
+					if (priv->state_register.bits.v_su_sta == ST_NT_ACTIVATING) {
 						XPD_DBG(SIGNAL, xpd,
-							"T1 Expired. Deactivate NT\n");
+							"T1 Expired. "
+							"Deactivate NT\n");
 						clear_bit(HFC_L1_ACTIVATING,
 							  &priv->l1_flags);
-						nt_activation(xpd, 0);	/* Deactivate NT */
+						/* Deactivate NT */
+						nt_activation(xpd, 0);
 					} else
 						XPD_DBG(SIGNAL, xpd,
-							"T1 Expired. (state %d, ignored)\n",
+							"T1 Expired. "
+							"(state %d, ignored)\n",
 							priv->state_register.
 							bits.v_su_sta);
 				}
@@ -937,15 +948,16 @@
 	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, BRI_PORT(xpd),	/* portno       */
-				     0,	/* writing      */
-				     A_SU_RD_STA,	/* regnum       */
-				     0,	/* do_subreg    */
-				     0,	/* subreg       */
-				     0,	/* data_low     */
-				     0,	/* do_datah     */
-				     0,	/* data_high    */
-				     0	/* should_reply */
+		xpp_register_request(xbus, xpd,
+			BRI_PORT(xpd),	/* portno       */
+			0,		/* writing      */
+			A_SU_RD_STA,	/* regnum       */
+			0,		/* do_subreg    */
+			0,		/* subreg       */
+			0,		/* data_low     */
+			0,		/* do_datah     */
+			0,		/* data_high    */
+			0		/* should_reply */
 		    );
 
 		if (IS_NT(xpd) && nt_keepalive
@@ -1293,7 +1305,10 @@
 
 			if (IS_SET(tmp_mask, i)) {
 				r = XPD_CHAN(tmp_xpd, i)->readchunk;
-				// memset((u_char *)r, 0x5A, DAHDI_CHUNKSIZE);  // DEBUG
+#if 0
+				/* DEBUG */
+				memset((u_char *)r, 0x5A, DAHDI_CHUNKSIZE);
+#endif
 				memcpy((u_char *)r, pcm, DAHDI_CHUNKSIZE);
 				pcm += DAHDI_CHUNKSIZE;
 			}
@@ -1374,15 +1389,16 @@
 	int ret;
 
 	XPD_DBG(REGS, xpd, "value = 0x%02X\n", value);
-	ret = xpp_register_request(xpd->xbus, xpd, BRI_PORT(xpd),	/* portno       */
-				   1,	/* writing      */
-				   A_SU_WR_STA,	/* regnum       */
-				   0,	/* do_subreg    */
-				   0,	/* subreg       */
-				   value,	/* data_low     */
-				   0,	/* do_datah     */
-				   0,	/* data_high    */
-				   0	/* should_reply */
+	ret = xpp_register_request(xpd->xbus, xpd,
+		BRI_PORT(xpd),	/* portno       */
+		1,		/* writing      */
+		A_SU_WR_STA,	/* regnum       */
+		0,		/* do_subreg    */
+		0,		/* subreg       */
+		value,		/* data_low     */
+		0,		/* do_datah     */
+		0,		/* data_high    */
+		0		/* should_reply */
 	    );
 	return ret;
 }
@@ -1537,11 +1553,12 @@
 	}
 
 	/* Update /proc info only if reply relate to the last slic read request */
-	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)) {
+	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)) {
 		xpd->last_reply = *info;
 	}
 

Modified: linux/trunk/drivers/dahdi/xpp/card_echo.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_echo.c?view=diff&rev=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_echo.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_echo.c Wed Jan 11 13:56:35 2012
@@ -123,11 +123,12 @@
 	}
 	spin_lock_irqsave(&xpd->lock, flags);
 	/* Update /proc info only if reply related to last reg read request */
-	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)) {
+	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)) {
 		xpd->last_reply = *info;
 	}
 	spin_unlock_irqrestore(&xpd->lock, flags);
@@ -226,13 +227,13 @@
 	ts = xbus->echo_state.timeslots;
 	for (i = 0; i + 15 < ECHO_TIMESLOTS; i += 16) {
 		XBUS_DBG(GENERAL, xbus,
-			 "EC-DUMP[%03d]: "
-			 "0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X "
-			 "0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
-			 i, ts[i + 0], ts[i + 1], ts[i + 2], ts[i + 3],
-			 ts[i + 4], ts[i + 5], ts[i + 6], ts[i + 7], ts[i + 8],
-			 ts[i + 9], ts[i + 10], ts[i + 11], ts[i + 12],
-			 ts[i + 13], ts[i + 14], ts[i + 15]
+			"EC-DUMP[%03d]: "
+			"0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X "
+			"0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
+			i, ts[i + 0], ts[i + 1], ts[i + 2], ts[i + 3],
+			ts[i + 4], ts[i + 5], ts[i + 6], ts[i + 7], ts[i + 8],
+			ts[i + 9], ts[i + 10], ts[i + 11], ts[i + 12],
+			ts[i + 13], ts[i + 14], ts[i + 15]
 		    );
 	}
 }

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=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxo.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxo.c Wed Jan 11 13:56:35 2012
@@ -87,7 +87,8 @@
 #define	DAA_WRITE	1
 #define	DAA_READ	0
 #define	DAA_DIRECT_REQUEST(xbus, xpd, port, writing, reg, dL)	\
-	xpp_register_request((xbus), (xpd), (port), (writing), (reg), 0, 0, (dL), 0, 0, 0)
+		xpp_register_request((xbus), (xpd), (port), \
+		(writing), (reg), 0, 0, (dL), 0, 0, 0)
 
 /*---------------- FXO Protocol Commands ----------------------------------*/
 
@@ -169,9 +170,18 @@
  */
 #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_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	LED_BLINK_RING			(1000/8)	/* in ticks */
 
@@ -266,11 +276,13 @@
 			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
+			/* Blinking? */
+			if ((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) {
 				int mod_value = LED_COUNTER(priv, i, color);
 
 				if (!mod_value)
-					mod_value = DEFAULT_LED_PERIOD;	/* safety value */
+					/* safety value */
+					mod_value = DEFAULT_LED_PERIOD;
 				// led state is toggled
 				if ((timer_count % mod_value) == 0) {
 					LINE_DBG(LEDS, xpd, i, "ledstate=%s\n",
@@ -347,7 +359,8 @@
 	__u8 value;
 
 	BUG_ON(!xpd);
-	BUG_ON(PHONEDEV(xpd).direction == TO_PHONE);	// We can SETHOOK state only on PSTN
+	/* We can SETHOOK state only on PSTN */
+	BUG_ON(PHONEDEV(xpd).direction == TO_PHONE);
 	xbus = xpd->xbus;
 	priv = xpd->priv;
 	BUG_ON(!priv);
@@ -378,7 +391,8 @@
 	priv->metering_tone_state = 0L;
 	DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, DAA_REG_METERING, 0x2D);
 #endif
-	reset_battery_readings(xpd, pos);	/* unstable during hook changes */
+	/* unstable during hook changes */
+	reset_battery_readings(xpd, pos);
 	if (to_offhook) {
 		priv->power_denial_safezone[pos] = power_denial_safezone;
 	} else {
@@ -460,8 +474,9 @@
 
 	if (to_phone) {
 		XBUS_NOTICE(xbus,
-			    "XPD=%d%d: try to instanciate FXO with reverse direction\n",
-			    unit, subunit);
+			"XPD=%d%d: try to instanciate FXO with "
+			"reverse direction\n",
+			unit, subunit);
 		return NULL;
 	}
 	if (subtype == 2)
@@ -493,10 +508,13 @@
 	// Hanghup all lines
 	for_each_line(xpd, i) {
 		do_sethook(xpd, i, 0);
-		priv->polarity[i] = POL_UNKNOWN;	/* will be updated on next battery sample */
+		/* will be updated on next battery sample */
+		priv->polarity[i] = POL_UNKNOWN;
 		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 */
+		/* will be updated on next battery sample */
+		priv->battery[i] = BATTERY_UNKNOWN;
+		/* will be updated on next battery sample */
+		priv->power[i] = POWER_UNKNOWN;
 		if (caller_id_style == CID_STYLE_ETSI_DTMF)
 			oht_pcm(xpd, i, 1);
 	}
@@ -696,7 +714,7 @@
 		if (priv->power_denial_safezone[i] > 0) {
 			if (--priv->power_denial_safezone[i] == 0) {
 				/*
-				 * Poll current, previous answers are meaningless
+				 * Poll current, prev answers are meaningless
 				 */
 				DAA_DIRECT_REQUEST(xpd->xbus, xpd, i, DAA_READ,
 						   DAA_REG_CURRENT, 0);
@@ -707,9 +725,11 @@
 			priv->power_denial_length[i]--;
 			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.
-				 * So we just flag it and schedule more ticks to wait.
+				 * But maybe the FXS started to ring (and
+				 * the firmware haven't detected it yet).
+				 * This would cause false power denials so
+				 * we just flag it and schedule more ticks
+				 * to wait.
 				 */
 				LINE_DBG(SIGNAL, xpd, i,
 					 "Possible Power Denial Hangup\n");
@@ -850,8 +870,9 @@
 					       echotune_data[i]);
 			if (ret < 0) {
 				LINE_NOTICE(xpd, pos,
-					    "Couldn't write %0x02X to register %0x02X\n",
-					    echotune_data[i], echotune_regs[i]);
+					"Couldn't write %0x02X to "
+					"register %0x02X\n",
+					echotune_data[i], echotune_regs[i]);
 				return ret;
 			}
 			msleep(1);
@@ -903,19 +924,20 @@
 		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
+				 * With poll_battery_interval==0 we cannot
+				 * have BATTERY_OFF so we won't get here
 				 */
 				LINE_NOTICE(xpd, i,
-					    "SIG_CHANGED while battery is off. Ignored.\n");
+					"SIG_CHANGED while battery is off. "
+					"Ignored.\n");
 				continue;
 			}
 			/* First report false ring alarms */
 			debounce = atomic_read(&priv->ring_debounce[i]);
 			if (debounce)
 				LINE_NOTICE(xpd, i,
-					    "debounced false ring (only %d ticks)\n",
-					    debounce);
+					"debounced false ring (only %d ticks)\n",
+					debounce);
 			/*
 			 * Now set a new ring alarm.
 			 * It will be checked in handle_fxo_ring()
@@ -930,7 +952,8 @@
 	return 0;
 }
 
-static void update_battery_voltage(xpd_t *xpd, __u8 data_low, xportno_t portno)
+static void update_battery_voltage(xpd_t *xpd, __u8 data_low,
+	xportno_t portno)
 {
 	struct FXO_priv_data *priv;
 	enum polarity_state pol;
@@ -988,7 +1011,8 @@
 		MARK_OFF(priv, portno, LED_RED);
 #endif
 	if (priv->battery[portno] != BATTERY_ON) {
-		priv->polarity[portno] = POL_UNKNOWN;	/* What's the polarity ? */
+		/* What's the polarity ? */
+		priv->polarity[portno] = POL_UNKNOWN;
 		return;
 	}
 	/*
@@ -1028,11 +1052,12 @@
 			/*
 			 * Inform dahdi/Asterisk:
 			 * 1. Maybe used for hangup detection during offhook
-			 * 2. In some countries used to report caller-id during onhook
-			 *    but before first ring.
+			 * 2. In some countries used to report caller-id
+			 *    during onhook but before first ring.
 			 */
 			if (caller_id_style == CID_STYLE_ETSI_FSK)
-				oht_pcm(xpd, portno, 1);	/* will be cleared on ring/offhook */
+				/* will be cleared on ring/offhook */
+				oht_pcm(xpd, portno, 1);
 			if (SPAN_REGISTERED(xpd)) {
 				LINE_DBG(SIGNAL, xpd, portno,
 					 "Send DAHDI_EVENT_POLARITY: %s\n",
@@ -1048,10 +1073,12 @@
 	/*
 	 * Reset debounce counters to prevent false alarms
 	 */
-	reset_battery_readings(xpd, portno);	/* unstable during hook changes */
-}
-
-static void update_battery_current(xpd_t *xpd, __u8 data_low, xportno_t portno)
+	/* unstable during hook changes */
+	reset_battery_readings(xpd, portno);
+}
+
+static void update_battery_current(xpd_t *xpd, __u8 data_low,
+	xportno_t portno)
 {
 	struct FXO_priv_data *priv;
 
@@ -1145,11 +1172,12 @@
 		 ((info->bytes == 3) ? 'I' : 'D'), REG_FIELD(info, regnum),
 		 REG_FIELD(info, data_low), REG_FIELD(info, data_high));
 	/* Update /proc info only if reply relate to the last slic read request */
-	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)) {
+	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)) {
 		xpd->last_reply = *info;
 	}
 	return 0;

Modified: linux/trunk/drivers/dahdi/xpp/card_fxo.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxo.h?view=diff&rev=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxo.h (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxo.h Wed Jan 11 13:56:35 2012
@@ -25,14 +25,16 @@
 #include "xpd.h"
 
 enum fxo_opcodes {
-	XPROTO_NAME(FXO, SIG_CHANGED) = 0x06,
-	 /**/ XPROTO_NAME(FXO, DAA_WRITE) = 0x0F,	/* Write to DAA */
-	XPROTO_NAME(FXO, CHAN_CID) = 0x0F,	/* Write to DAA */
-	XPROTO_NAME(FXO, LED) = 0x0F,	/* Write to DAA */
+	XPROTO_NAME(FXO, SIG_CHANGED) = 0x06,		/**/
+	XPROTO_NAME(FXO, DAA_WRITE) = 0x0F,		/* Write to DAA */
+	XPROTO_NAME(FXO, CHAN_CID) = 0x0F,		/* Write to DAA */
+	XPROTO_NAME(FXO, LED) = 0x0F,			/* Write to DAA */
 };
 
-DEF_RPACKET_DATA(FXO, SIG_CHANGED, xpp_line_t sig_status;	/* channels: lsb=1, msb=8 */
-		 xpp_line_t sig_toggles;	/* channels: lsb=1, msb=8 */
-    );
+
+DEF_RPACKET_DATA(FXO, SIG_CHANGED,
+		xpp_line_t sig_status;	/* channels: lsb=1, msb=8 */
+		xpp_line_t sig_toggles;	/* channels: lsb=1, msb=8 */
+		);
 
 #endif /* CARD_FXO_H */

Modified: linux/trunk/drivers/dahdi/xpp/card_fxs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxs.c?view=diff&rev=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxs.c Wed Jan 11 13:56:35 2012
@@ -33,7 +33,8 @@
 
 static const char rcsid[] = "$Id$";
 
-static DEF_PARM(int, debug, 0, 0644, "Print DBG statements");	/* must be before dahdi_debug.h */
+/* must be before dahdi_debug.h */
+static DEF_PARM(int, debug, 0, 0644, "Print DBG statements");
 static DEF_PARM_BOOL(reversepolarity, 0, 0644, "Reverse Line Polarity");
 static DEF_PARM_BOOL(dtmf_detection, 1, 0644, "Do DTMF detection in hardware");
 #ifdef	POLL_DIGITAL_INPUTS
@@ -46,9 +47,11 @@
 
 /* Signaling is opposite (fxo signalling for fxs card) */
 #if 1
-#define	FXS_DEFAULT_SIGCAP	(DAHDI_SIG_FXOKS | DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS)
+#define	FXS_DEFAULT_SIGCAP \
+		(DAHDI_SIG_FXOKS | DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS)
 #else
-#define	FXS_DEFAULT_SIGCAP	(DAHDI_SIG_SF | DAHDI_SIG_EM)
+#define	FXS_DEFAULT_SIGCAP \
+		(DAHDI_SIG_SF | DAHDI_SIG_EM)
 #endif
 
 #define	VMWI_TYPE(priv, pos, type)	\
@@ -70,11 +73,14 @@
 #define	SLIC_WRITE	1
 #define	SLIC_READ	0
 #define	SLIC_DIRECT_REQUEST(xbus, xpd, port, writing, reg, dL)	\
-	xpp_register_request((xbus), (xpd), (port), (writing), (reg), 0, 0, (dL), 0, 0, 0)
+	xpp_register_request((xbus), (xpd), (port), \
+	(writing), (reg), 0, 0, (dL), 0, 0, 0)
 #define	SLIC_INDIRECT_REQUEST(xbus, xpd, port, writing, reg, dL, dH)	\
-	xpp_register_request((xbus), (xpd), (port), (writing), 0x1E, 1, (reg), (dL), 1, (dH), 0)
-
-#define	VALID_PORT(port)	(((port) >= 0 && (port) <= 7) || (port) == PORT_BROADCAST)
+	xpp_register_request((xbus), (xpd), (port), \
+	(writing), 0x1E, 1, (reg), (dL), 1, (dH), 0)
+
+#define	VALID_PORT(port) \
+		(((port) >= 0 && (port) <= 7) || (port) == PORT_BROADCAST)
 
 #define	REG_DIGITAL_IOCTRL	0x06	/* LED and RELAY control */
 
@@ -90,8 +96,10 @@
 	FXS_LINE_RING_OPEN = 0x07	/* RING open */
 };
 
-#define	FXS_LINE_POL_ACTIVE	((reversepolarity) ? FXS_LINE_REV_ACTIVE : FXS_LINE_ACTIVE)
-#define	FXS_LINE_POL_OHTRANS	((reversepolarity) ? FXS_LINE_REV_OHTRANS : FXS_LINE_OHTRANS)
+#define	FXS_LINE_POL_ACTIVE \
+		((reversepolarity) ? FXS_LINE_REV_ACTIVE : FXS_LINE_ACTIVE)
+#define	FXS_LINE_POL_OHTRANS \
+		((reversepolarity) ? FXS_LINE_REV_OHTRANS : FXS_LINE_OHTRANS)
 
 /*
  * DTMF detection
@@ -100,7 +108,8 @@
 #define REG_BATTERY		0x42	/* 66 - Battery Feed Control */
 #define	REG_BATTERY_BATSL	BIT(1)	/* Battery Feed Select */
 
-#define	REG_LOOPCLOSURE		0x44	/* 68 -  Loop Closure/Ring Trip Detect Status */
+/* 68 -  Loop Closure/Ring Trip Detect Status */
+#define	REG_LOOPCLOSURE		0x44
 #define	REG_LOOPCLOSURE_ZERO	0xF8	/* Loop Closure zero bits. */
 #define	REG_LOOPCLOSURE_LCR	BIT(0)	/* Loop Closure Detect Indicator. */
 
@@ -112,8 +121,8 @@
 static int proc_fxs_info_read(char *page, char **start, off_t off, int count,
 			      int *eof, void *data);
 #ifdef	WITH_METERING
-static int proc_xpd_metering_write(struct file *file, const char __user *buffer,
-				   unsigned long count, void *data);
+static int proc_xpd_metering_write(struct file *file,
+	const char __user *buffer, unsigned long count, void *data);
 #endif
 #endif
 static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos);
@@ -142,7 +151,8 @@
 	int led_counter[NUM_LEDS][CHANNELS_PERXPD];
 	int ohttimer[CHANNELS_PERXPD];
 #define OHT_TIMER		6000	/* How long after RING to retain OHT */
-	enum fxs_state idletxhookstate[CHANNELS_PERXPD];	/* IDLE changing hook state */
+	/* IDLE changing hook state */
+	enum fxs_state idletxhookstate[CHANNELS_PERXPD];
 	enum fxs_state lasttxhook[CHANNELS_PERXPD];
 	struct dahdi_vmwi_info vmwisetting[CHANNELS_PERXPD];
 };
@@ -153,9 +163,18 @@
  */
 #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_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	LED_BLINK_RING			(1000/8)	/* in ticks */
 
@@ -200,24 +219,24 @@
 /*
  * LED and RELAY control is done via SLIC register 0x06:
  *         7     6     5     4     3     2     1     0
- *	+-----+-----+-----+-----+-----+-----+-----+-----+
- *	| M2  | M1  | M3  | C2  | O1  | O3  | C1  | C3  |
- *	+-----+-----+-----+-----+-----+-----+-----+-----+
+ *  +-----+-----+-----+-----+-----+-----+-----+-----+
+ *  | M2  | M1  | M3  | C2  | O1  | O3  | C1  | C3  |
+ *  +-----+-----+-----+-----+-----+-----+-----+-----+
  *
- *	Cn	- Control bit (control one digital line)
- *	On	- Output bit (program a digital line for output)
- *	Mn	- Mask bit (only the matching output control bit is affected)
+ *  Cn	- Control bit (control one digital line)
+ *  On	- Output bit (program a digital line for output)
+ *  Mn	- Mask bit (only the matching output control bit is affected)
  *
- *	C3	- OUTPUT RELAY (0 - OFF, 1 - ON)
- *	C1	- GREEN LED (0 - OFF, 1 - ON)
- *	O3	- Output RELAY (this line is output)
- *	O1	- Output GREEN (this line is output)
- *	C2	- RED LED (0 - OFF, 1 - ON)
- *	M3	- Mask RELAY. (1 - C3 effect the OUTPUT RELAY)
- *	M2	- Mask RED. (1 - C2 effect the RED LED)
- *	M1	- Mask GREEN. (1 - C1 effect the GREEN LED)
+ *  C3	- OUTPUT RELAY (0 - OFF, 1 - ON)
+ *  C1	- GREEN LED (0 - OFF, 1 - ON)
+ *  O3	- Output RELAY (this line is output)
+ *  O1	- Output GREEN (this line is output)
+ *  C2	- RED LED (0 - OFF, 1 - ON)
+ *  M3	- Mask RELAY. (1 - C3 effect the OUTPUT RELAY)
+ *  M2	- Mask RED. (1 - C2 effect the RED LED)
+ *  M1	- Mask GREEN. (1 - C1 effect the GREEN LED)
  *
- *	The OUTPUT RELAY (actually a relay out) is connected to line 0 and 4 only.
+ *  The OUTPUT RELAY (actually a relay out) is connected to line 0 and 4 only.
  */
 
 //                                              GREEN   RED     OUTPUT RELAY
@@ -283,12 +302,14 @@
 			    (PHONEDEV(xpd).digital_outputs | PHONEDEV(xpd).
 			     digital_inputs, i))
 				continue;
-			if ((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) {	// Blinking
+			/* Blinking? */
+			if ((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) {
 				int mod_value = LED_COUNTER(priv, i, color);
 
 				if (!mod_value)
-					mod_value = DEFAULT_LED_PERIOD;	/* safety value */
-				// led state is toggled
+					/* safety value */
+					mod_value = DEFAULT_LED_PERIOD;
+				/* led state is toggled */
 				if ((timer_count % mod_value) == 0) {
 					LINE_DBG(LEDS, xpd, i, "ledstate=%s\n",
 						 (IS_SET
@@ -478,7 +499,9 @@
 	 * Setup ring timers
 	 */
 	/* Software controled ringing (for CID) */
-	ret = SLIC_DIRECT_REQUEST(xbus, xpd, PORT_BROADCAST, SLIC_WRITE, 0x22, 0x00);	/* Ringing Oscilator Control */
+	/* Ringing Oscilator Control */
+	ret = SLIC_DIRECT_REQUEST(xbus, xpd, PORT_BROADCAST, SLIC_WRITE,
+		0x22, 0x00);
 	if (ret < 0)
 		goto err;
 	for_each_line(xpd, i) {
@@ -678,30 +701,28 @@
 		LINE_DBG(SIGNAL, xpd, pos, "RINGER\n");
 		BIT_CLR(priv->neon_blinking, pos);
 
-		ret +=
-		    SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x16,
-					  0x00, 0x00);
-		ret +=
-		    SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x15,
-					  0x77, 0x01);
-		ret +=
-		    SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x14,
-					  0xFD, 0x7E);
-
-		ret +=
-		    SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x22, 0x00);
-		ret +=
-		    SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x30, 0x00);
-		ret +=
-		    SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x31, 0x00);
-		ret +=
-		    SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x32, 0x00);
-		ret +=
-		    SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x33, 0x00);
-		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x4A, 0x34);	/* High Vbat~ -82V[Dc] */
-		ret +=
-		    SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x1D,
-					  0x00, 0x36);
+		ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x16, 0x00, 0x00);
+		ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x15, 0x77, 0x01);
+		ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x14, 0xFD, 0x7E);
+
+		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x22, 0x00);
+		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x30, 0x00);
+		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x31, 0x00);
+		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x32, 0x00);
+		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x33, 0x00);
+		/* High Vbat~ -82V[Dc] */
+		ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x4A, 0x34);
+		ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
+			0x1D, 0x00, 0x36);
 	}
 	return (ret ? -EPROTO : 0);
 }
@@ -988,7 +1009,10 @@
 		if (!dtmf_detection) {
 			spin_lock_irqsave(&xpd->lock, flags);
 			if (IS_SET(priv->want_dtmf_events, pos)) {
-				/* Detection mode changed: Disable DTMF interrupts */
+				/*
+				 * Detection mode changed:
+				 * Disable DTMF interrupts
+				 */
 				SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
 						    0x17, 0);
 			}
@@ -1006,18 +1030,26 @@
 		spin_lock_irqsave(&xpd->lock, flags);
 		if (val & DAHDI_TONEDETECT_ON) {
 			if (!IS_SET(priv->want_dtmf_events, pos)) {
-				/* Detection mode changed: Enable DTMF interrupts */
+				/*
+				 * Detection mode changed:
+				 * Enable DTMF interrupts
+				 */
 				LINE_DBG(SIGNAL, xpd, pos,
-					 "DAHDI_TONEDETECT: Enable Hardware DTMF\n");
+					"DAHDI_TONEDETECT: "
+					"Enable Hardware DTMF\n");
 				SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
 						    0x17, 1);
 			}
 			BIT_SET(priv->want_dtmf_events, pos);
 		} else {
 			if (IS_SET(priv->want_dtmf_events, pos)) {
-				/* Detection mode changed: Disable DTMF interrupts */
+				/*
+				 * Detection mode changed:
+				 * Disable DTMF interrupts
+				 */
 				LINE_DBG(SIGNAL, xpd, pos,
-					 "DAHDI_TONEDETECT: Disable Hardware DTMF\n");
+					"DAHDI_TONEDETECT: "
+					"Disable Hardware DTMF\n");
 				SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE,
 						    0x17, 0);
 			}
@@ -1052,8 +1084,9 @@
 		if (priv->lasttxhook[pos] == FXS_LINE_RING
 		    || priv->lasttxhook[pos] == FXS_LINE_OPEN) {
 			LINE_DBG(SIGNAL, xpd, pos,
-				 "DAHDI_SETPOLARITY: %s Cannot change when lasttxhook=0x%X\n",
-				 (val) ? "ON" : "OFF", priv->lasttxhook[pos]);
+				"DAHDI_SETPOLARITY: %s Cannot change "
+				"when lasttxhook=0x%X\n",
+				(val) ? "ON" : "OFF", priv->lasttxhook[pos]);
 			return -EINVAL;
 		}
 		LINE_DBG(SIGNAL, xpd, pos, "DAHDI_SETPOLARITY: %s\n",
@@ -1076,7 +1109,9 @@
 
 			if (!notified++)
 				LINE_NOTICE(xpd, pos,
-					    "Got DAHDI_VMWI notification but vmwi_ioctl parameter is off. Ignoring.\n");
+					"Got DAHDI_VMWI notification "
+					"but vmwi_ioctl parameter is off. "
+					"Ignoring.\n");
 			return 0;
 		}
 		/* Digital inputs/outputs don't have VM leds */
@@ -1249,7 +1284,8 @@
 		    (mem_equal
 		     (writechunk, FSK_COMMON_PATTERN, DAHDI_CHUNKSIZE))) {
 			LINE_DBG(SIGNAL, xpd, i,
-				 "Found common FSK pattern. Start looking for ON/OFF patterns.\n");
+				"Found common FSK pattern. "
+				"Start looking for ON/OFF patterns.\n");
 			BIT_SET(priv->found_fsk_pattern, i);
 		} else if (unlikely(IS_SET(priv->found_fsk_pattern, i))) {
 			BIT_CLR(priv->found_fsk_pattern, i);
@@ -1314,7 +1350,8 @@
 			    IS_OFFHOOK(xpd,
 				       i) ? DAHDI_RXSIG_OFFHOOK :
 			    DAHDI_RXSIG_ONHOOK;
-			notify_rxsig(xpd, i, rxsig);	/* Notify after open() */
+			/* Notify after open() */
+			notify_rxsig(xpd, i, rxsig);
 			BIT_CLR(priv->update_offhook_state, i);
 		}
 	}
@@ -1393,8 +1430,9 @@
 		sig_toggles, sig_status);
 #if 0
 	Is this needed ? for_each_line(xpd, i) {
+		// Power down (prevent overheating!!!)
 		if (IS_SET(sig_toggles, i))
-			do_chan_power(xpd->xbus, xpd, BIT(i), 0);	// Power down (prevent overheating!!!)
+			do_chan_power(xpd->xbus, xpd, BIT(i), 0);
 	}
 #endif
 	spin_lock_irqsave(&xpd->lock, flags);
@@ -1425,11 +1463,12 @@
 			newchanno = PHONEDEV(xpd).channels - LINES_DIGI_INP + i;
 			BIT_CLR(lines, channo);
 			BIT_SET(lines, newchanno);
-			PHONEDEV(xpd).ringing[newchanno] = 0;	// Stop ringing. No leds for digital inputs.
-			if (offhook && !IS_OFFHOOK(xpd, newchanno)) {	// OFFHOOK
+			/* Stop ringing. No leds for digital inputs. */
+			PHONEDEV(xpd).ringing[newchanno] = 0;
+			if (offhook && !IS_OFFHOOK(xpd, newchanno)) {
 				LINE_DBG(SIGNAL, xpd, newchanno, "OFFHOOK\n");
 				hookstate_changed(xpd, newchanno, 1);
-			} else if (!offhook && IS_OFFHOOK(xpd, newchanno)) {	// ONHOOK
+			} else if (!offhook && IS_OFFHOOK(xpd, newchanno)) {
 				LINE_DBG(SIGNAL, xpd, newchanno, "ONHOOK\n");
 				hookstate_changed(xpd, newchanno, 0);
 			}
@@ -1477,10 +1516,11 @@
 		msec = usec_diff(&now, &priv->prev_key_time[portnum]) / 1000;
 	priv->prev_key_time[portnum] = now;
 	LINE_DBG(SIGNAL, xpd, portnum,
-		 "[%lu.%06lu] DTMF digit %-4s '%c' (val=%d, want_mute=%s want_event=%s, delta=%d msec)\n",
-		 now.tv_sec, now.tv_usec, (key_down) ? "DOWN" : "UP", digit,
-		 val, (want_mute) ? "yes" : "no", (want_event) ? "yes" : "no",
-		 msec);
+		"[%lu.%06lu] DTMF digit %-4s '%c' "
+		"(val=%d, want_mute=%s want_event=%s, delta=%d msec)\n",
+		now.tv_sec, now.tv_usec, (key_down) ? "DOWN" : "UP", digit,
+		val, (want_mute) ? "yes" : "no", (want_event) ? "yes" : "no",
+		msec);
 	/*
 	 * FIXME: we currently don't use the want_dtmf_mute until
 	 * we are sure about the logic in Asterisk native bridging.
@@ -1538,25 +1578,31 @@
 		if ((val & REG_LOOPCLOSURE_ZERO) == 0) {
 			offhook = (val & REG_LOOPCLOSURE_LCR) ? mask : 0;
 			LINE_DBG(SIGNAL, xpd, info->portnum,
-				 "REG_LOOPCLOSURE: dataL=0x%X (offhook=0x%X mask=0x%X\n",
-				 val, offhook, mask);
+				"REG_LOOPCLOSURE: dataL=0x%X "
+				"(offhook=0x%X mask=0x%X)\n",
+				val, offhook, mask);
 			process_hookstate(xpd, offhook, mask);
 		}
 	} else {
 #if 0
 		XPD_NOTICE(xpd,
-			   "Spurious register reply(ignored): %s reg_num=0x%X, dataL=0x%X dataH=0x%X\n",
-			   (indirect) ? "I" : "D", regnum, REG_FIELD(info,
-								     data_low),
-			   REG_FIELD(info, data_high));
-#endif
-	}
-	/* Update /proc info only if reply relate to the last slic read request */
-	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)) {
+			"Spurious register reply(ignored): "
+			"%s reg_num=0x%X, dataL=0x%X dataH=0x%X\n",
+			(indirect) ? "I" : "D",
+			regnum, REG_FIELD(info, data_low),
+			REG_FIELD(info, data_high));
+#endif
+	}
+	/*
+	 * Update /proc info only if reply relate to the last slic
+	 * read request
+	 */
+	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)) {
 		xpd->last_reply = *info;
 	}
 	spin_unlock_irqrestore(&xpd->lock, flags);
@@ -1698,8 +1744,8 @@
 #endif
 
 #ifdef	WITH_METERING
-static int proc_xpd_metering_write(struct file *file, const char __user *buffer,
-				   unsigned long count, void *data)
+static int proc_xpd_metering_write(struct file *file, const char
+		__user *buffer, unsigned long count, void *data)
 {
 	xpd_t *xpd = data;
 	char buf[MAX_PROC_WRITE];

Modified: linux/trunk/drivers/dahdi/xpp/card_fxs.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxs.h?view=diff&rev=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxs.h (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxs.h Wed Jan 11 13:56:35 2012
@@ -31,8 +31,9 @@
 	XPROTO_NAME(FXS, LED) = 0x0F,	/* Write to SLIC */
 };
 
-DEF_RPACKET_DATA(FXS, SIG_CHANGED, xpp_line_t sig_status;	/* channels: lsb=1, msb=8 */
-		 xpp_line_t sig_toggles;	/* channels: lsb=1, msb=8 */
-    );
+DEF_RPACKET_DATA(FXS, SIG_CHANGED,
+		xpp_line_t sig_status;	/* channels: lsb=1, msb=8 */
+		xpp_line_t sig_toggles;	/* channels: lsb=1, msb=8 */
+		);
 
 #endif /* CARD_FXS_H */

Modified: linux/trunk/drivers/dahdi/xpp/card_global.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_global.c?view=diff&rev=10430&r1=10429&r2=10430
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_global.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_global.c Wed Jan 11 13:56:35 2012
@@ -102,7 +102,8 @@
 	if (argc < num_args) {
 		XPD_ERR(xpd, "Not enough arguments (%d)\n", argc);
 		XPD_ERR(xpd,
-			"Any Command is composed of at least %d words (got only %d)\n",
+			"Any Command is composed of at least %d words "
+			"(got only %d)\n",
 			num_args, argc);
 		goto out;
 	}
@@ -143,7 +144,8 @@
 	switch (addr_mode) {
 	case 'I':
 		XPD_NOTICE(xpd,
-			   "'I' is deprecated in register commands. Use 'S' instead.\n");
+			"'I' is deprecated in register commands. "
+			"Use 'S' instead.\n");
 		/* fall through */
 	case 'S':
 		do_subreg = 1;
@@ -176,7 +178,8 @@
 	}
 	if (argc < num_args) {
 		XPD_ERR(xpd,
-			"Command \"%s\" is composed of at least %d words (got only %d)\n",
+			"Command \"%s\" is composed of at least %d words "
+			"(got only %d)\n",
 			argv[argno], num_args, argc);
 		goto out;
 	}
@@ -259,14 +262,13 @@
 	}
 #if 0
 	XPD_DBG(REGS, xpd,
-		"portno=%d writing=%d regnum=%d do_subreg=%d subreg=%d dataL=%d do_datah=%d dataH=%d\n",
-		portno,		/* portno	*/
-		writing,	/* writing	*/
-		regnum,
-		do_subreg,	/* use subreg	*/
-		subreg,	/* subreg	*/
-		data_low,
-		do_datah,	/* use data_high*/
+		"portno=%d writing=%d regnum=%d do_subreg=%d subreg=%d "
+		"dataL=%d do_datah=%d dataH=%d\n",
+		portno,			/* portno       */
+		writing,		/* writing      */
+		regnum, do_subreg,	/* use subreg   */
+		subreg,			/* subreg       */
+ 		data_low, do_datah,	/* use data_high */
 		data_high);
 #endif
 	ret = xpp_register_request(xpd->xbus, xpd, portno,
@@ -302,7 +304,8 @@
 		*p = '\0';
 	if ((p = strchr(buf, ';')) != NULL)	/* Truncate comments */
 		*p = '\0';
-	for (p = buf; *p && (*p == ' ' || *p == '\t'); p++)	/* Trim leading whitespace */
+	/* Trim leading whitespace */
+	for (p = buf; *p && (*p == ' ' || *p == '\t'); p++)
 		;
 	str = p;
 	for (i = 0; (p = strsep(&str, " \t")) != NULL && i < MAX_ARGS;) {
@@ -375,7 +378,8 @@
 		 (writing) ? 'W' : 'R', (do_subreg) ? 'S' : 'D', regnum, subreg,
 		 data_low, data_high);
 	reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd);
-	reg_cmd->bytes = sizeof(*reg_cmd) - 1;	// do not count the 'bytes' field
+	/* do not count the 'bytes' field */
+	reg_cmd->bytes = sizeof(*reg_cmd) - 1;
 	reg_cmd->is_multibyte = 0;
 	if (portno == PORT_BROADCAST) {
 		reg_cmd->portnum = 0;
@@ -525,11 +529,12 @@
 		card_desc->ports =
 		    card_desc->numchips * card_desc->ports_per_chip;
 		XBUS_INFO(xbus,
-			  "    CARD %d type=%d.%d ports=%d (%dx%d), port-dir=0x%02X\n",
-			  card_desc->xpd_addr.unit, card_desc->type,
-			  card_desc->subtype, card_desc->ports,
-			  card_desc->numchips, card_desc->ports_per_chip,
-			  card_desc->port_dir);
+			"    CARD %d type=%d.%d ports=%d (%dx%d), "
+			"port-dir=0x%02X\n",
+			card_desc->xpd_addr.unit, card_desc->type,
+			card_desc->subtype, card_desc->ports,
+			card_desc->numchips, card_desc->ports_per_chip,

[... 2051 lines stripped ...]



More information about the dahdi-commits mailing list