All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: Blue Swirl <blauwirbel@gmail.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] pci: fix pci_find_bus().
Date: Sun, 11 Apr 2010 13:51:29 +0300	[thread overview]
Message-ID: <20100411105129.GC8992@redhat.com> (raw)
In-Reply-To: <20100409234835.GA1232@valinux.co.jp>

On Sat, Apr 10, 2010 at 08:48:35AM +0900, Isaku Yamahata wrote:
> Oh I sent out the wrong one. This is the correct one.
> Sorry for noise.
> 
> >From 370c23c837070f78ca5715f032eacbf6747d42fb Mon Sep 17 00:00:00 2001
> Message-Id: <370c23c837070f78ca5715f032eacbf6747d42fb.1270856742.git.yamahata@valinux.co.jp>
> In-Reply-To: <cover.1270856742.git.yamahata@valinux.co.jp>
> References: <cover.1270856742.git.yamahata@valinux.co.jp>
> From: Isaku Yamahata <yamahata@valinux.co.jp>
> Date: Fri, 9 Apr 2010 19:09:35 +0900
> Subject: [PATCH] pci: fix pci_find_bus().
> 
> When looking down child bus, it should look parent bridge's
> bus number, not child bus's.
> 
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
>  hw/pci.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 0dbca17..b6e6bbe 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1556,10 +1556,10 @@ PCIBus *pci_find_bus(PCIBus *bus, int bus_num)
>      }
>  
>      /* try child bus */
> -    QLIST_FOREACH(sec, &bus->child, sibling) {
> -        if (!bus->parent_dev /* pci host bridge */
> -            || (pci_bus_num(sec) <= bus_num &&
> -                bus_num <= bus->parent_dev->config[PCI_SUBORDINATE_BUS]) ) {
> +    if (!bus->parent_dev /* pci host bridge */
> +        || (pci_bus_num(bus) <= bus_num &&

Better use PCI_SECONDARY_BUS here directly, we know parent_dev is
non-NULL.

> +            bus_num <= bus->parent_dev->config[PCI_SUBORDINATE_BUS])) {
> +        QLIST_FOREACH(sec, &bus->child, sibling) {
>              ret = pci_find_bus(sec, bus_num);
>              if (ret) {
>                  return ret;

What do you think about converting code to loop
as I suggested earlier?

> -- 
> 1.6.6.1
> 
> 
> -- 
> yamahata

  reply	other threads:[~2010-04-11 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 10:13 [Qemu-devel] [PATCH] pci: fix pci_find_bus() Isaku Yamahata
2010-04-09 23:48 ` [Qemu-devel] " Isaku Yamahata
2010-04-11 10:51   ` Michael S. Tsirkin [this message]
2010-04-12  2:58     ` [Qemu-devel] [PATCH v2] " Isaku Yamahata
2010-04-20 17:19       ` [Qemu-devel] " Blue Swirl
2010-04-11 10:46 ` [Qemu-devel] Re: [PATCH] " Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2010-02-08  6:38 [Qemu-devel] " Isaku Yamahata
2010-02-08 10:30 ` [Qemu-devel] " Michael S. Tsirkin

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=20100411105129.GC8992@redhat.com \
    --to=mst@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.