[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 03/10] qdev: device module support
From: |
Christophe de Dinechin |
Subject: |
Re: [PATCH v5 03/10] qdev: device module support |
Date: |
Wed, 22 Jul 2020 10:05:51 +0200 |
User-agent: |
mu4e 1.5.2; emacs 26.3 |
On 2020-07-21 at 16:27 CEST, Gerd Hoffmann wrote...
> Hi,
>
>> > DeviceState *qdev_new(const char *name)
>> > {
>> > + if (!object_class_by_name(name)) {
>> > + module_load_qom_one(name);
>> > + }
>>
>> Curious why you don't you call module_object_class_by_name here?
>
> Because object_new() wants a name not an ObjectClass ...
I'm talking about the two lines above.
if (!object_class_by_name(name)) {
module_load_qom_one(name);
}
Thi9s code looks very similar to the code below:
ObjectClass *module_object_class_by_name(const char *typename)
{
ObjectClass *oc;
oc = object_class_by_name(typename);
#ifdef CONFIG_MODULES
if (!oc) {
module_load_qom_one(typename);
oc = object_class_by_name(typename);
}
#endif
return oc;
}
Both call module_load_qom_one and object_class_by_name using the name as
input, so I don't see the difference (except for the order).
Am I reading this wrong?
>
>> > return DEVICE(object_new(name));
>> > }
>
> take care,
> Gerd
--
Cheers,
Christophe de Dinechin (IRC c3d)