input/adb: Only include where needed
PATCH 1/1 input/adb: Only include where needed
The header hw/input/adb.h is included by some files that don't need it. Clean it up and include only where necessary.
--- hw/misc/macio/cuda.c | 2 -- hw/misc/macio/pmu.c | 3 --- hw/misc/mos6522.c | 1 - hw/ppc/mac.h | 2 -- include/hw/misc/mac_via.h | 1 + include/hw/misc/macio/cuda.h | 1 + include/hw/misc/macio/pmu.h | 1 + include/hw/misc/mos6522.h | 3 +-- 8 files changed, 4 insertions(+), 10 deletions(-)
hw/misc/macio/cuda.c +0 -2
@@ -28,8 +28,6 @@#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" #include "hw/misc/macio/cuda.h" #include "qapi/error.h" #include "qemu/timer.h"
hw/misc/macio/pmu.c +0 -3
@@ -33,10 +33,7 @@#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/input/adb.h" #include "hw/irq.h" -#include "hw/misc/mos6522.h" -#include "hw/misc/macio/gpio.h" #include "hw/misc/macio/pmu.h" #include "qapi/error.h" #include "qemu/timer.h"
hw/misc/mos6522.c +0 -1
@@ -25,7 +25,6 @@*/ #include "qemu/osdep.h" -#include "hw/input/adb.h" #include "hw/irq.h" #include "hw/misc/mos6522.h" #include "hw/qdev-properties.h"
hw/ppc/mac.h +0 -2
@@ -30,8 +30,6 @@#include "exec/memory.h" #include "hw/boards.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/uninorth.h" #include "qom/object.h"
include/hw/misc/mac_via.h +1 -0
@@ -12,6 +12,7 @@#include "exec/memory.h" #include "hw/sysbus.h" #include "hw/misc/mos6522.h" +#include "hw/input/adb.h" #include "qom/object.h"
include/hw/misc/macio/cuda.h +1 -0
@@ -26,6 +26,7 @@#ifndef CUDA_H #define CUDA_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "qom/object.h"
include/hw/misc/macio/pmu.h +1 -0
@@ -10,6 +10,7 @@#ifndef PMU_H #define PMU_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "hw/misc/macio/gpio.h" #include "qom/object.h"
include/hw/misc/mos6522.h +1 -2
@@ -27,9 +27,8 @@#ifndef MOS6522_H #define MOS6522_H -#include "exec/memory.h" +#include "exec/hwaddr.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" #include "qom/object.h" /* Bits in ACR */
Signature · 1 line
2.21.4
Quoted 2 lines · BALATON Zoltan
The header
hw/input/adb.his included by some files that don't need it. Clean it up and include only where necessary.
When you're touching mos6522, I've also have this patch that cleans up includes that's somewhat related to mos6522 so you could consider it to be included in your series. I haven't checked but it should still apply. At least I got no problem with rebasing so at least with --3way should probably work but if not I can resend just let me know.
Regards,
BALATON Zoltan
Quoted 117 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/misc/macio/cuda.c | 2 -- hw/misc/macio/pmu.c | 3 --- hw/misc/mos6522.c | 1 - hw/ppc/mac.h | 2 -- include/hw/misc/mac_via.h | 1 + include/hw/misc/macio/cuda.h | 1 + include/hw/misc/macio/pmu.h | 1 + include/hw/misc/mos6522.h | 3 +-- 8 files changed, 4 insertions(+), 10 deletions(-)hw/misc/macio/cuda.c +0
-2@@ -28,8 +28,6 @@#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" #include "hw/misc/macio/cuda.h" #include "qapi/error.h" #include "qemu/timer.h" hw/misc/macio/pmu.c +0
-3@@ -33,10 +33,7 @@#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/input/adb.h" #include "hw/irq.h" -#include "hw/misc/mos6522.h" -#include "hw/misc/macio/gpio.h" #include "hw/misc/macio/pmu.h" #include "qapi/error.h" #include "qemu/timer.h" hw/misc/mos6522.c +0
-1@@ -25,7 +25,6 @@*/ #include "qemu/osdep.h" -#include "hw/input/adb.h" #include "hw/irq.h" #include "hw/misc/mos6522.h" #include "hw/qdev-properties.h" hw/ppc/mac.h +0
-2@@ -30,8 +30,6 @@#include "exec/memory.h" #include "hw/boards.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/uninorth.h" #include "qom/object.h" include/hw/misc/mac_via.h +1
-0@@ -12,6 +12,7 @@#include "exec/memory.h" #include "hw/sysbus.h" #include "hw/misc/mos6522.h" +#include "hw/input/adb.h" #include "qom/object.h" include/hw/misc/macio/cuda.h +1
-0@@ -26,6 +26,7 @@#ifndef CUDA_H #define CUDA_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "qom/object.h" include/hw/misc/macio/pmu.h +1
-0@@ -10,6 +10,7 @@#ifndef PMU_H #define PMU_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "hw/misc/macio/gpio.h" #include "qom/object.h" include/hw/misc/mos6522.h +1
-2@@ -27,9 +27,8 @@#ifndef MOS6522_H #define MOS6522_H -#include "exec/memory.h" +#include "exec/hwaddr.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" #include "qom/object.h" /* Bits in ACR */
Quoted 5 lines · BALATON Zoltan
Quoted 2 lines · BALATON Zoltan
The header
hw/input/adb.his included by some files that don't need it. Clean it up and include only where necessary.When you're touching mos6522, I've also have this patch that cleans up includes that's somewhat related to mos6522 so you could consider it to be included in your series. I haven't checked but it should still apply. At least I got no problem with rebasing so at least with --3way should probably work but if not I can resend just let me know.
I have a vague memory that someone was advocating a while back for the opposite of this patch in the way it uses headers i.e. the .c file should contain the include for the header as well as the .h file, so I'm not sure what the recommendation is here.
The parts related to tidying up the mos6522.c and mos6522.h includes look correct though, as they shouldn't be referencing any ADB headers.
ATB,
Mark.
Quoted 117 lines
Quoted 117 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/misc/macio/cuda.c | 2 --
hw/misc/macio/pmu.c | 3 ---
hw/misc/mos6522.c | 1 -
hw/ppc/mac.h | 2 --
include/hw/misc/mac_via.h | 1 +include/hw/misc/macio/cuda.h| 1 +
include/hw/misc/macio/pmu.h | 1 +
include/hw/misc/mos6522.h | 3 +--8 files changed, 4 insertions(+), 10 deletions(-)hw/misc/macio/cuda.c +0
-2@@ -28,8 +28,6 @@#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" #include "hw/misc/macio/cuda.h" #include "qapi/error.h" #include "qemu/timer.h" hw/misc/macio/pmu.c +0
-3@@ -33,10 +33,7 @@#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/input/adb.h" #include "hw/irq.h" -#include "hw/misc/mos6522.h" -#include "hw/misc/macio/gpio.h" #include "hw/misc/macio/pmu.h" #include "qapi/error.h" #include "qemu/timer.h" hw/misc/mos6522.c +0
-1@@ -25,7 +25,6 @@*/ #include "qemu/osdep.h" -#include "hw/input/adb.h" #include "hw/irq.h" #include "hw/misc/mos6522.h" #include "hw/qdev-properties.h" hw/ppc/mac.h +0
-2@@ -30,8 +30,6 @@#include "exec/memory.h" #include "hw/boards.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/uninorth.h" #include "qom/object.h" include/hw/misc/mac_via.h +1
-0@@ -12,6 +12,7 @@#include "exec/memory.h" #include "hw/sysbus.h" #include "hw/misc/mos6522.h" +#include "hw/input/adb.h" #include "qom/object.h" include/hw/misc/macio/cuda.h +1
-0@@ -26,6 +26,7 @@#ifndef CUDA_H #define CUDA_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "qom/object.h" include/hw/misc/macio/pmu.h +1
-0@@ -10,6 +10,7 @@#ifndef PMU_H #define PMU_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "hw/misc/macio/gpio.h" #include "qom/object.h" include/hw/misc/mos6522.h +1
-2@@ -27,9 +27,8 @@#ifndef MOS6522_H #define MOS6522_H -#include "exec/memory.h" +#include "exec/hwaddr.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" #include "qom/object.h" /* Bits in ACR */
Quoted 9 lines · Mark Cave-Ayland
Quoted 5 lines · BALATON Zoltan
Quoted 2 lines · BALATON Zoltan
The header
hw/input/adb.his included by some files that don't need it. Clean it up and include only where necessary.When you're touching mos6522, I've also have this patch that cleans up includes that's somewhat related to mos6522 so you could consider it to be included in your series. I haven't checked but it should still apply. At least I got no problem with rebasing so at least with --3way should probably work but if not I can resend just let me know.
I have a vague memory that someone was advocating a while back for the opposite of this patch in the way it uses headers i.e. the .c file should contain the include for the header as well as the .h file, so I'm not sure what the recommendation is here.
Headers should include the minimum headers they require.
hw/misc/macio/cuda.h uses ADBBusState which is declared in "hw/input/adb.h", so it must include this header, otherwise we can consider this a bug.
I haven't checked the rest.
Quoted 30 lines
The parts related to tidying up the
mos6522.candmos6522.hincludes look correct though, as they shouldn't be referencing any ADB headers.ATB,
Mark.
Quoted 23 lines
Quoted 23 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/misc/macio/cuda.c | 2 --
hw/misc/macio/pmu.c | 3 ---
hw/misc/mos6522.c | 1 -
hw/ppc/mac.h | 2 --
include/hw/misc/mac_via.h | 1 +include/hw/misc/macio/cuda.h| 1 +
include/hw/misc/macio/pmu.h | 1 +
include/hw/misc/mos6522.h | 3 +--8 files changed, 4 insertions(+), 10 deletions(-)include/hw/misc/macio/cuda.h +1
-0@@ -26,6 +26,7 @@#ifndef CUDA_H #define CUDA_H +#include "hw/input/adb.h" #include "hw/misc/mos6522.h" #include "qom/object.h"