On Fri, Aug 03, 2012 at 05:13:48PM +0200, Andreas Färber wrote: > Am 03.08.2012 04:31, schrieb David Gibson: > > On Thu, Aug 02, 2012 at 05:44:49PM +0200, Andreas Färber wrote: > >> Am 02.08.2012 04:10, schrieb David Gibson: [snip] > >>> -static void spapr_cpu_reset(void *opaque) > >>> -{ > >>> - PowerPCCPU *cpu = opaque; > >>> - CPUPPCState *env = &cpu->env; > >>> + PowerPCCPU *cpu = container_of(env, PowerPCCPU, env); > >> > >> NACK. Please don't undo the cleanups I have applied! Functions should > >> take a QOM PowerPCCPU, not its internal CPUPPCState. Fields are > >> gradually being moved from CPUxxxState into CPUState. > > > > Um, ok. So how do I iterate the PowerPCCPUs instead of the CPUPPCStates? > > You can't, yet. The QOM CPUState part 4 series (that got stalled due to > APIC modelling) moved quite some fields to CPUState but not enough to > change the first_cpu type despite the really long (74?) series. > > So the solution here is to iterate the CPUPPCState, call > ppc_env_get_cpu() on it and pass that as opaque as before.
So, move the container_of to the caller and use the wrapper for it (I thought one might exist, but I hadn't spotted it). Ok, I can do that. > I could add a cpu_foreach() function though if that helps in the > meantime? Either way the idea is to limit the number of places to touch > in the upcoming refactorings. If you like, but I'm not planning to delay these patches to wait for it. -- 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