diff options
-rw-r--r-- | drivers/char/vme_scc.c | 166 |
1 files changed, 136 insertions, 30 deletions
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index 0e8234bd0e19..994e1a58b987 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -198,6 +198,7 @@ static void scc_init_portstructs(void) | |||
198 | static int mvme147_scc_init(void) | 198 | static int mvme147_scc_init(void) |
199 | { | 199 | { |
200 | struct scc_port *port; | 200 | struct scc_port *port; |
201 | int error; | ||
201 | 202 | ||
202 | printk(KERN_INFO "SCC: MVME147 Serial Driver\n"); | 203 | printk(KERN_INFO "SCC: MVME147 Serial Driver\n"); |
203 | /* Init channel A */ | 204 | /* Init channel A */ |
@@ -207,14 +208,23 @@ static int mvme147_scc_init(void) | |||
207 | port->datap = port->ctrlp + 1; | 208 | port->datap = port->ctrlp + 1; |
208 | port->port_a = &scc_ports[0]; | 209 | port->port_a = &scc_ports[0]; |
209 | port->port_b = &scc_ports[1]; | 210 | port->port_b = &scc_ports[1]; |
210 | request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, | 211 | error = request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, |
211 | "SCC-A TX", port); | 212 | "SCC-A TX", port); |
212 | request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, | 213 | if (error) |
214 | goto fail; | ||
215 | error = request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, | ||
213 | "SCC-A status", port); | 216 | "SCC-A status", port); |
214 | request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, | 217 | if (error) |
218 | goto fail_free_a_tx; | ||
219 | error = request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, | ||
215 | "SCC-A RX", port); | 220 | "SCC-A RX", port); |
216 | request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, | 221 | if (error) |
217 | "SCC-A special cond", port); | 222 | goto fail_free_a_stat; |
223 | error = request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, | ||
224 | IRQF_DISABLED, "SCC-A special cond", port); | ||
225 | if (error) | ||
226 | goto fail_free_a_rx; | ||
227 | |||
218 | { | 228 | { |
219 | SCC_ACCESS_INIT(port); | 229 | SCC_ACCESS_INIT(port); |
220 | 230 | ||
@@ -234,14 +244,23 @@ static int mvme147_scc_init(void) | |||
234 | port->datap = port->ctrlp + 1; | 244 | port->datap = port->ctrlp + 1; |
235 | port->port_a = &scc_ports[0]; | 245 | port->port_a = &scc_ports[0]; |
236 | port->port_b = &scc_ports[1]; | 246 | port->port_b = &scc_ports[1]; |
237 | request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, | 247 | error = request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, |
238 | "SCC-B TX", port); | 248 | "SCC-B TX", port); |
239 | request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, | 249 | if (error) |
250 | goto fail_free_a_spcond; | ||
251 | error = request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, | ||
240 | "SCC-B status", port); | 252 | "SCC-B status", port); |
241 | request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, | 253 | if (error) |
254 | goto fail_free_b_tx; | ||
255 | error = request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, | ||
242 | "SCC-B RX", port); | 256 | "SCC-B RX", port); |
243 | request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, | 257 | if (error) |
244 | "SCC-B special cond", port); | 258 | goto fail_free_b_stat; |
259 | error = request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, | ||
260 | IRQF_DISABLED, "SCC-B special cond", port); | ||
261 | if (error) | ||
262 | goto fail_free_b_rx; | ||
263 | |||
245 | { | 264 | { |
246 | SCC_ACCESS_INIT(port); | 265 | SCC_ACCESS_INIT(port); |
247 | 266 | ||
@@ -257,6 +276,23 @@ static int mvme147_scc_init(void) | |||
257 | scc_init_drivers(); | 276 | scc_init_drivers(); |
258 | 277 | ||
259 | return 0; | 278 | return 0; |
279 | |||
280 | fail_free_b_rx: | ||
281 | free_irq(MVME147_IRQ_SCCB_RX, port); | ||
282 | fail_free_b_stat: | ||
283 | free_irq(MVME147_IRQ_SCCB_STAT, port); | ||
284 | fail_free_b_tx: | ||
285 | free_irq(MVME147_IRQ_SCCB_TX, port); | ||
286 | fail_free_a_spcond: | ||
287 | free_irq(MVME147_IRQ_SCCA_SPCOND, port); | ||
288 | fail_free_a_rx: | ||
289 | free_irq(MVME147_IRQ_SCCA_RX, port); | ||
290 | fail_free_a_stat: | ||
291 | free_irq(MVME147_IRQ_SCCA_STAT, port); | ||
292 | fail_free_a_tx: | ||
293 | free_irq(MVME147_IRQ_SCCA_TX, port); | ||
294 | fail: | ||
295 | return error; | ||
260 | } | 296 | } |
261 | #endif | 297 | #endif |
262 | 298 | ||
@@ -265,6 +301,7 @@ static int mvme147_scc_init(void) | |||
265 | static int mvme162_scc_init(void) | 301 | static int mvme162_scc_init(void) |
266 | { | 302 | { |
267 | struct scc_port *port; | 303 | struct scc_port *port; |
304 | int error; | ||
268 | 305 | ||
269 | if (!(mvme16x_config & MVME16x_CONFIG_GOT_SCCA)) | 306 | if (!(mvme16x_config & MVME16x_CONFIG_GOT_SCCA)) |
270 | return (-ENODEV); | 307 | return (-ENODEV); |
@@ -277,14 +314,23 @@ static int mvme162_scc_init(void) | |||
277 | port->datap = port->ctrlp + 2; | 314 | port->datap = port->ctrlp + 2; |
278 | port->port_a = &scc_ports[0]; | 315 | port->port_a = &scc_ports[0]; |
279 | port->port_b = &scc_ports[1]; | 316 | port->port_b = &scc_ports[1]; |
280 | request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, | 317 | error = request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, |
281 | "SCC-A TX", port); | 318 | "SCC-A TX", port); |
282 | request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, | 319 | if (error) |
320 | goto fail; | ||
321 | error = request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, | ||
283 | "SCC-A status", port); | 322 | "SCC-A status", port); |
284 | request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, | 323 | if (error) |
324 | goto fail_free_a_tx; | ||
325 | error = request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, | ||
285 | "SCC-A RX", port); | 326 | "SCC-A RX", port); |
286 | request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, | 327 | if (error) |
287 | "SCC-A special cond", port); | 328 | goto fail_free_a_stat; |
329 | error = request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, | ||
330 | IRQF_DISABLED, "SCC-A special cond", port); | ||
331 | if (error) | ||
332 | goto fail_free_a_rx; | ||
333 | |||
288 | { | 334 | { |
289 | SCC_ACCESS_INIT(port); | 335 | SCC_ACCESS_INIT(port); |
290 | 336 | ||
@@ -304,14 +350,22 @@ static int mvme162_scc_init(void) | |||
304 | port->datap = port->ctrlp + 2; | 350 | port->datap = port->ctrlp + 2; |
305 | port->port_a = &scc_ports[0]; | 351 | port->port_a = &scc_ports[0]; |
306 | port->port_b = &scc_ports[1]; | 352 | port->port_b = &scc_ports[1]; |
307 | request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, | 353 | error = request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, |
308 | "SCC-B TX", port); | 354 | "SCC-B TX", port); |
309 | request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, | 355 | if (error) |
356 | goto fail_free_a_spcond; | ||
357 | error = request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, | ||
310 | "SCC-B status", port); | 358 | "SCC-B status", port); |
311 | request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, | 359 | if (error) |
360 | goto fail_free_b_tx; | ||
361 | error = request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, | ||
312 | "SCC-B RX", port); | 362 | "SCC-B RX", port); |
313 | request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, | 363 | if (error) |
314 | "SCC-B special cond", port); | 364 | goto fail_free_b_stat; |
365 | error = request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, | ||
366 | IRQF_DISABLED, "SCC-B special cond", port); | ||
367 | if (error) | ||
368 | goto fail_free_b_rx; | ||
315 | 369 | ||
316 | { | 370 | { |
317 | SCC_ACCESS_INIT(port); /* Either channel will do */ | 371 | SCC_ACCESS_INIT(port); /* Either channel will do */ |
@@ -328,6 +382,23 @@ static int mvme162_scc_init(void) | |||
328 | scc_init_drivers(); | 382 | scc_init_drivers(); |
329 | 383 | ||
330 | return 0; | 384 | return 0; |
385 | |||
386 | fail_free_b_rx: | ||
387 | free_irq(MVME162_IRQ_SCCB_RX, port); | ||
388 | fail_free_b_stat: | ||
389 | free_irq(MVME162_IRQ_SCCB_STAT, port); | ||
390 | fail_free_b_tx: | ||
391 | free_irq(MVME162_IRQ_SCCB_TX, port); | ||
392 | fail_free_a_spcond: | ||
393 | free_irq(MVME162_IRQ_SCCA_SPCOND, port); | ||
394 | fail_free_a_rx: | ||
395 | free_irq(MVME162_IRQ_SCCA_RX, port); | ||
396 | fail_free_a_stat: | ||
397 | free_irq(MVME162_IRQ_SCCA_STAT, port); | ||
398 | fail_free_a_tx: | ||
399 | free_irq(MVME162_IRQ_SCCA_TX, port); | ||
400 | fail: | ||
401 | return error; | ||
331 | } | 402 | } |
332 | #endif | 403 | #endif |
333 | 404 | ||
@@ -336,6 +407,7 @@ static int mvme162_scc_init(void) | |||
336 | static int bvme6000_scc_init(void) | 407 | static int bvme6000_scc_init(void) |
337 | { | 408 | { |
338 | struct scc_port *port; | 409 | struct scc_port *port; |
410 | int error; | ||
339 | 411 | ||
340 | printk(KERN_INFO "SCC: BVME6000 Serial Driver\n"); | 412 | printk(KERN_INFO "SCC: BVME6000 Serial Driver\n"); |
341 | /* Init channel A */ | 413 | /* Init channel A */ |
@@ -345,14 +417,23 @@ static int bvme6000_scc_init(void) | |||
345 | port->datap = port->ctrlp + 4; | 417 | port->datap = port->ctrlp + 4; |
346 | port->port_a = &scc_ports[0]; | 418 | port->port_a = &scc_ports[0]; |
347 | port->port_b = &scc_ports[1]; | 419 | port->port_b = &scc_ports[1]; |
348 | request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, | 420 | error = request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, |
349 | "SCC-A TX", port); | 421 | "SCC-A TX", port); |
350 | request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, | 422 | if (error) |
423 | goto fail; | ||
424 | error = request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, | ||
351 | "SCC-A status", port); | 425 | "SCC-A status", port); |
352 | request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, | 426 | if (error) |
427 | goto fail_free_a_tx; | ||
428 | error = request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, | ||
353 | "SCC-A RX", port); | 429 | "SCC-A RX", port); |
354 | request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, | 430 | if (error) |
355 | "SCC-A special cond", port); | 431 | goto fail_free_a_stat; |
432 | error = request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, | ||
433 | IRQF_DISABLED, "SCC-A special cond", port); | ||
434 | if (error) | ||
435 | goto fail_free_a_rx; | ||
436 | |||
356 | { | 437 | { |
357 | SCC_ACCESS_INIT(port); | 438 | SCC_ACCESS_INIT(port); |
358 | 439 | ||
@@ -372,14 +453,22 @@ static int bvme6000_scc_init(void) | |||
372 | port->datap = port->ctrlp + 4; | 453 | port->datap = port->ctrlp + 4; |
373 | port->port_a = &scc_ports[0]; | 454 | port->port_a = &scc_ports[0]; |
374 | port->port_b = &scc_ports[1]; | 455 | port->port_b = &scc_ports[1]; |
375 | request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, | 456 | error = request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, |
376 | "SCC-B TX", port); | 457 | "SCC-B TX", port); |
377 | request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, | 458 | if (error) |
459 | goto fail_free_a_spcond; | ||
460 | error = request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, | ||
378 | "SCC-B status", port); | 461 | "SCC-B status", port); |
379 | request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, | 462 | if (error) |
463 | goto fail_free_b_tx; | ||
464 | error = request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, | ||
380 | "SCC-B RX", port); | 465 | "SCC-B RX", port); |
381 | request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, | 466 | if (error) |
382 | "SCC-B special cond", port); | 467 | goto fail_free_b_stat; |
468 | error = request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, | ||
469 | IRQF_DISABLED, "SCC-B special cond", port); | ||
470 | if (error) | ||
471 | goto fail_free_b_rx; | ||
383 | 472 | ||
384 | { | 473 | { |
385 | SCC_ACCESS_INIT(port); /* Either channel will do */ | 474 | SCC_ACCESS_INIT(port); /* Either channel will do */ |
@@ -393,6 +482,23 @@ static int bvme6000_scc_init(void) | |||
393 | scc_init_drivers(); | 482 | scc_init_drivers(); |
394 | 483 | ||
395 | return 0; | 484 | return 0; |
485 | |||
486 | fail: | ||
487 | free_irq(BVME_IRQ_SCCA_STAT, port); | ||
488 | fail_free_a_tx: | ||
489 | free_irq(BVME_IRQ_SCCA_RX, port); | ||
490 | fail_free_a_stat: | ||
491 | free_irq(BVME_IRQ_SCCA_SPCOND, port); | ||
492 | fail_free_a_rx: | ||
493 | free_irq(BVME_IRQ_SCCB_TX, port); | ||
494 | fail_free_a_spcond: | ||
495 | free_irq(BVME_IRQ_SCCB_STAT, port); | ||
496 | fail_free_b_tx: | ||
497 | free_irq(BVME_IRQ_SCCB_RX, port); | ||
498 | fail_free_b_stat: | ||
499 | free_irq(BVME_IRQ_SCCB_SPCOND, port); | ||
500 | fail_free_b_rx: | ||
501 | return error; | ||
396 | } | 502 | } |
397 | #endif | 503 | #endif |
398 | 504 | ||