[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/38] hw/timer/xilinx_timer: Use XpsTimerState instead of 'struct
From: |
Peter Maydell |
Subject: |
[PULL 37/38] hw/timer/xilinx_timer: Use XpsTimerState instead of 'struct timerblock' |
Date: |
Fri, 13 Jan 2023 14:11:25 +0000 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
This remove a use of 'struct' in the DECLARE_INSTANCE_CHECKER()
macro call, to avoid after a QOM refactor:
hw/timer/xilinx_timer.c:65:1: error: declaration of anonymous struct must be
a definition
DECLARE_INSTANCE_CHECKER(struct timerblock, XILINX_TIMER,
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
Message-id: 20230109140306.23161-15-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/timer/xilinx_timer.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
index c7f17cd6460..32a9df69e0b 100644
--- a/hw/timer/xilinx_timer.c
+++ b/hw/timer/xilinx_timer.c
@@ -62,10 +62,10 @@ struct xlx_timer
};
#define TYPE_XILINX_TIMER "xlnx.xps-timer"
-DECLARE_INSTANCE_CHECKER(struct timerblock, XILINX_TIMER,
- TYPE_XILINX_TIMER)
+typedef struct XpsTimerState XpsTimerState;
+DECLARE_INSTANCE_CHECKER(XpsTimerState, XILINX_TIMER, TYPE_XILINX_TIMER)
-struct timerblock
+struct XpsTimerState
{
SysBusDevice parent_obj;
@@ -76,7 +76,7 @@ struct timerblock
struct xlx_timer *timers;
};
-static inline unsigned int num_timers(struct timerblock *t)
+static inline unsigned int num_timers(XpsTimerState *t)
{
return 2 - t->one_timer_only;
}
@@ -87,7 +87,7 @@ static inline unsigned int timer_from_addr(hwaddr addr)
return addr >> 2;
}
-static void timer_update_irq(struct timerblock *t)
+static void timer_update_irq(XpsTimerState *t)
{
unsigned int i, irq = 0;
uint32_t csr;
@@ -104,7 +104,7 @@ static void timer_update_irq(struct timerblock *t)
static uint64_t
timer_read(void *opaque, hwaddr addr, unsigned int size)
{
- struct timerblock *t = opaque;
+ XpsTimerState *t = opaque;
struct xlx_timer *xt;
uint32_t r = 0;
unsigned int timer;
@@ -155,7 +155,7 @@ static void
timer_write(void *opaque, hwaddr addr,
uint64_t val64, unsigned int size)
{
- struct timerblock *t = opaque;
+ XpsTimerState *t = opaque;
struct xlx_timer *xt;
unsigned int timer;
uint32_t value = val64;
@@ -202,7 +202,7 @@ static const MemoryRegionOps timer_ops = {
static void timer_hit(void *opaque)
{
struct xlx_timer *xt = opaque;
- struct timerblock *t = xt->parent;
+ XpsTimerState *t = xt->parent;
D(fprintf(stderr, "%s %d\n", __func__, xt->nr));
xt->regs[R_TCSR] |= TCSR_TINT;
@@ -213,7 +213,7 @@ static void timer_hit(void *opaque)
static void xilinx_timer_realize(DeviceState *dev, Error **errp)
{
- struct timerblock *t = XILINX_TIMER(dev);
+ XpsTimerState *t = XILINX_TIMER(dev);
unsigned int i;
/* Init all the ptimers. */
@@ -236,16 +236,15 @@ static void xilinx_timer_realize(DeviceState *dev, Error
**errp)
static void xilinx_timer_init(Object *obj)
{
- struct timerblock *t = XILINX_TIMER(obj);
+ XpsTimerState *t = XILINX_TIMER(obj);
/* All timers share a single irq line. */
sysbus_init_irq(SYS_BUS_DEVICE(obj), &t->irq);
}
static Property xilinx_timer_properties[] = {
- DEFINE_PROP_UINT32("clock-frequency", struct timerblock, freq_hz,
- 62 * 1000000),
- DEFINE_PROP_UINT8("one-timer-only", struct timerblock, one_timer_only, 0),
+ DEFINE_PROP_UINT32("clock-frequency", XpsTimerState, freq_hz, 62 *
1000000),
+ DEFINE_PROP_UINT8("one-timer-only", XpsTimerState, one_timer_only, 0),
DEFINE_PROP_END_OF_LIST(),
};
@@ -260,7 +259,7 @@ static void xilinx_timer_class_init(ObjectClass *klass,
void *data)
static const TypeInfo xilinx_timer_info = {
.name = TYPE_XILINX_TIMER,
.parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(struct timerblock),
+ .instance_size = sizeof(XpsTimerState),
.instance_init = xilinx_timer_init,
.class_init = xilinx_timer_class_init,
};
--
2.34.1
- [PULL 08/38] hw/arm: Allwinner A10 enable SPL load from MMC, (continued)
- [PULL 08/38] hw/arm: Allwinner A10 enable SPL load from MMC, Peter Maydell, 2023/01/13
- [PULL 13/38] hw/arm/collie: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 23/38] hw/arm: Remove unreachable code calling pflash_cfi01_register(), Peter Maydell, 2023/01/13
- [PULL 18/38] hw/arm/musicpal: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 30/38] hw/arm/stellaris: Drop useless casts from void * to pointer, Peter Maydell, 2023/01/13
- [PULL 16/38] hw/arm/gumstix: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 28/38] hw/gpio/omap_gpio: Use CamelCase for TYPE_OMAP2_GPIO type name, Peter Maydell, 2023/01/13
- [PULL 20/38] hw/arm/omap_sx1: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 19/38] hw/arm/omap_sx1: Remove unused 'total_ram' definitions, Peter Maydell, 2023/01/13
- [PULL 27/38] hw/gpio/omap_gpio: Use CamelCase for TYPE_OMAP1_GPIO type name, Peter Maydell, 2023/01/13
- [PULL 37/38] hw/timer/xilinx_timer: Use XpsTimerState instead of 'struct timerblock',
Peter Maydell <=
- [PULL 35/38] hw/misc/sbsa_ec: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE(), Peter Maydell, 2023/01/13
- [PULL 31/38] hw/arm/stellaris: Use CamelCase for STELLARIS_ADC type name, Peter Maydell, 2023/01/13
- [PULL 29/38] hw/intc/omap_intc: Use CamelCase for TYPE_OMAP_INTC type name, Peter Maydell, 2023/01/13
- [PULL 25/38] hw/gpio/omap_gpio: Add local variable to avoid embedded cast, Peter Maydell, 2023/01/13
- [PULL 32/38] hw/arm/bcm2836: Remove definitions generated by OBJECT_DECLARE_TYPE(), Peter Maydell, 2023/01/13
- [PULL 12/38] hw/arm/pxa2xx: Simplify pxa270_init(), Peter Maydell, 2023/01/13
- [PULL 14/38] hw/arm/collie: Simplify flash creation using for() loop, Peter Maydell, 2023/01/13
- [PULL 24/38] hw/arm/pxa: Avoid forward-declaring PXA2xxI2CState, Peter Maydell, 2023/01/13
- [PULL 17/38] hw/arm/mainstone: Use the IEC binary prefix definitions, Peter Maydell, 2023/01/13
- [PULL 22/38] hw/arm/vexpress: Remove dead code in vexpress_common_init(), Peter Maydell, 2023/01/13