aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-05-08 03:36:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:23 -0400
commitf3851e73ecdd070bc379677ed7aad958446f26e7 (patch)
treef314cf5a4cf24b69317eed618df8c34ed006819e
parent0809e2671d804f6caa8b3bd5e4de4b52f649cf73 (diff)
Char: cyclades, init card struct immediately
Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/cyclades.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 85c734b7f548..c7e1433bf8ea 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4834,6 +4834,7 @@ static int __init cy_detect_isa(void)
4834 cy_card[j].bus_index = 0; 4834 cy_card[j].bus_index = 0;
4835 cy_card[j].first_line = cy_next_channel; 4835 cy_card[j].first_line = cy_next_channel;
4836 cy_card[j].num_chips = cy_isa_nchan / 4; 4836 cy_card[j].num_chips = cy_isa_nchan / 4;
4837 cy_init_card(&cy_card[j], j);
4837 nboard++; 4838 nboard++;
4838 4839
4839 /* print message */ 4840 /* print message */
@@ -4931,6 +4932,7 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
4931 cy_card[j].first_line = cy_next_channel; 4932 cy_card[j].first_line = cy_next_channel;
4932 cy_card[j].num_chips = -1; 4933 cy_card[j].num_chips = -1;
4933 cy_card[j].pdev = pdev; 4934 cy_card[j].pdev = pdev;
4935 cy_init_card(&cy_card[j], j);
4934 pci_set_drvdata(pdev, &cy_card[j]); 4936 pci_set_drvdata(pdev, &cy_card[j]);
4935 4937
4936 /* print message */ 4938 /* print message */
@@ -5080,6 +5082,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5080 cy_card[j].first_line = cy_next_channel; 5082 cy_card[j].first_line = cy_next_channel;
5081 cy_card[j].num_chips = cy_pci_nchan / 4; 5083 cy_card[j].num_chips = cy_pci_nchan / 4;
5082 cy_card[j].pdev = pdev; 5084 cy_card[j].pdev = pdev;
5085 cy_init_card(&cy_card[j], j);
5083 pci_set_drvdata(pdev, &cy_card[j]); 5086 pci_set_drvdata(pdev, &cy_card[j]);
5084 5087
5085 /* enable interrupts in the PCI interface */ 5088 /* enable interrupts in the PCI interface */
@@ -5263,6 +5266,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5263 cy_card[j].first_line = cy_next_channel; 5266 cy_card[j].first_line = cy_next_channel;
5264 cy_card[j].num_chips = -1; 5267 cy_card[j].num_chips = -1;
5265 cy_card[j].pdev = pdev; 5268 cy_card[j].pdev = pdev;
5269 cy_init_card(&cy_card[j], j);
5266 pci_set_drvdata(pdev, &cy_card[j]); 5270 pci_set_drvdata(pdev, &cy_card[j]);
5267 5271
5268 /* print message */ 5272 /* print message */
@@ -5327,6 +5331,7 @@ static void __devexit cy_pci_release(struct pci_dev *pdev)
5327{ 5331{
5328#ifdef CONFIG_PCI 5332#ifdef CONFIG_PCI
5329 struct cyclades_card *cinfo = pci_get_drvdata(pdev); 5333 struct cyclades_card *cinfo = pci_get_drvdata(pdev);
5334 unsigned int i;
5330 5335
5331 pci_iounmap(pdev, cinfo->base_addr); 5336 pci_iounmap(pdev, cinfo->base_addr);
5332 if (cinfo->ctl_addr) 5337 if (cinfo->ctl_addr)
@@ -5340,6 +5345,10 @@ static void __devexit cy_pci_release(struct pci_dev *pdev)
5340 pci_release_regions(pdev); 5345 pci_release_regions(pdev);
5341 5346
5342 cinfo->base_addr = NULL; 5347 cinfo->base_addr = NULL;
5348 for (i = cinfo->first_line; i < cinfo->first_line + cinfo->nports; i++){
5349 cy_port[i].line = -1;
5350 cy_port[i].magic = -1;
5351 }
5343#endif 5352#endif
5344} 5353}
5345 5354
@@ -5483,6 +5492,12 @@ static int __init cy_init(void)
5483 cy_card[i].base_addr = NULL; 5492 cy_card[i].base_addr = NULL;
5484 } 5493 }
5485 5494
5495 /* invalidate remaining cy_port structures */
5496 for (i = 0; i < NR_PORTS; i++) {
5497 cy_port[i].line = -1;
5498 cy_port[i].magic = -1;
5499 }
5500
5486 /* the code below is responsible to find the boards. Each different 5501 /* the code below is responsible to find the boards. Each different
5487 type of board has its own detection routine. If a board is found, 5502 type of board has its own detection routine. If a board is found,
5488 the next cy_card structure available is set by the detection 5503 the next cy_card structure available is set by the detection
@@ -5498,29 +5513,7 @@ static int __init cy_init(void)
5498 5513
5499 cy_nboard = cy_isa_nboard + cy_pci_nboard; 5514 cy_nboard = cy_isa_nboard + cy_pci_nboard;
5500 5515
5501 /* invalidate remaining cy_card structures */
5502 for (i = 0; i < NR_CARDS; i++) {
5503 if (cy_card[i].base_addr == 0) {
5504 cy_card[i].first_line = -1;
5505 cy_card[i].ctl_addr = NULL;
5506 cy_card[i].irq = 0;
5507 cy_card[i].bus_index = 0;
5508 cy_card[i].first_line = 0;
5509 cy_card[i].num_chips = 0;
5510 }
5511 }
5512 /* invalidate remaining cy_port structures */
5513 for (i = cy_next_channel; i < NR_PORTS; i++) {
5514 cy_port[i].line = -1;
5515 cy_port[i].magic = -1;
5516 }
5517
5518 /* initialize per-port data structures for each valid board found */
5519 for (i = 0; i < cy_nboard; i++)
5520 cy_init_card(&cy_card[i], i);
5521
5522 return 0; 5516 return 0;
5523
5524} /* cy_init */ 5517} /* cy_init */
5525 5518
5526static void __exit cy_cleanup_module(void) 5519static void __exit cy_cleanup_module(void)