From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdgJH-0001Gm-Ce for qemu-devel@nongnu.org; Sun, 10 Jun 2012 07:27:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdgJE-0004jc-3I for qemu-devel@nongnu.org; Sun, 10 Jun 2012 07:27:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdgJD-0004jI-Rl for qemu-devel@nongnu.org; Sun, 10 Jun 2012 07:27:52 -0400 Date: Sun, 10 Jun 2012 14:28:20 +0300 From: "Michael S. Tsirkin" Message-ID: <20120610112819.GM6250@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 01/13] pci: Refactor pci_change_irq_level List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Alex Williamson , qemu-devel On Mon, Jun 04, 2012 at 10:52:09AM +0200, Jan Kiszka wrote: > Align the bus traversal in pci_change_irq_level to other functions. They > use PCIBus:parent_dev to detect the root. > > Signed-off-by: Jan Kiszka Applied. > --- > hw/pci.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/pci.c b/hw/pci.c > index c1ebdde..893f89c 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -115,13 +115,13 @@ static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) > static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change) > { > PCIBus *bus; > - for (;;) { > + > + do { > bus = pci_dev->bus; > irq_num = bus->map_irq(pci_dev, irq_num); > - if (bus->set_irq) > - break; > pci_dev = bus->parent_dev; > - } > + } while (pci_dev); > + > bus->irq_count[irq_num] += change; > bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0); > } > -- > 1.7.3.4