On 03/03/2017 05:54 PM, Thomas Huth wrote: > On 03.03.2017 15:49, Cédric Le Goater wrote: >> On 03/03/2017 03:13 PM, Thomas Huth wrote: >>> On 03.03.2017 14:37, Cédric Le Goater wrote: >>>> Also use an 'Object *' under the sPAPR machine to hold the RTC >>>> object. >>> >>> The change from TYPE_SYS_BUS_DEVICE to TYPE_DEVICE is certainly a good >>> idea! But what's the advantage of using Object* instead of DeviceState* >>> in sPAPRMachineState ? >> >> it makes spapr_rtc_create() a little simpler. >> >> We could go even further and use a sPAPRRTCState under sPAPRMachineState >> that we would initialize with object_initialize(). > > I think a sPAPRRTCState* would make more sense here - if you just see an > Object* and are not familiar with the code, you wonder what this pointer > is all about (and you then have to cast it to something different if you > want to do anything with it) ... so IMHO either a DeviceState* or > sPAPRRTCState* is the better choice here.
I think having a non-pointer is a better for the object lifecycle but I don't have a strong opinion on that. We will see what Dave prefers. Thanks, C.