1*134e0944SPeter Maydell// Convert opencoded DeviceClass::reset assignments to calls to 2*134e0944SPeter Maydell// device_class_set_legacy_reset() 3*134e0944SPeter Maydell// 4*134e0944SPeter Maydell// Copyright Linaro Ltd 2024 5*134e0944SPeter Maydell// This work is licensed under the terms of the GNU GPLv2 or later. 6*134e0944SPeter Maydell// 7*134e0944SPeter Maydell// spatch --macro-file scripts/cocci-macro-file.h \ 8*134e0944SPeter Maydell// --sp-file scripts/coccinelle/device-reset.cocci \ 9*134e0944SPeter Maydell// --keep-comments --smpl-spacing --in-place --include-headers --dir hw 10*134e0944SPeter Maydell// 11*134e0944SPeter Maydell// For simplicity we assume some things about the code we're modifying 12*134e0944SPeter Maydell// that happen to be true for all our targets: 13*134e0944SPeter Maydell// * all cpu_class_set_parent_reset() callsites have a 'DeviceClass *dc' local 14*134e0944SPeter Maydell// * the parent reset field in the target CPU class is 'parent_reset' 15*134e0944SPeter Maydell// * no reset function already has a 'dev' local 16*134e0944SPeter Maydell 17*134e0944SPeter Maydell@@ 18*134e0944SPeter Maydellidentifier dc, resetfn; 19*134e0944SPeter Maydell@@ 20*134e0944SPeter Maydell DeviceClass *dc; 21*134e0944SPeter Maydell ... 22*134e0944SPeter Maydell- dc->reset = resetfn; 23*134e0944SPeter Maydell+ device_class_set_legacy_reset(dc, resetfn); 24*134e0944SPeter Maydell@@ 25*134e0944SPeter Maydellidentifier dc, resetfn; 26*134e0944SPeter Maydell@@ 27*134e0944SPeter Maydell DeviceClass *dc; 28*134e0944SPeter Maydell ... 29*134e0944SPeter Maydell- dc->reset = &resetfn; 30*134e0944SPeter Maydell+ device_class_set_legacy_reset(dc, resetfn); 31