Patchwork [V2,11/20] pci: clean up of pci_init_wmask().

login
register
mail settings
Submitter Isaku Yamahata
Date Nov. 13, 2009, 4:29 a.m.
Message ID <1258086596-3584-12-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/38316/
State New
Headers show

Comments

Isaku Yamahata - Nov. 13, 2009, 4:29 a.m.
This patch replaces for loop by memset in pci_init_wmask().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 9c84cb2..2814c51 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -426,15 +426,15 @@  static void pci_init_cmask(PCIDevice *dev)
 
 static void pci_init_wmask(PCIDevice *dev)
 {
-    int i;
     int config_size = pci_config_size(dev);
 
     dev->wmask[PCI_CACHE_LINE_SIZE] = 0xff;
     dev->wmask[PCI_INTERRUPT_LINE] = 0xff;
     pci_set_word(dev->wmask + PCI_COMMAND,
                  PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
-    for (i = PCI_CONFIG_HEADER_SIZE; i < config_size; ++i)
-        dev->wmask[i] = 0xff;
+
+    memset(dev->wmask + PCI_CONFIG_HEADER_SIZE, 0xff,
+           config_size - PCI_CONFIG_HEADER_SIZE);
 }
 
 static void pci_init_wmask_bridge(PCIDevice *d)