[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1203691606-9310-3-git-send-email-jirislaby@gmail.com>
Date: Fri, 22 Feb 2008 15:46:30 +0100
From: Jiri Slaby <jirislaby@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: <linux-kernel@...r.kernel.org>, <alan@...rguk.ukuu.org.uk>,
Oyvind Aabling <Oyvind.Aabling@...-c.dk>,
Jiri Slaby <jirislaby@...il.com>
Subject: [PATCH 03/19] 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@...il.com>
Tested-by: Oyvind Aabling <Oyvind.Aabling@...-c.dk>
---
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 2701f7c..f841b1f 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,
}
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) {
dev_err(&pdev->dev, "can't remap io space 2\n");
- goto err;
+ goto err_reg;
}
board->boardType = board_type;
@@ -315,6 +322,8 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, board);
return (0);
+err_reg:
+ pci_release_region(pdev, 2);
err:
return retval;
}
@@ -323,8 +332,9 @@ static void __devexit moxa_pci_remove(struct pci_dev *pdev)
{
struct moxa_board_conf *brd = pci_get_drvdata(pdev);
- pci_iounmap(pdev, brd->basemem);
+ iounmap(brd->basemem);
brd->basemem = NULL;
+ pci_release_region(pdev, 2);
}
static struct pci_driver moxa_pci_driver = {
--
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists