linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: lsorense@csclub.uwaterloo.ca (Lennart Sorensen)
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: linux-serial@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: ioremap warning fix for jsm driver.
Date: Wed, 1 Jun 2011 16:29:26 -0400	[thread overview]
Message-ID: <20110601202926.GK21345@caffeine.csclub.uwaterloo.ca> (raw)
In-Reply-To: <20110601183841.GJ21345@caffeine.csclub.uwaterloo.ca>

On Wed, Jun 01, 2011 at 02:38:41PM -0400, Lennart Sorensen wrote:
> I saw a warning about ioremap from the jsm driver on a system which
> looked like this:
> 
> resource map sanity check conflict: 0xe0200800 0xe02017ff 0xe0200800 0xe0200fff 0000:01:08.0
> 
> Turns out the warning is valid.  The jsm driver has been asking to ioremap
> 0x1000 forever, but in fact only 8 port chips have 0x1000 bytes of memory.
> 4 port chips have 0x800 and 2 port chips have 0x400 according to the
> data sheet.  It makes more sense to map the size of the region rather
> than a hard coded value.  If you happen to have the regiong legitimately
> mapped to a base addres that is not 4K aligned, ioremap complains
> otherwise.

I can't believe I didn't spell check that. :(

Should have been:

Turns out the warning is valid.  The jsm driver has been asking to ioremap
0x1000 forever, but in fact only 8 port chips have 0x1000 bytes of memory.
4 port chips have 0x800 and 2 port chips have 0x400 according to the
data sheet.  It makes more sense to map the size of the region rather
than a hard coded value.  If you happen to have the region legitimately
mapped to a base address that is not 4K aligned ioremap complains, and
otherwise memory not belonging to the device is reserved as far as I
can tell.

> Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
> 
> 
> diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c
> index 18f5484..96da178 100644
> --- a/drivers/tty/serial/jsm/jsm_driver.c
> +++ b/drivers/tty/serial/jsm/jsm_driver.c
> @@ -125,7 +125,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device
>  	brd->bd_uart_offset = 0x200;
>  	brd->bd_dividend = 921600;
>  
> -	brd->re_map_membase = ioremap(brd->membase, 0x1000);
> +	brd->re_map_membase = ioremap(brd->membase, pci_resource_len(pdev, 0));
>  	if (!brd->re_map_membase) {
>  		dev_err(&pdev->dev,
>  			"card has no PCI Memory resources, "
> 
> 
> -- 
> Len Sorensen

      parent reply	other threads:[~2011-06-01 20:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 18:38 ioremap warning fix for jsm driver Lennart Sorensen
2011-06-01 19:32 ` Alan Cox
2011-06-01 20:29 ` Lennart Sorensen [this message]

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=20110601202926.GK21345@caffeine.csclub.uwaterloo.ca \
    --to=lsorense@csclub.uwaterloo.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@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;
as well as URLs for NNTP newsgroup(s).