aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/sx.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2006-12-08 05:39:07 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:58 -0500
commit39103494fd0c5325763edd06c88b121a5c21516e (patch)
treee8f65c7fc381c4ec68eee335f597829dca5c5cf6 /drivers/char/sx.c
parent7eb9976f10354f0e3bc1a52b66b9cf857ff41088 (diff)
[PATCH] Char: sx, use pci_iomap
Use pci_ friends for memory remapping of pci devices. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/sx.c')
-rw-r--r--drivers/char/sx.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index f506ee3243d1..1057cc4466ca 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -2485,7 +2485,8 @@ static void __exit sx_release_drivers(void)
2485 func_exit(); 2485 func_exit();
2486} 2486}
2487 2487
2488static void __devexit sx_remove_card(struct sx_board *board) 2488static void __devexit sx_remove_card(struct sx_board *board,
2489 struct pci_dev *pdev)
2489{ 2490{
2490 if (board->flags & SX_BOARD_INITIALIZED) { 2491 if (board->flags & SX_BOARD_INITIALIZED) {
2491 /* The board should stop messing with us. (actually I mean the 2492 /* The board should stop messing with us. (actually I mean the
@@ -2496,7 +2497,10 @@ static void __devexit sx_remove_card(struct sx_board *board)
2496 2497
2497 /* It is safe/allowed to del_timer a non-active timer */ 2498 /* It is safe/allowed to del_timer a non-active timer */
2498 del_timer(&board->timer); 2499 del_timer(&board->timer);
2499 iounmap(board->base); 2500 if (pdev)
2501 pci_iounmap(pdev, board->base);
2502 else
2503 iounmap(board->base);
2500 2504
2501 board->flags &= ~(SX_BOARD_INITIALIZED | SX_BOARD_PRESENT); 2505 board->flags &= ~(SX_BOARD_INITIALIZED | SX_BOARD_PRESENT);
2502 } 2506 }
@@ -2559,7 +2563,7 @@ static int __devexit sx_eisa_remove(struct device *dev)
2559{ 2563{
2560 struct sx_board *board = dev_get_drvdata(dev); 2564 struct sx_board *board = dev_get_drvdata(dev);
2561 2565
2562 sx_remove_card(board); 2566 sx_remove_card(board, NULL);
2563 2567
2564 return 0; 2568 return 0;
2565} 2569}
@@ -2618,7 +2622,7 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev,
2618 const struct pci_device_id *ent) 2622 const struct pci_device_id *ent)
2619{ 2623{
2620 struct sx_board *board; 2624 struct sx_board *board;
2621 unsigned int i; 2625 unsigned int i, reg;
2622 int retval = -EIO; 2626 int retval = -EIO;
2623 2627
2624 mutex_lock(&sx_boards_lock); 2628 mutex_lock(&sx_boards_lock);
@@ -2640,12 +2644,10 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev,
2640 SX_CFPCI_BOARD; 2644 SX_CFPCI_BOARD;
2641 2645
2642 /* CF boards use base address 3.... */ 2646 /* CF boards use base address 3.... */
2643 if (IS_CF_BOARD(board)) 2647 reg = IS_CF_BOARD(board) ? 3 : 2;
2644 board->hw_base = pci_resource_start(pdev, 3); 2648 board->hw_base = pci_resource_start(pdev, reg);
2645 else
2646 board->hw_base = pci_resource_start(pdev, 2);
2647 board->base2 = 2649 board->base2 =
2648 board->base = ioremap(board->hw_base, WINDOW_LEN(board)); 2650 board->base = pci_iomap(pdev, reg, WINDOW_LEN(board));
2649 if (!board->base) { 2651 if (!board->base) {
2650 dev_err(&pdev->dev, "ioremap failed\n"); 2652 dev_err(&pdev->dev, "ioremap failed\n");
2651 goto err_flag; 2653 goto err_flag;
@@ -2671,7 +2673,7 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev,
2671 2673
2672 return 0; 2674 return 0;
2673err_unmap: 2675err_unmap:
2674 iounmap(board->base2); 2676 pci_iounmap(pdev, board->base);
2675err_flag: 2677err_flag:
2676 board->flags &= ~SX_BOARD_PRESENT; 2678 board->flags &= ~SX_BOARD_PRESENT;
2677err: 2679err:
@@ -2682,7 +2684,7 @@ static void __devexit sx_pci_remove(struct pci_dev *pdev)
2682{ 2684{
2683 struct sx_board *board = pci_get_drvdata(pdev); 2685 struct sx_board *board = pci_get_drvdata(pdev);
2684 2686
2685 sx_remove_card(board); 2687 sx_remove_card(board, pdev);
2686} 2688}
2687 2689
2688/* Specialix has a whole bunch of cards with 0x2000 as the device ID. They say 2690/* Specialix has a whole bunch of cards with 0x2000 as the device ID. They say
@@ -2812,7 +2814,7 @@ static void __exit sx_exit(void)
2812 pci_unregister_driver(&sx_pcidriver); 2814 pci_unregister_driver(&sx_pcidriver);
2813 2815
2814 for (i = 0; i < SX_NBOARDS; i++) 2816 for (i = 0; i < SX_NBOARDS; i++)
2815 sx_remove_card(&boards[i]); 2817 sx_remove_card(&boards[i], NULL);
2816 2818
2817 if (misc_deregister(&sx_fw_device) < 0) { 2819 if (misc_deregister(&sx_fw_device) < 0) {
2818 printk(KERN_INFO "sx: couldn't deregister firmware loader " 2820 printk(KERN_INFO "sx: couldn't deregister firmware loader "