Commit e46a5e3f authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: moxa, pci io space fixup

- request region before remapping pci io space
- use ioremap, iounmap istead of iomap interface, because we use
  readX/writeX for accessing this space because of isa support
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Tested-by: default avatarOyvind Aabling <Oyvind.Aabling@uni-c.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d353eca4
...@@ -290,10 +290,17 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev, ...@@ -290,10 +290,17 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev,
} }
board = &moxa_boards[i]; board = &moxa_boards[i];
board->basemem = pci_iomap(pdev, 2, 0x4000);
retval = pci_request_region(pdev, 2, "moxa-base");
if (retval) {
dev_err(&pdev->dev, "can't request pci region 2\n");
goto err;
}
board->basemem = ioremap(pci_resource_start(pdev, 2), 0x4000);
if (board->basemem == NULL) { if (board->basemem == NULL) {
dev_err(&pdev->dev, "can't remap io space 2\n"); dev_err(&pdev->dev, "can't remap io space 2\n");
goto err; goto err_reg;
} }
board->boardType = board_type; board->boardType = board_type;
...@@ -315,6 +322,8 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev, ...@@ -315,6 +322,8 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, board); pci_set_drvdata(pdev, board);
return (0); return (0);
err_reg:
pci_release_region(pdev, 2);
err: err:
return retval; return retval;
} }
...@@ -323,8 +332,9 @@ static void __devexit moxa_pci_remove(struct pci_dev *pdev) ...@@ -323,8 +332,9 @@ static void __devexit moxa_pci_remove(struct pci_dev *pdev)
{ {
struct moxa_board_conf *brd = pci_get_drvdata(pdev); struct moxa_board_conf *brd = pci_get_drvdata(pdev);
pci_iounmap(pdev, brd->basemem); iounmap(brd->basemem);
brd->basemem = NULL; brd->basemem = NULL;
pci_release_region(pdev, 2);
} }
static struct pci_driver moxa_pci_driver = { static struct pci_driver moxa_pci_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment