mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH 1/2] Enable a way to provide the reason for "being here"
Date: Wed, 20 Jun 2012 21:09:53 +0200	[thread overview]
Message-ID: <201206202109.54078.jbe@pengutronix.de> (raw)
In-Reply-To: <20120620185059.GC5642@pengutronix.de>

Hi Uwe,

Uwe Kleine-König wrote:
> 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.

No, it doesn't. Only this would:

static const bla[] = "this is a really constant string";
static const char * const reset_reason_array[] = {
	[0] = bla,
[...]
};

But its ugly. So I will prefer Marc's suggestion.

> Having said that, I wonder what is the difference between
>
> 	static const char wake[] = "WKE";
> 	... use wake here ...
>
> and
>
> 	... just use "WKE" ...

Just based on how U-Boot does it.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-5121-206917-5128 |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-06-20 19:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 14:32 [PATCH] " Juergen Beisert
2012-06-20 14:32 ` [PATCH 1/2] " Juergen Beisert
2012-06-20 14:53   ` Marc Kleine-Budde
2012-06-20 15:08     ` Juergen Beisert
2012-06-20 18:50       ` Uwe Kleine-König
2012-06-20 19:09         ` Juergen Beisert [this message]
2012-06-20 19:27           ` Uwe Kleine-König
2012-06-20 19:59             ` Juergen Beisert
2012-06-20 20:09               ` Uwe Kleine-König
2012-06-20 20:57                 ` Juergen Beisert
2012-06-20 14:32 ` [PATCH 2/2] Add two architectures which can detect the reset source Juergen Beisert
2012-06-20 14:59   ` Marc Kleine-Budde
2012-06-20 15:05     ` Juergen Beisert
2012-06-20 15:09       ` Marc Kleine-Budde
2012-06-21  9:16 [PATCHv2] Enable a way to provide the reason for "being here" Juergen Beisert
2012-06-21  9:16 ` [PATCH 1/2] " Juergen Beisert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201206202109.54078.jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox