mos6522: Rename QOM macros

Rename the MOS6522_DEVICE_CLASS and MOS6522_DEVICE_GET_CLASS
macros to be consistent with the TYPE_MOS6522 and MOS6522 macros.

This will make future conversion to OBJECT_DECLARE* easier.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200825192110.3528606-46-ehabkost@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-08-25 15:20:41 -04:00
parent fed163c987
commit 9db70dac85
5 changed files with 19 additions and 19 deletions

View File

@ -328,7 +328,7 @@ static void via1_VBL(void *opaque)
{ {
MOS6522Q800VIA1State *v1s = opaque; MOS6522Q800VIA1State *v1s = opaque;
MOS6522State *s = MOS6522(v1s); MOS6522State *s = MOS6522(v1s);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
s->ifr |= VIA1_IRQ_VBLANK; s->ifr |= VIA1_IRQ_VBLANK;
mdc->update_irq(s); mdc->update_irq(s);
@ -340,7 +340,7 @@ static void via1_one_second(void *opaque)
{ {
MOS6522Q800VIA1State *v1s = opaque; MOS6522Q800VIA1State *v1s = opaque;
MOS6522State *s = MOS6522(v1s); MOS6522State *s = MOS6522(v1s);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
s->ifr |= VIA1_IRQ_ONE_SECOND; s->ifr |= VIA1_IRQ_ONE_SECOND;
mdc->update_irq(s); mdc->update_irq(s);
@ -352,7 +352,7 @@ static void via1_irq_request(void *opaque, int irq, int level)
{ {
MOS6522Q800VIA1State *v1s = opaque; MOS6522Q800VIA1State *v1s = opaque;
MOS6522State *s = MOS6522(v1s); MOS6522State *s = MOS6522(v1s);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
if (level) { if (level) {
s->ifr |= 1 << irq; s->ifr |= 1 << irq;
@ -367,7 +367,7 @@ static void via2_irq_request(void *opaque, int irq, int level)
{ {
MOS6522Q800VIA2State *v2s = opaque; MOS6522Q800VIA2State *v2s = opaque;
MOS6522State *s = MOS6522(v2s); MOS6522State *s = MOS6522(v2s);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
if (level) { if (level) {
s->ifr |= 1 << irq; s->ifr |= 1 << irq;
@ -1183,7 +1183,7 @@ static TypeInfo mac_via_info = {
static void mos6522_q800_via1_reset(DeviceState *dev) static void mos6522_q800_via1_reset(DeviceState *dev)
{ {
MOS6522State *ms = MOS6522(dev); MOS6522State *ms = MOS6522(dev);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(ms);
mdc->parent_reset(dev); mdc->parent_reset(dev);
@ -1226,7 +1226,7 @@ static void mos6522_q800_via2_portB_write(MOS6522State *s)
static void mos6522_q800_via2_reset(DeviceState *dev) static void mos6522_q800_via2_reset(DeviceState *dev)
{ {
MOS6522State *ms = MOS6522(dev); MOS6522State *ms = MOS6522(dev);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(ms);
mdc->parent_reset(dev); mdc->parent_reset(dev);
@ -1246,7 +1246,7 @@ static void mos6522_q800_via2_init(Object *obj)
static void mos6522_q800_via2_class_init(ObjectClass *oc, void *data) static void mos6522_q800_via2_class_init(ObjectClass *oc, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc); MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);
dc->reset = mos6522_q800_via2_reset; dc->reset = mos6522_q800_via2_reset;
mdc->portB_write = mos6522_q800_via2_portB_write; mdc->portB_write = mos6522_q800_via2_portB_write;

View File

@ -96,7 +96,7 @@ static void cuda_set_sr_int(void *opaque)
CUDAState *s = opaque; CUDAState *s = opaque;
MOS6522CUDAState *mcs = &s->mos6522_cuda; MOS6522CUDAState *mcs = &s->mos6522_cuda;
MOS6522State *ms = MOS6522(mcs); MOS6522State *ms = MOS6522(mcs);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(ms);
mdc->set_sr_int(ms); mdc->set_sr_int(ms);
} }
@ -592,7 +592,7 @@ static void mos6522_cuda_portB_write(MOS6522State *s)
static void mos6522_cuda_reset(DeviceState *dev) static void mos6522_cuda_reset(DeviceState *dev)
{ {
MOS6522State *ms = MOS6522(dev); MOS6522State *ms = MOS6522(dev);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(ms);
mdc->parent_reset(dev); mdc->parent_reset(dev);
@ -603,7 +603,7 @@ static void mos6522_cuda_reset(DeviceState *dev)
static void mos6522_cuda_class_init(ObjectClass *oc, void *data) static void mos6522_cuda_class_init(ObjectClass *oc, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc); MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);
dc->reset = mos6522_cuda_reset; dc->reset = mos6522_cuda_reset;
mdc->portB_write = mos6522_cuda_portB_write; mdc->portB_write = mos6522_cuda_portB_write;

View File

@ -75,7 +75,7 @@ static void via_set_sr_int(void *opaque)
PMUState *s = opaque; PMUState *s = opaque;
MOS6522PMUState *mps = MOS6522_PMU(&s->mos6522_pmu); MOS6522PMUState *mps = MOS6522_PMU(&s->mos6522_pmu);
MOS6522State *ms = MOS6522(mps); MOS6522State *ms = MOS6522(mps);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(ms);
mdc->set_sr_int(ms); mdc->set_sr_int(ms);
} }
@ -834,7 +834,7 @@ static void mos6522_pmu_reset(DeviceState *dev)
MOS6522State *ms = MOS6522(dev); MOS6522State *ms = MOS6522(dev);
MOS6522PMUState *mps = container_of(ms, MOS6522PMUState, parent_obj); MOS6522PMUState *mps = container_of(ms, MOS6522PMUState, parent_obj);
PMUState *s = container_of(mps, PMUState, mos6522_pmu); PMUState *s = container_of(mps, PMUState, mos6522_pmu);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(ms);
mdc->parent_reset(dev); mdc->parent_reset(dev);
@ -847,7 +847,7 @@ static void mos6522_pmu_reset(DeviceState *dev)
static void mos6522_pmu_class_init(ObjectClass *oc, void *data) static void mos6522_pmu_class_init(ObjectClass *oc, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc); MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);
dc->reset = mos6522_pmu_reset; dc->reset = mos6522_pmu_reset;
mdc->portB_write = mos6522_pmu_portB_write; mdc->portB_write = mos6522_pmu_portB_write;

View File

@ -54,7 +54,7 @@ static void mos6522_update_irq(MOS6522State *s)
static uint64_t get_counter_value(MOS6522State *s, MOS6522Timer *ti) static uint64_t get_counter_value(MOS6522State *s, MOS6522Timer *ti)
{ {
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
if (ti->index == 0) { if (ti->index == 0) {
return mdc->get_timer1_counter_value(s, ti); return mdc->get_timer1_counter_value(s, ti);
@ -65,7 +65,7 @@ static uint64_t get_counter_value(MOS6522State *s, MOS6522Timer *ti)
static uint64_t get_load_time(MOS6522State *s, MOS6522Timer *ti) static uint64_t get_load_time(MOS6522State *s, MOS6522Timer *ti)
{ {
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
if (ti->index == 0) { if (ti->index == 0) {
return mdc->get_timer1_load_time(s, ti); return mdc->get_timer1_load_time(s, ti);
@ -313,7 +313,7 @@ uint64_t mos6522_read(void *opaque, hwaddr addr, unsigned size)
void mos6522_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) void mos6522_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
{ {
MOS6522State *s = opaque; MOS6522State *s = opaque;
MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(s); MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
trace_mos6522_write(addr, val); trace_mos6522_write(addr, val);
@ -498,7 +498,7 @@ static Property mos6522_properties[] = {
static void mos6522_class_init(ObjectClass *oc, void *data) static void mos6522_class_init(ObjectClass *oc, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc); MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);
dc->reset = mos6522_reset; dc->reset = mos6522_reset;
dc->vmsd = &vmstate_mos6522; dc->vmsd = &vmstate_mos6522;

View File

@ -140,9 +140,9 @@ typedef struct MOS6522DeviceClass {
uint64_t (*get_timer2_load_time)(MOS6522State *dev, MOS6522Timer *ti); uint64_t (*get_timer2_load_time)(MOS6522State *dev, MOS6522Timer *ti);
} MOS6522DeviceClass; } MOS6522DeviceClass;
#define MOS6522_DEVICE_CLASS(cls) \ #define MOS6522_CLASS(cls) \
OBJECT_CLASS_CHECK(MOS6522DeviceClass, (cls), TYPE_MOS6522) OBJECT_CLASS_CHECK(MOS6522DeviceClass, (cls), TYPE_MOS6522)
#define MOS6522_DEVICE_GET_CLASS(obj) \ #define MOS6522_GET_CLASS(obj) \
OBJECT_GET_CLASS(MOS6522DeviceClass, (obj), TYPE_MOS6522) OBJECT_GET_CLASS(MOS6522DeviceClass, (obj), TYPE_MOS6522)
extern const VMStateDescription vmstate_mos6522; extern const VMStateDescription vmstate_mos6522;