From: Mike Frysinger Date: Tue, 24 Jan 2012 18:05:48 -0500 Subject: [U-Boot] [PATCH v3 5/8] sandbox: Add concept of sandbox state In-Reply-To: <1327301333-30776-5-git-send-email-sjg@chromium.org> References: <1327301333-30776-1-git-send-email-sjg@chromium.org> <1327301333-30776-5-git-send-email-sjg@chromium.org> Message-ID: <201201241805.49081.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday 23 January 2012 01:48:50 Simon Glass wrote: > --- a/arch/sandbox/cpu/start.c > +++ b/arch/sandbox/cpu/start.c > > int main(int argc, char *argv[]) > { > + struct sandbox_state *state = NULL; > + int err; > + > + err = state_init(); > + if (!err) { > + state = state_get_current(); > + assert(state); > + } i guess a lot of this checking/plumbing only makes sense in the context of future work where the state represents a lot more stuff > --- /dev/null > +++ b/arch/sandbox/cpu/state.c > > +struct sandbox_state main_state; > +struct sandbox_state *state; /* Pointer to current state record */ static > +int state_is_processor_reset(void) > +{ > + return 1; > +} if the cpu is in reset, then u-boot is dead ... > +struct sandbox_state *state_get_current(void) > +{ > + assert(state); > + return state; > +} you assert() here and in main() ... i think we can get rid of the one in the main() func > --- /dev/null > +++ b/arch/sandbox/include/asm/arch-sandbox/state.h needs ifdef protection against multiple inclusion > +/* The complete state of the test system */ > +struct sandbox_state { > + const char *cmd; /* Command to execute */ > + enum exit_type_id exit_type; /* How we exited U-Boot */ > +}; the argc/argv given to main() should be in here -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: