[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qom: remove unused field
From: |
Peter Maydell |
Subject: |
Re: [PATCH] qom: remove unused field |
Date: |
Tue, 7 Jan 2025 11:23:08 +0000 |
On Tue, 7 Jan 2025 at 11:14, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The "concrete_class" field of InterfaceClass is only ever written, and as far
> as I can tell is not particularly useful when debugging either; remove it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
I think the reason to have the field would be if we supported
"given a pointer to an interface class, get the concrete
class"; e.g. supposing i have a ResettableClass *rc it would
be nice to be able to do
DeviceClass *dc = DEVICE_CLASS(rc);
(asserting if your rc isn't actually one provided by a
DeviceClass, obviously). This doesn't currently work because
we don't have the code to actually do this, but apparently
GObject's object model does support this. See this thread from
a few years back:
https://lore.kernel.org/qemu-devel/CAFEAcA8Q3XZrdLJhJ4Uj1CX6J04ON9f91p=NuJXxA+cnEfdz6Q@mail.gmail.com/
But we've lived without this forever (and the thing I wanted
it for back then I ended up not needing), so it seems fine to
remove the field now; easy enough to put it back in future
if somebody does decide to implement cast-to-concrete-class.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM