hw/core/generic-loader: Set a category for the generic-loader device
PATCH 1/1 hw/core/generic-loader: Set a category for the generic-loader device
Each device that is instantiatable by the users should be marked with a category. Since the generic-loader does not fit anywhere else, put it into the MISC category.
--- hw/core/generic-loader.c | 1 + 1 file changed, 1 insertion(+)
hw/core/generic-loader.c +1 -0
@@ -204,6 +204,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data) dc->unrealize = generic_loader_unrealize; dc->props = generic_loader_props; dc->desc ="Generic Loader" ; +set_bit (DEVICE_CATEGORY_MISC , dc->categories); }static TypeInfo generic_loader_info = {
Signature · 1 line
1.8.3.1
Quoted 14 lines · On Fri, 5 Oct 2018 11:42:26 +0200 Thomas Huth <[email protected]> wrote:
Each device that is instantiatable by the users should be marked with a category. Since the generic-loader does not fit anywhere else, put it into the MISC category.
Signed-off-by Thomas Huth <[email protected]>--- hw/core/generic-loader.c | 1 + 1 file changed, 1 insertion(+)hw/core/generic-loader.c +0
-0
hw/core/generic-loader.c static void generic_loader_class_init(ObjectClass *klass, void *data) · line 210
Quoted 7 lines
hw/core/generic-loader.c +1
-0@@ -204,6 +204,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data) dc->unrealize = generic_loader_unrealize; dc->props = generic_loader_props; dc->desc ="Generic Loader" ; +set_bit (DEVICE_CATEGORY_MISC , dc->categories); }static TypeInfo generic_loader_info = {
Quoted 6 lines · Thomas Huth
Each device that is instantiatable by the users should be marked with a category. Since the generic-loader does not fit anywhere else, put it into the MISC category.
Signed-off-by Thomas Huth <[email protected]>
Alistair
Quoted 20 lines
--- hw/core/generic-loader.c | 1 + 1 file changed, 1 insertion(+)hw/core/generic-loader.c +1
-1@@ -204,6 +204,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data) dc->unrealize = generic_loader_unrealize; dc->props = generic_loader_props; dc->desc ="Generic Loader" ; +set_bit (DEVICE_CATEGORY_MISC , dc->categories); }static TypeInfo generic_loader_info = { --1.8.3.1
Quoted 2 lines · Thomas Huth
Each device that is instantiatable by the users should be marked with a category.
Presumably we could assert() this somewhere (at which point we'd find that we have dozens of devices that fail to set a category bit, I imagine) ?
thanks
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Thomas Huth
Each device that is instantiatable by the users should be marked with a category.
Presumably we could
assert()this somewhere (at which point we'd find that we have dozens of devices that fail to set a category bit, I imagine) ?
You bet ... alone in qemu-system-aarch64, "-device help" shows more than 120 devices without a category...
So if we'd want to enforce this, there is a lot of clean-up work needed first. Once we're in a good shape, I think a "make check" test would be the right thing to enforce that future devices are always provided with a category.
Thomas
Quoted 9 lines · Thomas Huth
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Thomas Huth
Each device that is instantiatable by the users should be marked with a category.
Presumably we could
assert()this somewhere (at which point we'd find that we have dozens of devices that fail to set a category bit, I imagine) ?
Quoted 7 lines
You bet ... alone in qemu-system-aarch64, "-device help" shows more than 120 devices without a category...
So if we'd want to enforce this, there is a lot of clean-up work needed first. Once we're in a good shape, I think a "make check" test would be the right thing to enforce that future devices are always provided with a category.
Asserting in something like the device base class realize seems to me like a good approach -- that way it gets automatically covered by the existing test that tries to create every user creatable device (we do have one of those, right?), and developers of new devices will spot their error immediately even if they don't happen to run 'make check'.
thanks
-- PMM