Skip to contentSkip to conversation

hw: Do not include hw/sysbus.h if it is not necessary

PATCH Applied Thomas Huth 3 participants 6 messages Mar 27, 2021 – Apr 30, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw: Do not include hw/sysbus.h if it is not necessary

Many files include hw/sysbus.h without needing it. Remove the superfluous include statements.

---
 hw/arm/cubieboard.c         | 1 -
 hw/arm/orangepi.c           | 1 -
 hw/char/riscv_htif.c        | 1 -
 hw/char/sifive_uart.c       | 1 -
 hw/char/virtio-serial-bus.c | 1 -
 hw/core/generic-loader.c    | 1 -
 hw/core/guest-loader.c      | 1 -
 hw/ide/ahci_internal.h      | 1 -
 hw/input/lasips2.c          | 1 -
 hw/intc/arm_gic_kvm.c       | 1 -
 hw/intc/arm_gicv3.c         | 1 -
 hw/intc/arm_gicv3_kvm.c     | 1 -
 hw/intc/s390_flic_kvm.c     | 1 -
 hw/isa/lpc_ich9.c           | 1 -
 hw/isa/piix4.c              | 1 -
 hw/moxie/moxiesim.c         | 1 -
 hw/nios2/generic_nommu.c    | 1 -
 hw/nubus/nubus-bus.c        | 1 -
 hw/nvram/spapr_nvram.c      | 1 -
 hw/rx/rx-gdbsim.c           | 1 -
 hw/s390x/s390-ccw.c         | 1 -
 hw/s390x/virtio-ccw.c       | 1 -
 hw/timer/mips_gictimer.c    | 1 -
 hw/usb/xen-usb.c            | 1 -
 hw/vfio/ap.c                | 1 -
 hw/vfio/ccw.c               | 1 -
 hw/xen/xen-bus-helper.c     | 1 -
 27 files changed, 27 deletions(-)
hw/arm/cubieboard.c +0 -1
index 9d0d728180..3ec30ca5af 100644
@@ -20,7 +20,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
-#include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "hw/arm/allwinner-a10.h"
hw/arm/orangepi.c +0 -1
index 40cdb5c6d2..b8d38c9e8d 100644
@@ -22,7 +22,6 @@
 #include "exec/address-spaces.h"
 #include "qapi/error.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "hw/arm/allwinner-h3.h"
hw/char/riscv_htif.c +0 -1
index ba1af1cfc4..ddae738d56 100644
@@ -23,7 +23,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
-#include "hw/sysbus.h"
 #include "hw/char/riscv_htif.h"
 #include "hw/char/serial.h"
 #include "chardev/char.h"
hw/char/sifive_uart.c +0 -1
index ee7adb8e30..fe12666789 100644
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
-#include "hw/sysbus.h"
 #include "chardev/char.h"
 #include "chardev/char-fe.h"
 #include "hw/irq.h"
hw/char/virtio-serial-bus.c +0 -1
index b20038991a..dd6bc27b3b 100644
@@ -28,7 +28,6 @@
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "hw/qdev-properties.h"
-#include "hw/sysbus.h"
 #include "trace.h"
 #include "hw/virtio/virtio-serial.h"
 #include "hw/virtio/virtio-access.h"
hw/core/generic-loader.c +0 -1
index 2b2a7b5e9a..d14f932eea 100644
@@ -32,7 +32,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/core/cpu.h"
-#include "hw/sysbus.h"
 #include "sysemu/dma.h"
 #include "sysemu/reset.h"
 #include "hw/boards.h"
hw/core/guest-loader.c +0 -1
index bde44e27b4..d3f9d1a06e 100644
@@ -26,7 +26,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/core/cpu.h"
-#include "hw/sysbus.h"
 #include "sysemu/dma.h"
 #include "hw/loader.h"
 #include "hw/qdev-properties.h"
hw/ide/ahci_internal.h +0 -1
index 7f32e87731..109de9e2d1 100644
@@ -26,7 +26,6 @@
 
 #include "hw/ide/ahci.h"
 #include "hw/ide/internal.h"
-#include "hw/sysbus.h"
 #include "hw/pci/pci.h"
 
 #define AHCI_MEM_BAR_SIZE         0x1000
hw/input/lasips2.c +0 -1
index 60afb94c78..275737842e 100644
@@ -26,7 +26,6 @@
 #include "hw/qdev-properties.h"
 #include "hw/input/ps2.h"
 #include "hw/input/lasips2.h"
-#include "hw/sysbus.h"
 #include "exec/hwaddr.h"
 #include "sysemu/sysemu.h"
 #include "trace.h"
hw/intc/arm_gic_kvm.c +0 -1
index 9494185cf4..49f79a8674 100644
@@ -23,7 +23,6 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "migration/blocker.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
hw/intc/arm_gicv3.c +0 -1
index 66eaa97198..d63f8af604 100644
@@ -18,7 +18,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
-#include "hw/sysbus.h"
 #include "hw/intc/arm_gicv3.h"
 #include "gicv3_internal.h"
 
hw/intc/arm_gicv3_kvm.c +0 -1
index 65a4c880a3..5c09f00dec 100644
@@ -22,7 +22,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/intc/arm_gicv3_common.h"
-#include "hw/sysbus.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "sysemu/kvm.h"
hw/intc/s390_flic_kvm.c +0 -1
index b3fb9f8395..d1c8fb8016 100644
@@ -17,7 +17,6 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "qapi/error.h"
-#include "hw/sysbus.h"
 #include "sysemu/kvm.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/adapter.h"
hw/isa/lpc_ich9.c +0 -1
index 3963b73520..160bea447a 100644
@@ -34,7 +34,6 @@
 #include "qapi/visitor.h"
 #include "qemu/range.h"
 #include "hw/isa/isa.h"
-#include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/irq.h"
 #include "hw/isa/apm.h"
hw/isa/piix4.c +0 -1
index a50d97834c..d2d9196039 100644
@@ -29,7 +29,6 @@
 #include "hw/southbridge/piix.h"
 #include "hw/pci/pci.h"
 #include "hw/isa/isa.h"
-#include "hw/sysbus.h"
 #include "hw/intc/i8259.h"
 #include "hw/dma/i8257.h"
 #include "hw/timer/i8254.h"
hw/moxie/moxiesim.c +0 -1
index f7b57fcae1..196b730589 100644
@@ -29,7 +29,6 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "net/net.h"
 #include "sysemu/reset.h"
 #include "sysemu/sysemu.h"
hw/nios2/generic_nommu.c +0 -1
index 19899e2c1e..b70a42dc2f 100644
@@ -31,7 +31,6 @@
 #include "qemu-common.h"
 #include "cpu.h"
 
-#include "hw/sysbus.h"
 #include "hw/char/serial.h"
 #include "hw/boards.h"
 #include "exec/memory.h"
hw/nubus/nubus-bus.c +0 -1
index 942a6d5342..5c13452308 100644
@@ -10,7 +10,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/nubus/nubus.h"
-#include "hw/sysbus.h"
 #include "qapi/error.h"
 
 
hw/nvram/spapr_nvram.c +0 -1
index 01f7752014..3bb4654c58 100644
@@ -33,7 +33,6 @@
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/runstate.h"
-#include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/nvram/chrp_nvram.h"
 #include "hw/ppc/spapr.h"
hw/rx/rx-gdbsim.c +0 -1
index 8c611b0a59..9b82feff52 100644
@@ -22,7 +22,6 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "hw/loader.h"
 #include "hw/rx/rx62n.h"
 #include "sysemu/sysemu.h"
hw/s390x/s390-ccw.c +0 -1
index b497571863..242491a1ae 100644
@@ -15,7 +15,6 @@
 #include <libgen.h>
 #include "qapi/error.h"
 #include "qemu/module.h"
-#include "hw/sysbus.h"
 #include "hw/s390x/css.h"
 #include "hw/s390x/css-bridge.h"
 #include "hw/s390x/s390-ccw.h"
hw/s390x/virtio-ccw.c +0 -1
index 06c0605681..1351aa3db7 100644
@@ -17,7 +17,6 @@
 #include "hw/virtio/virtio.h"
 #include "migration/qemu-file-types.h"
 #include "hw/virtio/virtio-net.h"
-#include "hw/sysbus.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
hw/timer/mips_gictimer.c +0 -1
index bc44cd934e..2b0696d4ac 100644
@@ -7,7 +7,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "hw/timer/mips_gictimer.h"
 
hw/usb/xen-usb.c +0 -1
index 4d266d7bb4..0f7369e7ed 100644
@@ -26,7 +26,6 @@
 #include "qemu/config-file.h"
 #include "qemu/main-loop.h"
 #include "qemu/option.h"
-#include "hw/sysbus.h"
 #include "hw/usb.h"
 #include "hw/xen/xen-legacy-backend.h"
 #include "monitor/qdev.h"
hw/vfio/ap.c +0 -1
index 9571c2f91f..f9dbec37da 100644
@@ -14,7 +14,6 @@
 #include <linux/vfio.h>
 #include <sys/ioctl.h>
 #include "qapi/error.h"
-#include "hw/sysbus.h"
 #include "hw/vfio/vfio.h"
 #include "hw/vfio/vfio-common.h"
 #include "hw/s390x/ap-device.h"
hw/vfio/ccw.c +0 -1
index b2df708e4b..e752c845e9 100644
@@ -20,7 +20,6 @@
 #include <sys/ioctl.h>
 
 #include "qapi/error.h"
-#include "hw/sysbus.h"
 #include "hw/vfio/vfio.h"
 #include "hw/vfio/vfio-common.h"
 #include "hw/s390x/s390-ccw.h"
hw/xen/xen-bus-helper.c +0 -1
index b459bb9396..5a1e12b374 100644
@@ -6,7 +6,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/sysbus.h"
 #include "hw/xen/xen.h"
 #include "hw/xen/xen-bus.h"
 #include "hw/xen/xen-bus-helper.h"
Signature · 1 line
2.27.0
#1 lore raw

Hi Thomas,

Quoted 25 lines · Thomas Huth

Many files include hw/sysbus.h without needing it. Remove the superfluous include statements.

---
 hw/arm/cubieboard.c         | 1 -
 hw/arm/orangepi.c           | 1 -
 hw/char/riscv_htif.c        | 1 -
 hw/char/sifive_uart.c       | 1 -
 hw/char/virtio-serial-bus.c | 1 -
 hw/core/generic-loader.c    | 1 -
 hw/core/guest-loader.c      | 1 -
 hw/ide/ahci_internal.h      | 1 -
 hw/input/lasips2.c          | 1 -
 hw/intc/arm_gic_kvm.c       | 1 -
 hw/intc/arm_gicv3.c         | 1 -
 hw/intc/arm_gicv3_kvm.c     | 1 -
 hw/intc/s390_flic_kvm.c     | 1 -
 hw/isa/lpc_ich9.c           | 1 -
 hw/isa/piix4.c              | 1 -
 hw/moxie/moxiesim.c         | 1 -
 hw/nios2/generic_nommu.c    | 1 -
 hw/nubus/nubus-bus.c        | 1 -
 hw/nvram/spapr_nvram.c      | 1 -
 hw/rx/rx-gdbsim.c           | 1 -
Quoted 8 lines
 hw/s390x/s390-ccw.c         | 1 -
 hw/s390x/virtio-ccw.c       | 1 -
 hw/timer/mips_gictimer.c    | 1 -
 hw/usb/xen-usb.c            | 1 -
 hw/vfio/ap.c                | 1 -
 hw/vfio/ccw.c               | 1 -
 hw/xen/xen-bus-helper.c     | 1 -
 27 files changed, 27 deletions(-)
$ git grep -l '#include "hw/sysbus.h"' hw \
  | xargs git grep -L sysbus_ \
  | xargs git grep -L 'SysBusDevice\s\+\w'

hw/arm/cubieboard.c
hw/arm/orangepi.c
hw/char/riscv_htif.c
hw/char/sifive_uart.c
hw/char/virtio-serial-bus.c
hw/core/generic-loader.c
hw/core/guest-loader.c
hw/hyperv/vmbus.c
hw/i386/x86-iommu.c
hw/ide/ahci_internal.h
hw/input/lasips2.c
hw/intc/arm_gic_kvm.c
hw/intc/arm_gicv3.c
hw/intc/arm_gicv3_kvm.c
hw/intc/s390_flic_kvm.c
hw/isa/lpc_ich9.c
hw/isa/piix4.c
hw/moxie/moxiesim.c
hw/nios2/generic_nommu.c
hw/nubus/nubus-bridge.c
hw/nubus/nubus-bus.c
hw/nvram/spapr_nvram.c
hw/ppc/spapr_pci.c
hw/riscv/riscv_hart.c
hw/rx/rx-gdbsim.c
hw/s390x/s390-ccw.c
hw/s390x/virtio-ccw.c
hw/timer/mips_gictimer.c
hw/tricore/tc27x_soc.c
hw/usb/xen-usb.c
hw/vfio/ap.c
hw/vfio/ccw.c
hw/xen/xen-bus-helper.c

diff with your set:

@@ -5,6 +5,8 @@
hw/char/virtio-serial-bus.c
hw/core/generic-loader.c
hw/core/guest-loader.c
+hw/hyperv/vmbus.c
+hw/i386/x86-iommu.c
hw/ide/ahci_internal.h
hw/input/lasips2.c
hw/intc/arm_gic_kvm.c
@@ -15,12 +17,16 @@
hw/isa/piix4.c
hw/moxie/moxiesim.c
hw/nios2/generic_nommu.c
+hw/nubus/nubus-bridge.c
hw/nubus/nubus-bus.c
hw/nvram/spapr_nvram.c
+hw/ppc/spapr_pci.c
+hw/riscv/riscv_hart.c
hw/rx/rx-gdbsim.c
hw/s390x/s390-ccw.c
hw/s390x/virtio-ccw.c
hw/timer/mips_gictimer.c
+hw/tricore/tc27x_soc.c
hw/usb/xen-usb.c
hw/vfio/ap.c
hw/vfio/ccw.c

6 more candidates?

#2 lore raw
Quoted 104 lines · Philippe Mathieu-Daudé

Hi Thomas,

Quoted 25 lines · Thomas Huth

Many files include hw/sysbus.h without needing it. Remove the superfluous include statements.

---
  hw/arm/cubieboard.c         | 1 -
  hw/arm/orangepi.c           | 1 -
  hw/char/riscv_htif.c        | 1 -
  hw/char/sifive_uart.c       | 1 -
  hw/char/virtio-serial-bus.c | 1 -
  hw/core/generic-loader.c    | 1 -
  hw/core/guest-loader.c      | 1 -
  hw/ide/ahci_internal.h      | 1 -
  hw/input/lasips2.c          | 1 -
  hw/intc/arm_gic_kvm.c       | 1 -
  hw/intc/arm_gicv3.c         | 1 -
  hw/intc/arm_gicv3_kvm.c     | 1 -
  hw/intc/s390_flic_kvm.c     | 1 -
  hw/isa/lpc_ich9.c           | 1 -
  hw/isa/piix4.c              | 1 -
  hw/moxie/moxiesim.c         | 1 -
  hw/nios2/generic_nommu.c    | 1 -
  hw/nubus/nubus-bus.c        | 1 -
  hw/nvram/spapr_nvram.c      | 1 -
  hw/rx/rx-gdbsim.c           | 1 -
Quoted 8 lines
  hw/s390x/s390-ccw.c         | 1 -
  hw/s390x/virtio-ccw.c       | 1 -
  hw/timer/mips_gictimer.c    | 1 -
  hw/usb/xen-usb.c            | 1 -
  hw/vfio/ap.c                | 1 -
  hw/vfio/ccw.c               | 1 -
  hw/xen/xen-bus-helper.c     | 1 -
  27 files changed, 27 deletions(-)
$ git grep -l '#include "hw/sysbus.h"' hw \
   | xargs git grep -L sysbus_ \
   | xargs git grep -L 'SysBusDevice\s\+\w'

hw/arm/cubieboard.c
hw/arm/orangepi.c
hw/char/riscv_htif.c
hw/char/sifive_uart.c
hw/char/virtio-serial-bus.c
hw/core/generic-loader.c
hw/core/guest-loader.c
hw/hyperv/vmbus.c
hw/i386/x86-iommu.c
hw/ide/ahci_internal.h
hw/input/lasips2.c
hw/intc/arm_gic_kvm.c
hw/intc/arm_gicv3.c
hw/intc/arm_gicv3_kvm.c
hw/intc/s390_flic_kvm.c
hw/isa/lpc_ich9.c
hw/isa/piix4.c
hw/moxie/moxiesim.c
hw/nios2/generic_nommu.c
hw/nubus/nubus-bridge.c
hw/nubus/nubus-bus.c
hw/nvram/spapr_nvram.c
hw/ppc/spapr_pci.c
hw/riscv/riscv_hart.c
hw/rx/rx-gdbsim.c
hw/s390x/s390-ccw.c
hw/s390x/virtio-ccw.c
hw/timer/mips_gictimer.c
hw/tricore/tc27x_soc.c
hw/usb/xen-usb.c
hw/vfio/ap.c
hw/vfio/ccw.c
hw/xen/xen-bus-helper.c

diff with your set:

(quoted diff) +6 -0
@@ -5,6 +5,8 @@
  hw/char/virtio-serial-bus.c
  hw/core/generic-loader.c
  hw/core/guest-loader.c
+hw/hyperv/vmbus.c
+hw/i386/x86-iommu.c
  hw/ide/ahci_internal.h
  hw/input/lasips2.c
  hw/intc/arm_gic_kvm.c
@@ -15,12 +17,16 @@
  hw/isa/piix4.c
  hw/moxie/moxiesim.c
  hw/nios2/generic_nommu.c
+hw/nubus/nubus-bridge.c
  hw/nubus/nubus-bus.c
  hw/nvram/spapr_nvram.c
+hw/ppc/spapr_pci.c
+hw/riscv/riscv_hart.c
  hw/rx/rx-gdbsim.c
  hw/s390x/s390-ccw.c
  hw/s390x/virtio-ccw.c
  hw/timer/mips_gictimer.c
+hw/tricore/tc27x_soc.c
  hw/usb/xen-usb.c
  hw/vfio/ap.c
  hw/vfio/ccw.c
Quoted 1 line

6 more candidates?

No, since those use TYPE_SYS_BUS_DEVICE and thus require hw/sysbus.h.

Thomas

#3 lore raw
Quoted 106 lines · Thomas Huth
Quoted 105 lines · Philippe Mathieu-Daudé

Hi Thomas,

Quoted 33 lines · Thomas Huth

Many files include hw/sysbus.h without needing it. Remove the superfluous
include statements.

---
  hw/arm/cubieboard.c         | 1 -
  hw/arm/orangepi.c           | 1 -
  hw/char/riscv_htif.c        | 1 -
  hw/char/sifive_uart.c       | 1 -
  hw/char/virtio-serial-bus.c | 1 -
  hw/core/generic-loader.c    | 1 -
  hw/core/guest-loader.c      | 1 -
  hw/ide/ahci_internal.h      | 1 -
  hw/input/lasips2.c          | 1 -
  hw/intc/arm_gic_kvm.c       | 1 -
  hw/intc/arm_gicv3.c         | 1 -
  hw/intc/arm_gicv3_kvm.c     | 1 -
  hw/intc/s390_flic_kvm.c     | 1 -
  hw/isa/lpc_ich9.c           | 1 -
  hw/isa/piix4.c              | 1 -
  hw/moxie/moxiesim.c         | 1 -
  hw/nios2/generic_nommu.c    | 1 -
  hw/nubus/nubus-bus.c        | 1 -
  hw/nvram/spapr_nvram.c      | 1 -
  hw/rx/rx-gdbsim.c           | 1 -
  hw/s390x/s390-ccw.c         | 1 -
  hw/s390x/virtio-ccw.c       | 1 -
  hw/timer/mips_gictimer.c    | 1 -
  hw/usb/xen-usb.c            | 1 -
  hw/vfio/ap.c                | 1 -
  hw/vfio/ccw.c               | 1 -
  hw/xen/xen-bus-helper.c     | 1 -

Quoted 1 line
  27 files changed, 27 deletions(-)
$ git grep -l '#include "hw/sysbus.h"' hw \
   | xargs git grep -L sysbus_ \
   | xargs git grep -L 'SysBusDevice\s\+\w'

hw/arm/cubieboard.c
hw/arm/orangepi.c
hw/char/riscv_htif.c
hw/char/sifive_uart.c
hw/char/virtio-serial-bus.c
hw/core/generic-loader.c
hw/core/guest-loader.c
hw/hyperv/vmbus.c
hw/i386/x86-iommu.c
hw/ide/ahci_internal.h
hw/input/lasips2.c
hw/intc/arm_gic_kvm.c
hw/intc/arm_gicv3.c
hw/intc/arm_gicv3_kvm.c
hw/intc/s390_flic_kvm.c
hw/isa/lpc_ich9.c
hw/isa/piix4.c
hw/moxie/moxiesim.c
hw/nios2/generic_nommu.c
hw/nubus/nubus-bridge.c
hw/nubus/nubus-bus.c
hw/nvram/spapr_nvram.c
hw/ppc/spapr_pci.c
hw/riscv/riscv_hart.c
hw/rx/rx-gdbsim.c
hw/s390x/s390-ccw.c
hw/s390x/virtio-ccw.c
hw/timer/mips_gictimer.c
hw/tricore/tc27x_soc.c
hw/usb/xen-usb.c
hw/vfio/ap.c
hw/vfio/ccw.c
hw/xen/xen-bus-helper.c

diff with your set:

(quoted diff) +0 -0
@@ -5,6 +5,8 @@

  hw/char/virtio-serial-bus.c
  hw/core/generic-loader.c
  hw/core/guest-loader.c

(quoted diff) +2 -0
+hw/hyperv/vmbus.c
+hw/i386/x86-iommu.c

  hw/ide/ahci_internal.h
  hw/input/lasips2.c
  hw/intc/arm_gic_kvm.c

(quoted diff) +0 -0
@@ -15,12 +17,16 @@

  hw/isa/piix4.c
  hw/moxie/moxiesim.c
  hw/nios2/generic_nommu.c
+hw/nubus/nubus-bridge.c
  hw/nubus/nubus-bus.c
  hw/nvram/spapr_nvram.c

(quoted diff) +2 -0
+hw/ppc/spapr_pci.c
+hw/riscv/riscv_hart.c

  hw/rx/rx-gdbsim.c
  hw/s390x/s390-ccw.c
  hw/s390x/virtio-ccw.c
  hw/timer/mips_gictimer.c
+hw/tricore/tc27x_soc.c
  hw/usb/xen-usb.c
  hw/vfio/ap.c
  hw/vfio/ccw.c

Quoted 3 lines
Quoted 1 line

6 more candidates?

No, since those use TYPE_SYS_BUS_DEVICE and thus require hw/sysbus.h.

Ah indeed, this line matches your patch changes:

$ git grep -l '#include "hw/sysbus.h"' hw \
   | xargs git grep -L sysbus_ \
   | xargs git grep -L 'SysBusDevice\s\+\w' \
   | xargs grep -L SYS_BUS_DEVICE
#4 lore raw
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Thomas Huth
Quoted 4 lines · Philippe Mathieu-Daudé

Hi Thomas,

6 more candidates?

Quoted 8 lines
Quoted 1 line

No, since those use TYPE_SYS_BUS_DEVICE and thus require hw/sysbus.h.

Ah indeed, this line matches your patch changes:

$ git grep -l '#include "hw/sysbus.h"' hw \
   | xargs git grep -L sysbus_ \
   | xargs git grep -L 'SysBusDevice\s\+\w' \
   | xargs grep -L SYS_BUS_DEVICE

I missed the 'git' while copy/pasting, I meant:

| xargs git grep -L SYS_BUS_DEVICE

Quoted 3 lines
#5 lore raw
In reply to Thomas Huth

Le 27/03/2021 à 09:28, Thomas Huth a écrit :

Quoted 352 lines

Many files include hw/sysbus.h without needing it. Remove the superfluous include statements.

---
 hw/arm/cubieboard.c         | 1 -
 hw/arm/orangepi.c           | 1 -
 hw/char/riscv_htif.c        | 1 -
 hw/char/sifive_uart.c       | 1 -
 hw/char/virtio-serial-bus.c | 1 -
 hw/core/generic-loader.c    | 1 -
 hw/core/guest-loader.c      | 1 -
 hw/ide/ahci_internal.h      | 1 -
 hw/input/lasips2.c          | 1 -
 hw/intc/arm_gic_kvm.c       | 1 -
 hw/intc/arm_gicv3.c         | 1 -
 hw/intc/arm_gicv3_kvm.c     | 1 -
 hw/intc/s390_flic_kvm.c     | 1 -
 hw/isa/lpc_ich9.c           | 1 -
 hw/isa/piix4.c              | 1 -
 hw/moxie/moxiesim.c         | 1 -
 hw/nios2/generic_nommu.c    | 1 -
 hw/nubus/nubus-bus.c        | 1 -
 hw/nvram/spapr_nvram.c      | 1 -
 hw/rx/rx-gdbsim.c           | 1 -
 hw/s390x/s390-ccw.c         | 1 -
 hw/s390x/virtio-ccw.c       | 1 -
 hw/timer/mips_gictimer.c    | 1 -
 hw/usb/xen-usb.c            | 1 -
 hw/vfio/ap.c                | 1 -
 hw/vfio/ccw.c               | 1 -
 hw/xen/xen-bus-helper.c     | 1 -
 27 files changed, 27 deletions(-)
hw/arm/cubieboard.c +0 -1
index 9d0d728180..3ec30ca5af 100644
@@ -20,7 +20,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
-#include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "hw/arm/allwinner-a10.h"
hw/arm/orangepi.c +0 -1
index 40cdb5c6d2..b8d38c9e8d 100644
@@ -22,7 +22,6 @@
 #include "exec/address-spaces.h"
 #include "qapi/error.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
 #include "hw/arm/allwinner-h3.h"
hw/char/riscv_htif.c +0 -1
index ba1af1cfc4..ddae738d56 100644
@@ -23,7 +23,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
-#include "hw/sysbus.h"
 #include "hw/char/riscv_htif.h"
 #include "hw/char/serial.h"
 #include "chardev/char.h"
hw/char/sifive_uart.c +0 -1
index ee7adb8e30..fe12666789 100644
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
-#include "hw/sysbus.h"
 #include "chardev/char.h"
 #include "chardev/char-fe.h"
 #include "hw/irq.h"
hw/char/virtio-serial-bus.c +0 -1
index b20038991a..dd6bc27b3b 100644
@@ -28,7 +28,6 @@
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "hw/qdev-properties.h"
-#include "hw/sysbus.h"
 #include "trace.h"
 #include "hw/virtio/virtio-serial.h"
 #include "hw/virtio/virtio-access.h"
hw/core/generic-loader.c +0 -1
index 2b2a7b5e9a..d14f932eea 100644
@@ -32,7 +32,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/core/cpu.h"
-#include "hw/sysbus.h"
 #include "sysemu/dma.h"
 #include "sysemu/reset.h"
 #include "hw/boards.h"
hw/core/guest-loader.c +0 -1
index bde44e27b4..d3f9d1a06e 100644
@@ -26,7 +26,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/core/cpu.h"
-#include "hw/sysbus.h"
 #include "sysemu/dma.h"
 #include "hw/loader.h"
 #include "hw/qdev-properties.h"
hw/ide/ahci_internal.h +0 -1
index 7f32e87731..109de9e2d1 100644
@@ -26,7 +26,6 @@
 
 #include "hw/ide/ahci.h"
 #include "hw/ide/internal.h"
-#include "hw/sysbus.h"
 #include "hw/pci/pci.h"
 
 #define AHCI_MEM_BAR_SIZE         0x1000
hw/input/lasips2.c +0 -1
index 60afb94c78..275737842e 100644
@@ -26,7 +26,6 @@
 #include "hw/qdev-properties.h"
 #include "hw/input/ps2.h"
 #include "hw/input/lasips2.h"
-#include "hw/sysbus.h"
 #include "exec/hwaddr.h"
 #include "sysemu/sysemu.h"
 #include "trace.h"
hw/intc/arm_gic_kvm.c +0 -1
index 9494185cf4..49f79a8674 100644
@@ -23,7 +23,6 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "migration/blocker.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
hw/intc/arm_gicv3.c +0 -1
index 66eaa97198..d63f8af604 100644
@@ -18,7 +18,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
-#include "hw/sysbus.h"
 #include "hw/intc/arm_gicv3.h"
 #include "gicv3_internal.h"
 
hw/intc/arm_gicv3_kvm.c +0 -1
index 65a4c880a3..5c09f00dec 100644
@@ -22,7 +22,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/intc/arm_gicv3_common.h"
-#include "hw/sysbus.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "sysemu/kvm.h"
hw/intc/s390_flic_kvm.c +0 -1
index b3fb9f8395..d1c8fb8016 100644
@@ -17,7 +17,6 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "qapi/error.h"
-#include "hw/sysbus.h"
 #include "sysemu/kvm.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/adapter.h"
hw/isa/lpc_ich9.c +0 -1
index 3963b73520..160bea447a 100644
@@ -34,7 +34,6 @@
 #include "qapi/visitor.h"
 #include "qemu/range.h"
 #include "hw/isa/isa.h"
-#include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/irq.h"
 #include "hw/isa/apm.h"
hw/isa/piix4.c +0 -1
index a50d97834c..d2d9196039 100644
@@ -29,7 +29,6 @@
 #include "hw/southbridge/piix.h"
 #include "hw/pci/pci.h"
 #include "hw/isa/isa.h"
-#include "hw/sysbus.h"
 #include "hw/intc/i8259.h"
 #include "hw/dma/i8257.h"
 #include "hw/timer/i8254.h"
hw/moxie/moxiesim.c +0 -1
index f7b57fcae1..196b730589 100644
@@ -29,7 +29,6 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "net/net.h"
 #include "sysemu/reset.h"
 #include "sysemu/sysemu.h"
hw/nios2/generic_nommu.c +0 -1
index 19899e2c1e..b70a42dc2f 100644
@@ -31,7 +31,6 @@
 #include "qemu-common.h"
 #include "cpu.h"
 
-#include "hw/sysbus.h"
 #include "hw/char/serial.h"
 #include "hw/boards.h"
 #include "exec/memory.h"
hw/nubus/nubus-bus.c +0 -1
index 942a6d5342..5c13452308 100644
@@ -10,7 +10,6 @@
 
 #include "qemu/osdep.h"
 #include "hw/nubus/nubus.h"
-#include "hw/sysbus.h"
 #include "qapi/error.h"
 
 
hw/nvram/spapr_nvram.c +0 -1
index 01f7752014..3bb4654c58 100644
@@ -33,7 +33,6 @@
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/runstate.h"
-#include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/nvram/chrp_nvram.h"
 #include "hw/ppc/spapr.h"
hw/rx/rx-gdbsim.c +0 -1
index 8c611b0a59..9b82feff52 100644
@@ -22,7 +22,6 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
-#include "hw/sysbus.h"
 #include "hw/loader.h"
 #include "hw/rx/rx62n.h"
 #include "sysemu/sysemu.h"
hw/s390x/s390-ccw.c +0 -1
index b497571863..242491a1ae 100644
@@ -15,7 +15,6 @@
 #include <libgen.h>
 #include "qapi/error.h"
 #include "qemu/module.h"
-#include "hw/sysbus.h"
 #include "hw/s390x/css.h"
 #include "hw/s390x/css-bridge.h"
 #include "hw/s390x/s390-ccw.h"
hw/s390x/virtio-ccw.c +0 -1
index 06c0605681..1351aa3db7 100644
@@ -17,7 +17,6 @@
 #include "hw/virtio/virtio.h"
 #include "migration/qemu-file-types.h"
 #include "hw/virtio/virtio-net.h"
-#include "hw/sysbus.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
hw/timer/mips_gictimer.c +0 -1
index bc44cd934e..2b0696d4ac 100644
@@ -7,7 +7,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "hw/timer/mips_gictimer.h"
 
hw/usb/xen-usb.c +0 -1
index 4d266d7bb4..0f7369e7ed 100644
@@ -26,7 +26,6 @@
 #include "qemu/config-file.h"
 #include "qemu/main-loop.h"
 #include "qemu/option.h"
-#include "hw/sysbus.h"
 #include "hw/usb.h"
 #include "hw/xen/xen-legacy-backend.h"
 #include "monitor/qdev.h"
hw/vfio/ap.c +0 -1
index 9571c2f91f..f9dbec37da 100644
@@ -14,7 +14,6 @@
 #include <linux/vfio.h>
 #include <sys/ioctl.h>
 #include "qapi/error.h"
-#include "hw/sysbus.h"
 #include "hw/vfio/vfio.h"
 #include "hw/vfio/vfio-common.h"
 #include "hw/s390x/ap-device.h"
hw/vfio/ccw.c +0 -1
index b2df708e4b..e752c845e9 100644
@@ -20,7 +20,6 @@
 #include <sys/ioctl.h>
 
 #include "qapi/error.h"
-#include "hw/sysbus.h"
 #include "hw/vfio/vfio.h"
 #include "hw/vfio/vfio-common.h"
 #include "hw/s390x/s390-ccw.h"
hw/xen/xen-bus-helper.c +0 -0
index b459bb9396..5a1e12b374 100644

hw/xen/xen-bus-helper.c line 11

Quoted 7 lines
hw/xen/xen-bus-helper.c +0 -1
@@ -6,7 +6,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/sysbus.h"
 #include "hw/xen/xen.h"
 #include "hw/xen/xen-bus.h"
 #include "hw/xen/xen-bus-helper.h"

Applied to my trivial-patches branch.

Thanks,
Laurent