linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Assumption in drivers/char/serial.c
@ 1999-07-13 11:03 Adrian Cox
  0 siblings, 0 replies; only message in thread
From: Adrian Cox @ 1999-07-13 11:03 UTC (permalink / raw)
  To: LinuxPPC-Dev


While porting Linux to my embedded system, I've come across an
unfortunate assumption in the standard serial driver. The change_speed
routine casts the  port address of the uart from an int to a unsigned
short, then compares it to zero. This means that the uart code will not
work on systems where the uart is mapped with a 64K alignment. As my
uart is not on an ISA bus, it isn't within the ISA address range. In
fact, my uart is at an IO address of 128k.

The patch below (against 2.2.10 from the CVS) compares all 32-bits of
the uart address with zero, instead of just the least significant 16.
Can anybody think of any systems where the uart being at a 64k aligned
address is a significant error condition (and if so, isn't change_speed
a bit late to detect it)?

- Adrian Cox, AG Electronics

--- linuxppc-2.2.10/drivers/char/serial.c       Wed Mar 24 01:01:17 1999
+++ linux/drivers/char/serial.c Tue Jul 13 11:41:41 1999
@@ -1236,7 +1236,6 @@
 static void change_speed(struct async_struct *info,
                         struct termios *old_termios)
 {
-       unsigned short port;
        int     quot = 0, baud_base, baud;
        unsigned cflag, cval, fcr = 0;
        int     bits;
@@ -1245,7 +1244,7 @@
        if (!info->tty || !info->tty->termios)
                return;
        cflag = info->tty->termios->c_cflag;
-       if (!(port = info->port))
+        if (! info->port)
                return;

        /* byte size and parity */

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-07-13 11:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-07-13 11:03 Assumption in drivers/char/serial.c Adrian Cox

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