On Friday 30 October 2009, Nicolas Pitre wrote: > On Fri, 30 Oct 2009, David Brownell wrote: > > > @@ -906,7 +906,9 @@ static int arm926ejs_virt2phys(struct ta > > static int arm926ejs_mmu(struct target_s *target, int *enabled) > > { > > armv4_5_common_t *armv4_5 = target->arch_info; > > - arm926ejs_common_t *arm926ejs = armv4_5->arch_info; > > + arm7_9_common_t *arm7_9 = armv4_5->arch_info; > > + arm9tdmi_common_t *arm9tdmi = arm7_9->arch_info; > > + arm926ejs_common_t *arm926ejs = arm9tdmi->arch_info; > > > > if (target->state != TARGET_HALTED) > > { > > Well... > > I really don't like this pointer business. No type checking at all, > etc. This should be turned upside down as you suggested already: embed > more generic structures within the more specific ones, and copy the > container_of() macro from Linux to get at the outer structure when > needed.
I was working on such patches when I noticed this goof ... arm926ejs = target_to_arm926(target); without all that other crap is a *LOT* cleaner IMO. Very few of the functions need pointers to the "inner" structs; that idiom just makes things confusing. However, such changes would be wrong to merge before we finally let 0.3.x out the door. - Dave _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development