summaryrefslogtreecommitdiffstats
path: root/main/dahdi-linux-grsec/dahdi-2.5.0-bri-fixes.patch
blob: 01dcf646fbe9d10d960042dcaa7448a3f762e2fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
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");