Patchwork [5/8] pci: make external dependencies explicit

login
register
mail settings
Submitter Michael S. Tsirkin
Date Dec. 12, 2012, 1:14 p.m.
Message ID <8880d93a99c99d1162db75f564f459efe050dd90.1355318011.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/205510/
State New
Headers show

Comments

Michael S. Tsirkin - Dec. 12, 2012, 1:14 p.m.
Include dependencies from pci core using <> and
the correct path.
Need to check whether they can be minimized, for now,
at least make them explicit.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pci/msix.c        |  4 ++--
 hw/pci/pci-hotplug.c | 20 ++++++++++----------
 hw/pci/pci.c         | 16 ++++++++--------
 hw/pci/pci.h         | 10 +++++-----
 hw/pci/pci_host.h    |  2 +-
 hw/pci/pcie.h        |  2 +-
 hw/pci/pcie_aer.h    |  2 +-
 hw/pci/pcie_host.c   |  4 ++--
 8 files changed, 30 insertions(+), 30 deletions(-)
Blue Swirl - Dec. 12, 2012, 7:49 p.m.
On Wed, Dec 12, 2012 at 1:14 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> Include dependencies from pci core using <> and

Nack, the usual convention is to use <> for system headers like
<stdio.h> and "" for local headers.

For example with MSVC the search path for angle brackets does not even
include the local directory:
http://msdn.microsoft.com/en-us/library/36k2cdd4%28v=vs.80%29.aspx

> the correct path.
> Need to check whether they can be minimized, for now,
> at least make them explicit.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/pci/msix.c        |  4 ++--
>  hw/pci/pci-hotplug.c | 20 ++++++++++----------
>  hw/pci/pci.c         | 16 ++++++++--------
>  hw/pci/pci.h         | 10 +++++-----
>  hw/pci/pci_host.h    |  2 +-
>  hw/pci/pcie.h        |  2 +-
>  hw/pci/pcie_aer.h    |  2 +-
>  hw/pci/pcie_host.c   |  4 ++--
>  8 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> index 136ef09..ec35a5d 100644
> --- a/hw/pci/msix.c
> +++ b/hw/pci/msix.c
> @@ -14,11 +14,11 @@
>   * GNU GPL, version 2 or (at your option) any later version.
>   */
>
> -#include "hw.h"
> +#include <hw/hw.h>
>  #include "msi.h"
>  #include "msix.h"
>  #include "pci.h"
> -#include "range.h"
> +#include <range.h>
>
>  #define MSIX_CAP_LENGTH 12
>
> diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c
> index 0ca5546..32ba449 100644
> --- a/hw/pci/pci-hotplug.c
> +++ b/hw/pci/pci-hotplug.c
> @@ -22,17 +22,17 @@
>   * THE SOFTWARE.
>   */
>
> -#include "hw.h"
> -#include "boards.h"
> +#include <hw/hw.h>
> +#include <hw/boards.h>
>  #include "pci.h"
> -#include "net.h"
> -#include "pc.h"
> -#include "monitor.h"
> -#include "scsi.h"
> -#include "virtio-blk.h"
> -#include "qemu-config.h"
> -#include "blockdev.h"
> -#include "error.h"
> +#include <net.h>
> +#include <hw/pc.h>
> +#include <monitor.h>
> +#include <hw/scsi.h>
> +#include <hw/virtio-blk.h>
> +#include <qemu-config.h>
> +#include <blockdev.h>
> +#include <error.h>
>
>  #if defined(TARGET_I386)
>  static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 97a0cd7..6023ded 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -21,19 +21,19 @@
>   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
>   * THE SOFTWARE.
>   */
> -#include "hw.h"
> +#include <hw/hw.h>
>  #include "pci.h"
>  #include "pci_bridge.h"
>  #include "pci_internals.h"
> -#include "monitor.h"
> -#include "net.h"
> -#include "sysemu.h"
> -#include "loader.h"
> -#include "range.h"
> -#include "qmp-commands.h"
> +#include <monitor.h>
> +#include <net.h>
> +#include <sysemu.h>
> +#include <hw/loader.h>
> +#include <range.h>
> +#include <qmp-commands.h>
>  #include "msi.h"
>  #include "msix.h"
> -#include "exec-memory.h"
> +#include <exec-memory.h>
>
>  //#define DEBUG_PCI
>  #ifdef DEBUG_PCI
> diff --git a/hw/pci/pci.h b/hw/pci/pci.h
> index 4da0c2a..b517995 100644
> --- a/hw/pci/pci.h
> +++ b/hw/pci/pci.h
> @@ -1,14 +1,14 @@
>  #ifndef QEMU_PCI_H
>  #define QEMU_PCI_H
>
> -#include "qemu-common.h"
> +#include <qemu-common.h>
>
> -#include "qdev.h"
> -#include "memory.h"
> -#include "dma.h"
> +#include <hw/qdev.h>
> +#include <memory.h>
> +#include <dma.h>
>
>  /* PCI includes legacy ISA access.  */
> -#include "isa.h"
> +#include <hw/isa.h>
>
>  #include "pcie.h"
>
> diff --git a/hw/pci/pci_host.h b/hw/pci/pci_host.h
> index 4b9c300..6dfb38d 100644
> --- a/hw/pci/pci_host.h
> +++ b/hw/pci/pci_host.h
> @@ -28,7 +28,7 @@
>  #ifndef PCI_HOST_H
>  #define PCI_HOST_H
>
> -#include "sysbus.h"
> +#include <hw/sysbus.h>
>
>  #define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
>  #define PCI_HOST_BRIDGE(obj) \
> diff --git a/hw/pci/pcie.h b/hw/pci/pcie.h
> index 4889194..cc1f2c5 100644
> --- a/hw/pci/pcie.h
> +++ b/hw/pci/pcie.h
> @@ -21,7 +21,7 @@
>  #ifndef QEMU_PCIE_H
>  #define QEMU_PCIE_H
>
> -#include "hw.h"
> +#include <hw/hw.h>
>  #include "pci_regs.h"
>  #include "pcie_regs.h"
>  #include "pcie_aer.h"
> diff --git a/hw/pci/pcie_aer.h b/hw/pci/pcie_aer.h
> index 7539500..406a736 100644
> --- a/hw/pci/pcie_aer.h
> +++ b/hw/pci/pcie_aer.h
> @@ -21,7 +21,7 @@
>  #ifndef QEMU_PCIE_AER_H
>  #define QEMU_PCIE_AER_H
>
> -#include "hw.h"
> +#include <hw/hw.h>
>
>  /* definitions which PCIExpressDevice uses */
>
> diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
> index c257fb4..4453cb0 100644
> --- a/hw/pci/pcie_host.c
> +++ b/hw/pci/pcie_host.c
> @@ -19,10 +19,10 @@
>   * with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
>
> -#include "hw.h"
> +#include <hw/hw.h>
>  #include "pci.h"
>  #include "pcie_host.h"
> -#include "exec-memory.h"
> +#include <exec-memory.h>
>
>  /*
>   * PCI express mmcfig address
> --
> MST
>
>
Michael S. Tsirkin - Dec. 12, 2012, 8:53 p.m.
On Wed, Dec 12, 2012 at 07:49:35PM +0000, Blue Swirl wrote:
> On Wed, Dec 12, 2012 at 1:14 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > Include dependencies from pci core using <> and
> 
> Nack, the usual convention is to use <> for system headers like
> <stdio.h> and "" for local headers.
> 
> For example with MSVC the search path for angle brackets does not even
> include the local directory:
> http://msdn.microsoft.com/en-us/library/36k2cdd4%28v=vs.80%29.aspx

This convention is non standard:
When hw/pci/pci.h includes hw/hw.h the lookup
that succeeds is not from the current
directory - it's from the -I search path.
So "" simply slows the preprocessor down and
increases chances of picking the wrong header,
for no real benefit.

Oh well another qemu coding style eccentricity.
I'll change them to "".

> > the correct path.
> > Need to check whether they can be minimized, for now,
> > at least make them explicit.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  hw/pci/msix.c        |  4 ++--
> >  hw/pci/pci-hotplug.c | 20 ++++++++++----------
> >  hw/pci/pci.c         | 16 ++++++++--------
> >  hw/pci/pci.h         | 10 +++++-----
> >  hw/pci/pci_host.h    |  2 +-
> >  hw/pci/pcie.h        |  2 +-
> >  hw/pci/pcie_aer.h    |  2 +-
> >  hw/pci/pcie_host.c   |  4 ++--
> >  8 files changed, 30 insertions(+), 30 deletions(-)
> >
> > diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> > index 136ef09..ec35a5d 100644
> > --- a/hw/pci/msix.c
> > +++ b/hw/pci/msix.c
> > @@ -14,11 +14,11 @@
> >   * GNU GPL, version 2 or (at your option) any later version.
> >   */
> >
> > -#include "hw.h"
> > +#include <hw/hw.h>
> >  #include "msi.h"
> >  #include "msix.h"
> >  #include "pci.h"
> > -#include "range.h"
> > +#include <range.h>
> >
> >  #define MSIX_CAP_LENGTH 12
> >
> > diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c
> > index 0ca5546..32ba449 100644
> > --- a/hw/pci/pci-hotplug.c
> > +++ b/hw/pci/pci-hotplug.c
> > @@ -22,17 +22,17 @@
> >   * THE SOFTWARE.
> >   */
> >
> > -#include "hw.h"
> > -#include "boards.h"
> > +#include <hw/hw.h>
> > +#include <hw/boards.h>
> >  #include "pci.h"
> > -#include "net.h"
> > -#include "pc.h"
> > -#include "monitor.h"
> > -#include "scsi.h"
> > -#include "virtio-blk.h"
> > -#include "qemu-config.h"
> > -#include "blockdev.h"
> > -#include "error.h"
> > +#include <net.h>
> > +#include <hw/pc.h>
> > +#include <monitor.h>
> > +#include <hw/scsi.h>
> > +#include <hw/virtio-blk.h>
> > +#include <qemu-config.h>
> > +#include <blockdev.h>
> > +#include <error.h>
> >
> >  #if defined(TARGET_I386)
> >  static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
> > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > index 97a0cd7..6023ded 100644
> > --- a/hw/pci/pci.c
> > +++ b/hw/pci/pci.c
> > @@ -21,19 +21,19 @@
> >   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> >   * THE SOFTWARE.
> >   */
> > -#include "hw.h"
> > +#include <hw/hw.h>
> >  #include "pci.h"
> >  #include "pci_bridge.h"
> >  #include "pci_internals.h"
> > -#include "monitor.h"
> > -#include "net.h"
> > -#include "sysemu.h"
> > -#include "loader.h"
> > -#include "range.h"
> > -#include "qmp-commands.h"
> > +#include <monitor.h>
> > +#include <net.h>
> > +#include <sysemu.h>
> > +#include <hw/loader.h>
> > +#include <range.h>
> > +#include <qmp-commands.h>
> >  #include "msi.h"
> >  #include "msix.h"
> > -#include "exec-memory.h"
> > +#include <exec-memory.h>
> >
> >  //#define DEBUG_PCI
> >  #ifdef DEBUG_PCI
> > diff --git a/hw/pci/pci.h b/hw/pci/pci.h
> > index 4da0c2a..b517995 100644
> > --- a/hw/pci/pci.h
> > +++ b/hw/pci/pci.h
> > @@ -1,14 +1,14 @@
> >  #ifndef QEMU_PCI_H
> >  #define QEMU_PCI_H
> >
> > -#include "qemu-common.h"
> > +#include <qemu-common.h>
> >
> > -#include "qdev.h"
> > -#include "memory.h"
> > -#include "dma.h"
> > +#include <hw/qdev.h>
> > +#include <memory.h>
> > +#include <dma.h>
> >
> >  /* PCI includes legacy ISA access.  */
> > -#include "isa.h"
> > +#include <hw/isa.h>
> >
> >  #include "pcie.h"
> >
> > diff --git a/hw/pci/pci_host.h b/hw/pci/pci_host.h
> > index 4b9c300..6dfb38d 100644
> > --- a/hw/pci/pci_host.h
> > +++ b/hw/pci/pci_host.h
> > @@ -28,7 +28,7 @@
> >  #ifndef PCI_HOST_H
> >  #define PCI_HOST_H
> >
> > -#include "sysbus.h"
> > +#include <hw/sysbus.h>
> >
> >  #define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
> >  #define PCI_HOST_BRIDGE(obj) \
> > diff --git a/hw/pci/pcie.h b/hw/pci/pcie.h
> > index 4889194..cc1f2c5 100644
> > --- a/hw/pci/pcie.h
> > +++ b/hw/pci/pcie.h
> > @@ -21,7 +21,7 @@
> >  #ifndef QEMU_PCIE_H
> >  #define QEMU_PCIE_H
> >
> > -#include "hw.h"
> > +#include <hw/hw.h>
> >  #include "pci_regs.h"
> >  #include "pcie_regs.h"
> >  #include "pcie_aer.h"
> > diff --git a/hw/pci/pcie_aer.h b/hw/pci/pcie_aer.h
> > index 7539500..406a736 100644
> > --- a/hw/pci/pcie_aer.h
> > +++ b/hw/pci/pcie_aer.h
> > @@ -21,7 +21,7 @@
> >  #ifndef QEMU_PCIE_AER_H
> >  #define QEMU_PCIE_AER_H
> >
> > -#include "hw.h"
> > +#include <hw/hw.h>
> >
> >  /* definitions which PCIExpressDevice uses */
> >
> > diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
> > index c257fb4..4453cb0 100644
> > --- a/hw/pci/pcie_host.c
> > +++ b/hw/pci/pcie_host.c
> > @@ -19,10 +19,10 @@
> >   * with this program; if not, see <http://www.gnu.org/licenses/>.
> >   */
> >
> > -#include "hw.h"
> > +#include <hw/hw.h>
> >  #include "pci.h"
> >  #include "pcie_host.h"
> > -#include "exec-memory.h"
> > +#include <exec-memory.h>
> >
> >  /*
> >   * PCI express mmcfig address
> > --
> > MST
> >
> >

Patch

diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 136ef09..ec35a5d 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -14,11 +14,11 @@ 
  * GNU GPL, version 2 or (at your option) any later version.
  */
 
-#include "hw.h"
+#include <hw/hw.h>
 #include "msi.h"
 #include "msix.h"
 #include "pci.h"
-#include "range.h"
+#include <range.h>
 
 #define MSIX_CAP_LENGTH 12
 
diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c
index 0ca5546..32ba449 100644
--- a/hw/pci/pci-hotplug.c
+++ b/hw/pci/pci-hotplug.c
@@ -22,17 +22,17 @@ 
  * THE SOFTWARE.
  */
 
-#include "hw.h"
-#include "boards.h"
+#include <hw/hw.h>
+#include <hw/boards.h>
 #include "pci.h"
-#include "net.h"
-#include "pc.h"
-#include "monitor.h"
-#include "scsi.h"
-#include "virtio-blk.h"
-#include "qemu-config.h"
-#include "blockdev.h"
-#include "error.h"
+#include <net.h>
+#include <hw/pc.h>
+#include <monitor.h>
+#include <hw/scsi.h>
+#include <hw/virtio-blk.h>
+#include <qemu-config.h>
+#include <blockdev.h>
+#include <error.h>
 
 #if defined(TARGET_I386)
 static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 97a0cd7..6023ded 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -21,19 +21,19 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw.h"
+#include <hw/hw.h>
 #include "pci.h"
 #include "pci_bridge.h"
 #include "pci_internals.h"
-#include "monitor.h"
-#include "net.h"
-#include "sysemu.h"
-#include "loader.h"
-#include "range.h"
-#include "qmp-commands.h"
+#include <monitor.h>
+#include <net.h>
+#include <sysemu.h>
+#include <hw/loader.h>
+#include <range.h>
+#include <qmp-commands.h>
 #include "msi.h"
 #include "msix.h"
-#include "exec-memory.h"
+#include <exec-memory.h>
 
 //#define DEBUG_PCI
 #ifdef DEBUG_PCI
diff --git a/hw/pci/pci.h b/hw/pci/pci.h
index 4da0c2a..b517995 100644
--- a/hw/pci/pci.h
+++ b/hw/pci/pci.h
@@ -1,14 +1,14 @@ 
 #ifndef QEMU_PCI_H
 #define QEMU_PCI_H
 
-#include "qemu-common.h"
+#include <qemu-common.h>
 
-#include "qdev.h"
-#include "memory.h"
-#include "dma.h"
+#include <hw/qdev.h>
+#include <memory.h>
+#include <dma.h>
 
 /* PCI includes legacy ISA access.  */
-#include "isa.h"
+#include <hw/isa.h>
 
 #include "pcie.h"
 
diff --git a/hw/pci/pci_host.h b/hw/pci/pci_host.h
index 4b9c300..6dfb38d 100644
--- a/hw/pci/pci_host.h
+++ b/hw/pci/pci_host.h
@@ -28,7 +28,7 @@ 
 #ifndef PCI_HOST_H
 #define PCI_HOST_H
 
-#include "sysbus.h"
+#include <hw/sysbus.h>
 
 #define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
 #define PCI_HOST_BRIDGE(obj) \
diff --git a/hw/pci/pcie.h b/hw/pci/pcie.h
index 4889194..cc1f2c5 100644
--- a/hw/pci/pcie.h
+++ b/hw/pci/pcie.h
@@ -21,7 +21,7 @@ 
 #ifndef QEMU_PCIE_H
 #define QEMU_PCIE_H
 
-#include "hw.h"
+#include <hw/hw.h>
 #include "pci_regs.h"
 #include "pcie_regs.h"
 #include "pcie_aer.h"
diff --git a/hw/pci/pcie_aer.h b/hw/pci/pcie_aer.h
index 7539500..406a736 100644
--- a/hw/pci/pcie_aer.h
+++ b/hw/pci/pcie_aer.h
@@ -21,7 +21,7 @@ 
 #ifndef QEMU_PCIE_AER_H
 #define QEMU_PCIE_AER_H
 
-#include "hw.h"
+#include <hw/hw.h>
 
 /* definitions which PCIExpressDevice uses */
 
diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
index c257fb4..4453cb0 100644
--- a/hw/pci/pcie_host.c
+++ b/hw/pci/pcie_host.c
@@ -19,10 +19,10 @@ 
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "hw.h"
+#include <hw/hw.h>
 #include "pci.h"
 #include "pcie_host.h"
-#include "exec-memory.h"
+#include <exec-memory.h>
 
 /*
  * PCI express mmcfig address