diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2008-04-30 03:53:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:42 -0400 |
commit | e46a5e3ff06b70690d567bdc81faf6c1c32e742f (patch) | |
tree | 0b6f8f40d6af73b90ff6b989fc88a0998f6b407b | |
parent | d353eca4e0480fddcb088c4692e1edba0a82eac9 (diff) |
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: Jiri Slaby <jirislaby@gmail.com>
Tested-by: Oyvind Aabling <Oyvind.Aabling@uni-c.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/moxa.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 2701f7c9f938..f841b1f74bfc 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -290,10 +290,17 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev, | |||
290 | } | 290 | } |
291 | 291 | ||
292 | board = &moxa_boards[i]; | 292 | board = &moxa_boards[i]; |
293 | board->basemem = pci_iomap(pdev, 2, 0x4000); | 293 | |
294 | retval = pci_request_region(pdev, 2, "moxa-base"); | ||
295 | if (retval) { | ||
296 | dev_err(&pdev->dev, "can't request pci region 2\n"); | ||
297 | goto err; | ||
298 | } | ||
299 | |||
300 | board->basemem = ioremap(pci_resource_start(pdev, 2), 0x4000); | ||
294 | if (board->basemem == NULL) { | 301 | if (board->basemem == NULL) { |
295 | dev_err(&pdev->dev, "can't remap io space 2\n"); | 302 | dev_err(&pdev->dev, "can't remap io space 2\n"); |
296 | goto err; | 303 | goto err_reg; |
297 | } | 304 | } |
298 | 305 | ||
299 | board->boardType = board_type; | 306 | board->boardType = board_type; |
@@ -315,6 +322,8 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev, | |||
315 | pci_set_drvdata(pdev, board); | 322 | pci_set_drvdata(pdev, board); |
316 | 323 | ||
317 | return (0); | 324 | return (0); |
325 | err_reg: | ||
326 | pci_release_region(pdev, 2); | ||
318 | err: | 327 | err: |
319 | return retval; | 328 | return retval; |
320 | } | 329 | } |
@@ -323,8 +332,9 @@ static void __devexit moxa_pci_remove(struct pci_dev *pdev) | |||
323 | { | 332 | { |
324 | struct moxa_board_conf *brd = pci_get_drvdata(pdev); | 333 | struct moxa_board_conf *brd = pci_get_drvdata(pdev); |
325 | 334 | ||
326 | pci_iounmap(pdev, brd->basemem); | 335 | iounmap(brd->basemem); |
327 | brd->basemem = NULL; | 336 | brd->basemem = NULL; |
337 | pci_release_region(pdev, 2); | ||
328 | } | 338 | } |
329 | 339 | ||
330 | static struct pci_driver moxa_pci_driver = { | 340 | static struct pci_driver moxa_pci_driver = { |