diff mbox

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

Message ID 1258005528-25383-12-git-send-email-yamahata@valinux.co.jp
State New
Headers show

Commit Message

Isaku Yamahata Nov. 12, 2009, 5:58 a.m. UTC
This patch replaces for loop by memset in pci_init_wmask().

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

Comments

Michael S. Tsirkin Nov. 12, 2009, 10:18 a.m. UTC | #1
On Thu, Nov 12, 2009 at 02:58:39PM +0900, Isaku Yamahata wrote:
> 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(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 67818b7..9698efb 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)
> -- 
> 1.6.0.2
diff mbox

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 67818b7..9698efb 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)