Patchwork PCI Using macro definition instead of a simple digit

login
register
mail settings
Submitter Wanpeng Li
Date March 3, 2012, 12:38 p.m.
Message ID <1330778322-30749-1-git-send-email-liwp@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/144435/
State New
Headers show

Comments

Wanpeng Li - March 3, 2012, 12:38 p.m.
PCI_CLASS_DISPLAY_VGA has already defined in hw/pci_ids.h, so use the
macro definition instead of a simple digit.

Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
---
 hw/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Andreas Färber - March 3, 2012, 7:48 p.m.
Am 03.03.2012 13:38, schrieb Wanpeng Li:
> PCI_CLASS_DISPLAY_VGA has already defined in hw/pci_ids.h, so use the
> macro definition instead of a simple digit.
> 
> Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>

Number matches,

Acked-by: Andreas Färber <afaerber@suse.de>

Cc'ing mst.

There's probably much more uses of magic number in the individual PCI
devices, host controllers and bridges.

Andreas

> ---
>  hw/pci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index fe71666..274d86d 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1784,7 +1784,7 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
>           * for 0.11 compatibility.
>           */
>          int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
> -        if (class == 0x0300) {
> +        if (class == PCI_CLASS_DISPLAY_VGA) {
>              rom_add_vga(pdev->romfile);
>          } else {
>              rom_add_option(pdev->romfile, -1);

Patch

diff --git a/hw/pci.c b/hw/pci.c
index fe71666..274d86d 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1784,7 +1784,7 @@  static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
          * for 0.11 compatibility.
          */
         int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
-        if (class == 0x0300) {
+        if (class == PCI_CLASS_DISPLAY_VGA) {
             rom_add_vga(pdev->romfile);
         } else {
             rom_add_option(pdev->romfile, -1);