Skip to contentSkip to conversation

target/avr/cpu: Use device_class_set_parent_realize()

PATCH Applied Philippe Mathieu-Daudé 3 participants 3 messages Feb 1, 2021 – Feb 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/avr/cpu: Use device_class_set_parent_realize()

Change generated automatically using the Coccinelle patch included in commit bf853881690 ("qdev: use device_class_set_parent_realize/unrealize/reset()")

---
 target/avr/cpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/avr/cpu.c +1 -3
index 6f3d5a9e4a7..e60036e41ef 100644
@@ -190,9 +190,7 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
     CPUClass *cc = CPU_CLASS(oc);
     AVRCPUClass *mcc = AVR_CPU_CLASS(oc);
 
-    mcc->parent_realize = dc->realize;
-    dc->realize = avr_cpu_realizefn;
-
+    device_class_set_parent_realize(dc, avr_cpu_realizefn, &mcc->parent_realize);
     device_class_set_parent_reset(dc, avr_cpu_reset, &mcc->parent_reset);
 
     cc->class_by_name = avr_cpu_class_by_name;
Signature · 1 line
2.26.2
#2 lore raw
In reply to Philippe Mathieu-Daudé

Le 01/02/2021 à 09:03, Philippe Mathieu-Daudé a écrit :

Quoted 15 lines

Change generated automatically using the Coccinelle patch included in commit bf853881690 ("qdev: use device_class_set_parent_realize/unrealize/reset()")

---
 target/avr/cpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/avr/cpu.c +0 -0
index 6f3d5a9e4a7..e60036e41ef 100644

target/avr/cpu.c static void avr_cpu_class_init(ObjectClass *oc, void *data) · line 196

Quoted 10 lines
target/avr/cpu.c +1 -3
@@ -190,9 +190,7 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
     CPUClass *cc = CPU_CLASS(oc);
     AVRCPUClass *mcc = AVR_CPU_CLASS(oc);
 
-    mcc->parent_realize = dc->realize;
-    dc->realize = avr_cpu_realizefn;
-
+    device_class_set_parent_realize(dc, avr_cpu_realizefn, &mcc->parent_realize);
     device_class_set_parent_reset(dc, avr_cpu_reset, &mcc->parent_reset);
 
     cc->class_by_name = avr_cpu_class_by_name;

Applied to my trivial-patches branch.

Thanks,
Laurent