linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ed Vance <EdV@macrolink.com>
To: "'marcelo@conectiva.com.br'" <marcelo@conectiva.com.br>
Cc: "'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: [PATCH] serial.c 2.4.23 uart_offset fix
Date: Wed, 26 Nov 2003 17:28:57 -0800	[thread overview]
Message-ID: <11E89240C407D311958800A0C9ACF7D1A34053@EXCHANGE> (raw)

Hi Marcelo,

The serial driver has a default of 8 for the "board uart_offset" config that
is implemented at about line 3954 in a ternary expression.  It is well and
good for boards that use I/O port space, but fails in the ioremap call at
about line 3965 for boards that use memory space. The bug is that when
uart_offset is zero, it does not actually get changed to the default value,
so the ioremap call is passed a zero length.

The following patch replaces the ternary expression with an explicit check
for zero and assignment to the default value. This works for both I/O ports
and memory space.  --And it actually compiles a little smaller than the
existing code on x86! 

Please put this in at your convenience after the rc's are done. 

Thanks,
Ed

diff -urN -X dontdiff.txt linux-2.4.23-rc5/drivers/char/serial.c
linux-2.4.23-rc5-ml/drivers/char/serial.c
--- linux-2.4.23-rc5/drivers/char/serial.c	Wed Nov 26 16:23:45 2003
+++ linux-2.4.23-rc5-ml/drivers/char/serial.c	Wed Nov 26 16:38:13 2003
@@ -3950,8 +3950,11 @@
 
 	port =  pci_resource_start(dev, base_idx) + offset;
 
+	if (board->uart_offset == 0)
+		board->uart_offset = 8;
+
 	if ((board->flags & SPCI_FL_BASE_TABLE) == 0)
-		port += idx * (board->uart_offset ? board->uart_offset : 8);
+		port += idx * board->uart_offset;
 
 	if (IS_PCI_REGION_IOPORT(dev, base_idx)) {
 		req->port = port;


                 reply	other threads:[~2003-11-27  1:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=11E89240C407D311958800A0C9ACF7D1A34053@EXCHANGE \
    --to=edv@macrolink.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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).