linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ed Vance <EdV@macrolink.com>
To: "'linux-serial'" <linux-serial@vger.kernel.org>
Cc: "'linux-kernel'" <linux-kernel@vger.kernel.org>,
	"'Roman Kurakin'" <rik@cronyx.ru>,
	Russell King <rmk@arm.linux.org.uk>
Subject: RE: Serial.c BUG 2.4.x-2.5x
Date: Mon, 18 Mar 2002 16:16:57 -0800	[thread overview]
Message-ID: <11E89240C407D311958800A0C9ACF7D13A7717@EXCHANGE> (raw)

On Thu Mar 07, 2002, Roman Kurakin wrote:
> 
> On Wed Mar 06, 2002, Russell King wrote:
> >
> >The patch does fine for the most part, but I have two worries:
> >
> >1. the possibilities of pushing through changes in the IO or memory space
> >   by changing the other space at the same time. (ie, port = 1, iomem =
> >   0xfe007c00 and you already have a line at port = 0, iomem =
0xfe007c00).
> >   I dealt with this properly using the resource management subsystem.
> >
> I think such code could solve this problem ...
> 
> - 	    (rs_table[i].port == new_port) &&
> + 	    ((rs_table[i].port && rs_table[i].port == new_port) ||
> +	    ((rs_table[i].iomem_base && rs_table[i].iomem_base == new_mem))
&&

Indeed it would solve this problem, but I'm not sure there is a problem to
solve here. Have not found a case where ->port and ->iomem_base fields can
both be non-zero. If one of them is always zero then the previous patch hunk
in the "address in use" test at about line 2146 is well enough:

            if ((state != &rs_table[i]) &&
                (rs_table[i].port == new_port) &&
+               (rs_table[i].iomem_base == new_mem) &&
                rs_table[i].type)
                    return -EADDRINUSE;

Assuming one of the two fields is always zero, demanding both to match for
the in use condition works anyway. If the non-zero field matches, then they
both must match. The following hunk at the bottom of function get_pci_port()
at about line 3931 seems to guarantee that they start out this way:

	[[ The req struct is memset() to zero at about line 4009 in 
	  function start_pci_pnp_board(). ]]

        if (IS_PCI_REGION_IOPORT(dev, base_idx)) {
                req->port = port;
                if (HIGH_BITS_OFFSET)
                        req->port_high = port >> HIGH_BITS_OFFSET;
                else
                        req->port_high = 0;
                return 0;
        }
        req->io_type = SERIAL_IO_MEM;
        req->iomem_base = ioremap(port, board->uart_offset);
        req->iomem_reg_shift = board->reg_shift;
        req->port = 0;
        return 0;

Does anybody see a need to add the code anyway? Did I miss a lurker? 

Best to all,

---------------------------------------------------------------- 
Ed Vance              serial24@macrolink.com
Macrolink, Inc.       1500 N. Kellogg Dr  Anaheim, CA  92807
----------------------------------------------------------------


             reply	other threads:[~2002-03-19  0:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-19  0:16 Ed Vance [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-07 16:51 Serial.c BUG 2.4.x-2.5x Ed Vance
2002-03-01 19:07 Ed Vance
2002-03-06 20:39 ` Russell King
2002-03-07 13:53   ` Roman Kurakin
2002-03-01 12:18 Roman Kurakin

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=11E89240C407D311958800A0C9ACF7D13A7717@EXCHANGE \
    --to=edv@macrolink.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rik@cronyx.ru \
    --cc=rmk@arm.linux.org.uk \
    /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).