aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-05-08 03:36:10 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:23 -0400
commit38d090932564140454e5a0bc915beca07d8a65a0 (patch)
tree409c3109bc7e75076241090d02ae20c9478bc0fc /drivers/char
parentd407c78188c718c00e997ce7f8b8d45e92ee2dd6 (diff)
Char: cyclades, use pci_iomap/unmap
fork remove code for pci -- move it to separate, new, function and don't care about pci in the former. 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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/cyclades.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 1430e136d44d..478c388ed6da 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4775,6 +4775,7 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
4775 cy_card[j].first_line = cy_next_channel; 4775 cy_card[j].first_line = cy_next_channel;
4776 cy_card[j].num_chips = -1; 4776 cy_card[j].num_chips = -1;
4777 cy_card[j].pdev = pdev; 4777 cy_card[j].pdev = pdev;
4778 pci_set_drvdata(pdev, &cy_card[j]);
4778 4779
4779 /* print message */ 4780 /* print message */
4780#ifdef CONFIG_CYZ_INTR 4781#ifdef CONFIG_CYZ_INTR
@@ -4889,8 +4890,8 @@ static int __init cy_detect_pci(void)
4889 continue; 4890 continue;
4890 } 4891 }
4891#endif 4892#endif
4892 cy_pci_addr0 = ioremap(cy_pci_phys0, CyPCI_Yctl); 4893 cy_pci_addr0 = pci_iomap(pdev, 0, CyPCI_Yctl);
4893 cy_pci_addr2 = ioremap(cy_pci_phys2, CyPCI_Ywin); 4894 cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Ywin);
4894 4895
4895#ifdef CY_PCI_DEBUG 4896#ifdef CY_PCI_DEBUG
4896 printk("Cyclom-Y/PCI: relocate winaddr=0x%lx " 4897 printk("Cyclom-Y/PCI: relocate winaddr=0x%lx "
@@ -4948,6 +4949,7 @@ static int __init cy_detect_pci(void)
4948 cy_card[j].first_line = cy_next_channel; 4949 cy_card[j].first_line = cy_next_channel;
4949 cy_card[j].num_chips = cy_pci_nchan / 4; 4950 cy_card[j].num_chips = cy_pci_nchan / 4;
4950 cy_card[j].pdev = pdev; 4951 cy_card[j].pdev = pdev;
4952 pci_set_drvdata(pdev, &cy_card[j]);
4951 4953
4952 /* enable interrupts in the PCI interface */ 4954 /* enable interrupts in the PCI interface */
4953 plx_ver = readb(cy_pci_addr2 + CyPLX_VER) & 0x0f; 4955 plx_ver = readb(cy_pci_addr2 + CyPLX_VER) & 0x0f;
@@ -5006,7 +5008,7 @@ static int __init cy_detect_pci(void)
5006 "ctladdr=0x%lx\n", 5008 "ctladdr=0x%lx\n",
5007 (ulong) cy_pci_phys2, (ulong) cy_pci_phys0); 5009 (ulong) cy_pci_phys2, (ulong) cy_pci_phys0);
5008#endif 5010#endif
5009 cy_pci_addr0 = ioremap(cy_pci_phys0, CyPCI_Zctl); 5011 cy_pci_addr0 = pci_iomap(pdev, 0, CyPCI_Zctl);
5010 5012
5011 /* Disable interrupts on the PLX before resetting it */ 5013 /* Disable interrupts on the PLX before resetting it */
5012 cy_writew(cy_pci_addr0 + 0x68, 5014 cy_writew(cy_pci_addr0 + 0x68,
@@ -5040,8 +5042,7 @@ static int __init cy_detect_pci(void)
5040 } 5042 }
5041 5043
5042 if (mailbox == ZE_V1) { 5044 if (mailbox == ZE_V1) {
5043 cy_pci_addr2 = ioremap(cy_pci_phys2, 5045 cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Ze_win);
5044 CyPCI_Ze_win);
5045 if (ZeIndex == NR_CARDS) { 5046 if (ZeIndex == NR_CARDS) {
5046 printk("Cyclades-Ze/PCI found at " 5047 printk("Cyclades-Ze/PCI found at "
5047 "0x%lx but no more cards can " 5048 "0x%lx but no more cards can "
@@ -5061,7 +5062,7 @@ static int __init cy_detect_pci(void)
5061 i--; 5062 i--;
5062 continue; 5063 continue;
5063 } else { 5064 } else {
5064 cy_pci_addr2 = ioremap(cy_pci_phys2,CyPCI_Zwin); 5065 cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Zwin);
5065 } 5066 }
5066 5067
5067#ifdef CY_PCI_DEBUG 5068#ifdef CY_PCI_DEBUG
@@ -5145,6 +5146,7 @@ static int __init cy_detect_pci(void)
5145 cy_card[j].first_line = cy_next_channel; 5146 cy_card[j].first_line = cy_next_channel;
5146 cy_card[j].num_chips = -1; 5147 cy_card[j].num_chips = -1;
5147 cy_card[j].pdev = pdev; 5148 cy_card[j].pdev = pdev;
5149 pci_set_drvdata(pdev, &cy_card[j]);
5148 5150
5149 /* print message */ 5151 /* print message */
5150#ifdef CONFIG_CYZ_INTR 5152#ifdef CONFIG_CYZ_INTR
@@ -5198,6 +5200,26 @@ static int __init cy_detect_pci(void)
5198#endif /* ifdef CONFIG_PCI */ 5200#endif /* ifdef CONFIG_PCI */
5199} /* cy_detect_pci */ 5201} /* cy_detect_pci */
5200 5202
5203static void __devexit cy_pci_release(struct pci_dev *pdev)
5204{
5205#ifdef CONFIG_PCI
5206 struct cyclades_card *cinfo = pci_get_drvdata(pdev);
5207
5208 pci_iounmap(pdev, cinfo->base_addr);
5209 if (cinfo->ctl_addr)
5210 pci_iounmap(pdev, cinfo->ctl_addr);
5211 if (cinfo->irq
5212#ifndef CONFIG_CYZ_INTR
5213 && cinfo->num_chips != -1 /* not a Z card */
5214#endif /* CONFIG_CYZ_INTR */
5215 )
5216 free_irq(cinfo->irq, cinfo);
5217 pci_release_regions(pdev);
5218
5219 cinfo->base_addr = NULL;
5220#endif
5221}
5222
5201/* 5223/*
5202 * This routine prints out the appropriate serial driver version number 5224 * This routine prints out the appropriate serial driver version number
5203 * and identifies which options were configured into this driver. 5225 * and identifies which options were configured into this driver.
@@ -5546,6 +5568,10 @@ static void __exit cy_cleanup_module(void)
5546 5568
5547 for (i = 0; i < NR_CARDS; i++) { 5569 for (i = 0; i < NR_CARDS; i++) {
5548 if (cy_card[i].base_addr) { 5570 if (cy_card[i].base_addr) {
5571 if (cy_card[i].pdev) {
5572 cy_pci_release(cy_card[i].pdev);
5573 continue;
5574 }
5549 iounmap(cy_card[i].base_addr); 5575 iounmap(cy_card[i].base_addr);
5550 if (cy_card[i].ctl_addr) 5576 if (cy_card[i].ctl_addr)
5551 iounmap(cy_card[i].ctl_addr); 5577 iounmap(cy_card[i].ctl_addr);
@@ -5555,10 +5581,6 @@ static void __exit cy_cleanup_module(void)
5555#endif /* CONFIG_CYZ_INTR */ 5581#endif /* CONFIG_CYZ_INTR */
5556 ) 5582 )
5557 free_irq(cy_card[i].irq, &cy_card[i]); 5583 free_irq(cy_card[i].irq, &cy_card[i]);
5558#ifdef CONFIG_PCI
5559 if (cy_card[i].pdev)
5560 pci_release_regions(cy_card[i].pdev);
5561#endif
5562 } 5584 }
5563 } 5585 }
5564} /* cy_cleanup_module */ 5586} /* cy_cleanup_module */