qtest/ahci: Store hba_base in AHCIQState
commit6100ddb0f9776555b581455be4707f2077eee42f
authorJohn Snow <jsnow@redhat.com>
Mon, 19 Jan 2015 20:15:56 +0000 (19 15:15 -0500)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 16 Feb 2015 14:40:55 +0000 (16 14:40 +0000)
treea8004df8fffcc639ba45590a6726c77aa33c3850
parent90e5add6f2fa0b0bd9a4c1d5a4de2304b5f3e466
qtest/ahci: Store hba_base in AHCIQState

Store the HBA memory base address in the new state object, to simplify
function prototypes and encourage a more functional testing style.

This causes a lot of churn, but this patch is as "simplified" as I could
get it to be. This patch is therefore fairly mechanical and straightforward:
Any case where we pass "hba_base" has been consolidated into the AHCIQState
object and we pass the one unified parameter.

Any case where we reference "ahci" and "hba_state" have been modified to use
"ahci->dev" for the PCIDevice and "ahci->hba_state" to get at the base memory
address, accordingly.

Notes:

 - A needless return is removed from start_ahci_device.

 - For ease of reviewing, this patch can be reproduced (mostly) by:
   # Replace (ahci, hba_base) prototypes with unified parameter
   's/(QPCIDevice \*ahci, void \*\?\*hba_base/(AHCIQState *ahci/'

   # Replace (ahci->dev, hba_base) calls with unified parameter
   's/(ahci->dev, &\?hba_base)/(ahci)/'

   # Replace calls to PCI config space using "ahci" with "ahci->dev"
   's/qpci_config_\(read\|write\)\(.\)(ahci,/qpci_config_\1\2(ahci->dev,/'

   After these, the remaining differences are easy to review by hand.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1421698563-6977-9-git-send-email-jsnow@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
tests/ahci-test.c
tests/libqos/ahci.h