On Fri, Mar 03, 2017 at 06:23:15PM +0100, Cédric Le Goater wrote: > 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. You seem to be talking at cross purposes. AFAICT Thomas is not talking about the difference between a pointer and a non-pointer, he's talking about the difference between a generic Object (pointer or otherwise) and a concrete type. I agree with Thomas that a specific type is preferable. I'm not particularly bothered by the difference between pointer and non-pointer. In any case, this has missed the cutoff for qemu-2.9, I'm afraid. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson