Patchwork [2/2] versatile_pci: cleanup

login
register
mail settings
Submitter Michael S. Tsirkin
Date Feb. 8, 2010, 9:43 p.m.
Message ID <20100208214308.GC28285@redhat.com>
Download mbox | patch
Permalink /patch/44865/
State New
Headers show

Comments

Michael S. Tsirkin - Feb. 8, 2010, 9:43 p.m.
Cleanup versatile_pci: no need to re-set fields
to zero (pci core sets 0 already), use set_word
for status field. Compile-tested only, but seems obvious.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/versatile_pci.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
Anthony Liguori - Feb. 10, 2010, 7:43 p.m.
On 02/08/2010 03:43 PM, Michael S. Tsirkin wrote:
> Cleanup versatile_pci: no need to re-set fields
> to zero (pci core sets 0 already), use set_word
> for status field. Compile-tested only, but seems obvious.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
>    

Acked-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori
> ---
>   hw/versatile_pci.c |   11 ++---------
>   1 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
> index e58b7f4..7f79348 100644
> --- a/hw/versatile_pci.c
> +++ b/hw/versatile_pci.c
> @@ -147,15 +147,8 @@ static int versatile_pci_host_init(PCIDevice *d)
>       pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
>       /* Both boards have the same device ID.  Oh well.  */
>       pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
> -    /* TODO: no need to clear command */
> -    pci_set_byte(d->config + PCI_COMMAND, 0x00);
> -    pci_set_byte(d->config + PCI_COMMAND + 1, 0x00);
> -    /* TODO: convert to set_word */
> -    pci_set_byte(d->config + PCI_STATUS, PCI_STATUS_66MHZ);
> -    pci_set_byte(d->config + PCI_STATUS + 1, PCI_STATUS_DEVSEL_MEDIUM>>  8);
> -    /* TODO: no need to clear revision/prog ifc */
> -    pci_set_byte(d->config + PCI_REVISION_ID, 0x00);
> -    pci_set_byte(d->config + PCI_CLASS_PROG, 0x00);
> +    pci_set_word(d->config + PCI_STATUS,
> +		 PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM);
>       pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
>       pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
>       return 0;
>

Patch

diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index e58b7f4..7f79348 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -147,15 +147,8 @@  static int versatile_pci_host_init(PCIDevice *d)
     pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
     /* Both boards have the same device ID.  Oh well.  */
     pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
-    /* TODO: no need to clear command */
-    pci_set_byte(d->config + PCI_COMMAND, 0x00);
-    pci_set_byte(d->config + PCI_COMMAND + 1, 0x00);
-    /* TODO: convert to set_word */
-    pci_set_byte(d->config + PCI_STATUS, PCI_STATUS_66MHZ);
-    pci_set_byte(d->config + PCI_STATUS + 1, PCI_STATUS_DEVSEL_MEDIUM >> 8);
-    /* TODO: no need to clear revision/prog ifc */
-    pci_set_byte(d->config + PCI_REVISION_ID, 0x00);
-    pci_set_byte(d->config + PCI_CLASS_PROG, 0x00);
+    pci_set_word(d->config + PCI_STATUS,
+		 PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM);
     pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_CO);
     pci_set_byte(d->config + PCI_LATENCY_TIMER, 0x10);
     return 0;