Skip to content

Commit

Permalink
mos6522: use device_class_set_parent_reset() to propagate reset to pa…
Browse files Browse the repository at this point in the history
…rent

Switch from using a legacy approach to the more formal approach for propagating
device reset to the parent.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220305150957.5053-7-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  • Loading branch information
mcayland committed Mar 9, 2022
1 parent 9d9f4ea commit c697fc8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions hw/misc/mac_via.c
Expand Up @@ -1076,9 +1076,11 @@ static Property mos6522_q800_via1_properties[] = {
static void mos6522_q800_via1_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);

dc->realize = mos6522_q800_via1_realize;
dc->reset = mos6522_q800_via1_reset;
device_class_set_parent_reset(dc, mos6522_q800_via1_reset,
&mdc->parent_reset);
dc->vmsd = &vmstate_q800_via1;
device_class_set_props(dc, mos6522_q800_via1_properties);
}
Expand Down Expand Up @@ -1161,7 +1163,8 @@ static void mos6522_q800_via2_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);

dc->reset = mos6522_q800_via2_reset;
device_class_set_parent_reset(dc, mos6522_q800_via2_reset,
&mdc->parent_reset);
dc->vmsd = &vmstate_q800_via2;
mdc->portB_write = mos6522_q800_via2_portB_write;
}
Expand Down
3 changes: 2 additions & 1 deletion hw/misc/macio/cuda.c
Expand Up @@ -606,7 +606,8 @@ static void mos6522_cuda_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);

dc->reset = mos6522_cuda_reset;
device_class_set_parent_reset(dc, mos6522_cuda_reset,
&mdc->parent_reset);
mdc->portB_write = mos6522_cuda_portB_write;
mdc->get_timer1_counter_value = cuda_get_counter_value;
mdc->get_timer2_counter_value = cuda_get_counter_value;
Expand Down
3 changes: 2 additions & 1 deletion hw/misc/macio/pmu.c
Expand Up @@ -850,7 +850,8 @@ static void mos6522_pmu_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);

dc->reset = mos6522_pmu_reset;
device_class_set_parent_reset(dc, mos6522_pmu_reset,
&mdc->parent_reset);
mdc->portB_write = mos6522_pmu_portB_write;
mdc->portA_write = mos6522_pmu_portA_write;
}
Expand Down
1 change: 0 additions & 1 deletion hw/misc/mos6522.c
Expand Up @@ -519,7 +519,6 @@ static void mos6522_class_init(ObjectClass *oc, void *data)
dc->reset = mos6522_reset;
dc->vmsd = &vmstate_mos6522;
device_class_set_props(dc, mos6522_properties);
mdc->parent_reset = dc->reset;
mdc->portB_write = mos6522_portB_write;
mdc->portA_write = mos6522_portA_write;
mdc->get_timer1_counter_value = mos6522_get_counter_value;
Expand Down

0 comments on commit c697fc8

Please sign in to comment.