All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org, anthony@codemonkey.ws, yamahata@valinux.co.jp
Subject: [Qemu-devel] [PATCH 1/4] pci: rearrange code for interrupts
Date: Wed, 25 Nov 2009 18:58:46 +0200	[thread overview]
Message-ID: <20091125165846.GB24783@redhat.com> (raw)
In-Reply-To: <cover.1259168040.git.mst@redhat.com>

Rearranges code slightly in preparation
for interrupt status and interrupt
disable support: split actual irq change
from irq_state management.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pci.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 0359f30..5ff0d46 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -880,18 +880,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
 /***********************************************************/
 /* generic PCI irq support */
 
-/* 0 <= irq_num <= 3. level must be 0 or 1 */
-static void pci_set_irq(void *opaque, int irq_num, int level)
+static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change)
 {
-    PCIDevice *pci_dev = opaque;
     PCIBus *bus;
-    int change;
-
-    change = level - pci_dev->irq_state[irq_num];
-    if (!change)
-        return;
-
-    pci_dev->irq_state[irq_num] = level;
     for (;;) {
         bus = pci_dev->bus;
         irq_num = bus->map_irq(pci_dev, irq_num);
@@ -903,6 +894,21 @@ static void pci_set_irq(void *opaque, int irq_num, int level)
     bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0);
 }
 
+
+/* 0 <= irq_num <= 3. level must be 0 or 1 */
+static void pci_set_irq(void *opaque, int irq_num, int level)
+{
+    PCIDevice *pci_dev = opaque;
+    int change;
+
+    change = level - pci_dev->irq_state[irq_num];
+    if (!change)
+        return;
+
+    pci_dev->irq_state[irq_num] = level;
+    pci_change_irq_level(pci_dev, irq_num, change);
+}
+
 /***********************************************************/
 /* monitor info on PCI */
 
-- 
1.6.5.2.143.g8cc62

       reply	other threads:[~2009-11-25 17:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1259168040.git.mst@redhat.com>
2009-11-25 16:58 ` Michael S. Tsirkin [this message]
2009-11-25 16:58 ` [Qemu-devel] [PATCH 2/4] pci: track IRQ status Michael S. Tsirkin
2009-11-25 16:58 ` [Qemu-devel] [PATCH 3/4] pci: interrupt status bit implementation Michael S. Tsirkin
2009-11-25 16:59 ` [Qemu-devel] [PATCH 4/4] pci: interrupt disable bit support Michael S. Tsirkin
2009-11-26  3:04   ` [Qemu-devel] " Isaku Yamahata
2009-11-26  9:53     ` Michael S. Tsirkin
2009-11-26 12:38       ` Michael S. Tsirkin
2009-11-26 13:21     ` 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=20091125165846.GB24783@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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.