mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>, <alan@lxorguk.ukuu.org.uk>,
	Oyvind Aabling <Oyvind.Aabling@uni-c.dk>,
	Jiri Slaby <jirislaby@gmail.com>
Subject: [PATCH 03/19] Char: moxa, pci io space fixup
Date: Fri, 22 Feb 2008 15:46:30 +0100	[thread overview]
Message-ID: <1203691606-9310-3-git-send-email-jirislaby@gmail.com> (raw)
In-Reply-To: <1203691606-9310-1-git-send-email-jirislaby@gmail.com>

- 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>
---
 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


  parent reply	other threads:[~2008-02-22 14:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 14:46 [PATCH 01/19] Char: moxa, remove static isa support Jiri Slaby
2008-02-22 14:46 ` [PATCH 02/19] Char: moxa, cleanup module-param passed isa init Jiri Slaby
2008-02-22 14:46 ` Jiri Slaby [this message]
2008-02-22 14:46 ` [PATCH 04/19] Char: moxa, fix TIOC(G/S)SOFTCAR param Jiri Slaby
2008-02-22 14:46 ` [PATCH 05/19] Char: moxa, add firmware loading Jiri Slaby
2008-02-22 14:46 ` [PATCH 06/19] Char: moxa, merge c2xx and c320 " Jiri Slaby
2008-02-22 14:46 ` [PATCH 07/19] Char: moxa, remove port->port Jiri Slaby
2008-02-22 14:46 ` [PATCH 08/19] Char: moxa, remove unused port entries Jiri Slaby
2008-02-22 14:46 ` [PATCH 09/19] Char: moxa, centralize board readiness Jiri Slaby
2008-02-22 14:46 ` [PATCH 10/19] Char: moxa, timer cleanup Jiri Slaby
2008-02-22 14:46 ` [PATCH 11/19] Char: moxa, ioctl cleanup Jiri Slaby
2008-02-22 14:46 ` [PATCH 12/19] Char: moxa, merge 2 poll functions Jiri Slaby
2008-02-22 14:46 ` [PATCH 13/19] Char: moxa, cleanup rx/tx Jiri Slaby
2008-02-22 14:46 ` [PATCH 14/19] Char: moxa, serialise timer Jiri Slaby
2008-02-22 14:46 ` [PATCH 15/19] Char: moxa, rework open/close Jiri Slaby
2008-02-22 14:46 ` [PATCH 16/19] Char: moxa, little cleanup Jiri Slaby
2008-02-22 14:46 ` [PATCH 17/19] Char: moxa, remove useless tty functions Jiri Slaby
2008-02-22 14:46 ` [PATCH 18/19] Char: moxa, introduce MOXA_IS_320 macro Jiri Slaby
2008-02-22 14:46 ` [PATCH 19/19] Char: moxa, notify about board readiness Jiri Slaby
2008-02-22 20:09 ` [PATCH 20/21] Char: moxa, update credits Jiri Slaby
2008-02-22 20:09 ` [PATCH 21/21] Char: moxa, add firmware loading fix Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1203691606-9310-3-git-send-email-jirislaby@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=Oyvind.Aabling@uni-c.dk \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome