Message ID | 20211229225206.171882-3-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw/sysbus: Document GPIO related functions | expand |
On 2021/12/30 6:52, Philippe Mathieu-Daudé wrote: > sysbus_get_connected_irq() and sysbus_is_irq_connected() are only > used by platform-bus.c; restrict them to hw/core/ by adding a local > "sysbus-internal.h" header. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > hw/core/sysbus-internal.h | 16 ++++++++++++++++ > include/hw/sysbus.h | 2 -- > hw/core/platform-bus.c | 2 +- > hw/core/sysbus.c | 1 + > 4 files changed, 18 insertions(+), 3 deletions(-) > create mode 100644 hw/core/sysbus-internal.h Reviewed-by: Yanan Wang <wangyanan55@huawei.com> Thanks, Yanan > diff --git a/hw/core/sysbus-internal.h b/hw/core/sysbus-internal.h > new file mode 100644 > index 00000000000..991b3e3159c > --- /dev/null > +++ b/hw/core/sysbus-internal.h > @@ -0,0 +1,16 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* > + * SysBus internal helpers > + * > + * Copyright (c) 2021 QEMU contributors > + */ > +#ifndef HW_CORE_SYSBUS_INTERNAL_H > +#define HW_CORE_SYSBUS_INTERNAL_H > + > +#include "hw/sysbus.h" > + > +/* Following functions are only used by the platform-bus subsystem */ > +qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); > +bool sysbus_is_irq_connected(SysBusDevice *dev, int n); > + > +#endif /* HW_CORE_SYSBUS_INTERNAL_H */ > diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h > index 3564b7b6a22..24645ee7996 100644 > --- a/include/hw/sysbus.h > +++ b/include/hw/sysbus.h > @@ -77,8 +77,6 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size); > bool sysbus_has_irq(SysBusDevice *dev, int n); > bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n); > void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq); > -bool sysbus_is_irq_connected(SysBusDevice *dev, int n); > -qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); > void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr); > void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, > int priority); > diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c > index b8487b26b67..016fb71eba1 100644 > --- a/hw/core/platform-bus.c > +++ b/hw/core/platform-bus.c > @@ -25,7 +25,7 @@ > #include "qapi/error.h" > #include "qemu/error-report.h" > #include "qemu/module.h" > - > +#include "sysbus-internal.h" > > /* > * Returns the PlatformBus IRQ number for a SysBusDevice irq number or -1 if > diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c > index 0e6773c8df7..dcd7beda184 100644 > --- a/hw/core/sysbus.c > +++ b/hw/core/sysbus.c > @@ -24,6 +24,7 @@ > #include "monitor/monitor.h" > #include "exec/address-spaces.h" > #include "qdev-internal.h" > +#include "sysbus-internal.h" > > static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); > static char *sysbus_get_fw_dev_path(DeviceState *dev);
diff --git a/hw/core/sysbus-internal.h b/hw/core/sysbus-internal.h new file mode 100644 index 00000000000..991b3e3159c --- /dev/null +++ b/hw/core/sysbus-internal.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * SysBus internal helpers + * + * Copyright (c) 2021 QEMU contributors + */ +#ifndef HW_CORE_SYSBUS_INTERNAL_H +#define HW_CORE_SYSBUS_INTERNAL_H + +#include "hw/sysbus.h" + +/* Following functions are only used by the platform-bus subsystem */ +qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); +bool sysbus_is_irq_connected(SysBusDevice *dev, int n); + +#endif /* HW_CORE_SYSBUS_INTERNAL_H */ diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 3564b7b6a22..24645ee7996 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -77,8 +77,6 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size); bool sysbus_has_irq(SysBusDevice *dev, int n); bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n); void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq); -bool sysbus_is_irq_connected(SysBusDevice *dev, int n); -qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr); void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, int priority); diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index b8487b26b67..016fb71eba1 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -25,7 +25,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/module.h" - +#include "sysbus-internal.h" /* * Returns the PlatformBus IRQ number for a SysBusDevice irq number or -1 if diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 0e6773c8df7..dcd7beda184 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -24,6 +24,7 @@ #include "monitor/monitor.h" #include "exec/address-spaces.h" #include "qdev-internal.h" +#include "sysbus-internal.h" static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); static char *sysbus_get_fw_dev_path(DeviceState *dev);
sysbus_get_connected_irq() and sysbus_is_irq_connected() are only used by platform-bus.c; restrict them to hw/core/ by adding a local "sysbus-internal.h" header. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- hw/core/sysbus-internal.h | 16 ++++++++++++++++ include/hw/sysbus.h | 2 -- hw/core/platform-bus.c | 2 +- hw/core/sysbus.c | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 hw/core/sysbus-internal.h