[PATCH 1/2] Enable a way to provide the reason for "being here"

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Wed Jun 20 14:50:59 EDT 2012


On Wed, Jun 20, 2012 at 05:08:52PM +0200, Juergen Beisert wrote:
> Marc Kleine-Budde wrote:
> > [...]
> > > +
> > > +#include <common.h>
> > > +#include <init.h>
> > > +#include <environment.h>
> > > +#include <globalvar.h>
> > > +#include <reset_source.h>
> > > +
> > > +static const char name[] = "global.system.reset";
> > > +static const char unknown_reset[] = "unknown";
> > > +static const char power_on_reset[] = "POR";
> > > +static const char manual_reset[] = "RST";
> > > +static const char watchdog[] = "WDG";
> > > +static const char wake[] = "WKE";
> > > +static const char jtag[] = "JTAG";
> >
> > what about using an array
> >
> > static cost char *reset_reason_array[] = {
> > 	[RESET_UKWN] = "unknown",
> > 	...
> > };
> 
> The result is not the same. The strings are no longer "const". But it should 
<kidding>Of course they are not "const" if you write "cost".</kidding>
Using

	static const char * const reset_reason_array[] = {

should do the trick.
Having said that, I wonder what is the difference between

	static const char wake[] = "WKE";
	... use wake here ...

and

	... just use "WKE" ...

.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the barebox mailing list