On Tue, Oct 08, 2024 at 10:14:25AM +0100, Jonathan Cameron wrote: > Date: Tue, 8 Oct 2024 10:14:25 +0100 > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Subject: Re: [RFC v2 01/12] qdev: Allow qdev_device_add() to add specific > category device > X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) > > On Thu, 19 Sep 2024 14:11:17 +0800 > Zhao Liu <zhao1.liu@xxxxxxxxx> wrote: > > > Topology devices need to be created and realized before board > > initialization. > > > > Allow qdev_device_add() to specify category to help create topology > > devices early. > > > > Signed-off-by: Zhao Liu <zhao1.liu@xxxxxxxxx> > It's not immediately obvious what the category parameter is. > Can you use DeviceCategory rather than long? ... > > -DeviceState *qdev_device_add_from_qdict(const QDict *opts, > > +DeviceState *qdev_device_add_from_qdict(const QDict *opts, long *category, > > bool from_json, Error **errp) > > { > > ERRP_GUARD(); > > @@ -655,6 +655,10 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, > > return NULL; > > } > > > > + if (category && !test_bit(*category, dc->categories)) { > > + return NULL; > > + } > > + The category parameter is a bit not a bitmap, so, YES. Thanks, Zhao