On 20/5/26 18:45, Peter Maydell wrote:
On Wed, 20 May 2026 at 17:33, Philippe Mathieu-Daudé <[email protected]> wrote:
Hi Yucai,
On 27/4/26 14:47, Peter Maydell wrote:
+static void imx6ul_lcdif_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ dc->realize = imx6ul_lcdif_realize;
+ dc->unrealize = imx6ul_lcdif_unrealize;
+ dc->vmsd = &vmstate_imx6ul_lcdif;
+ device_class_set_legacy_reset(dc, imx6ul_lcdif_reset);
Please do not use the legacy API. See for example this commit
to convert to the newer API:
https://gitlab.com/qemu-project/qemu/-/commit/ce788d3740f
There's not really a problem with continuing to use the legacy
reset API for this kind of "leaf class" device. It has identical
semantics to just providing a 3-phase "hold" reset method, the
compatibility-code is trivial and not a big maintenance burden,
and we're unlikely to convert all 400+ existing users. (Unless
somebody figures out a Coccinelle script for it, in which case
it's just one more file being autoconverted. IIRC the hitch
I ran into was that you need to determine whether the reset
function is called by any other code -- those are probably
not autoconvertible in the way "function only used as the
argument to device_class_legacy_reset()" could be.)
Then I don't understand why we named it "legacy". Maybe rename
as device_class_set_leaf_reset()...
This is not about converting the 400 uses; I'd expect a legacy
API to not be re-introduced over and over.
What about gating this call via checkpatch.pl?