bootstage: Adjust to use const * where possible

There are a few places that should use const *, such as
bootstage_unstash(). Update these to make it clearer when parameters are
changed.

Signed-off-by: Simon Glass <sjg@chromium.org>
master
Simon Glass 7 years ago committed by Tom Rini
parent e003310a76
commit 9d2542d062
  1. 12
      common/bootstage.c
  2. 4
      include/bootstage.h

@ -205,7 +205,7 @@ uint32_t bootstage_accum(enum bootstage_id id)
* @return pointer to name, either from the record or pointing to buf. * @return pointer to name, either from the record or pointing to buf.
*/ */
static const char *get_record_name(char *buf, int len, static const char *get_record_name(char *buf, int len,
struct bootstage_record *rec) const struct bootstage_record *rec)
{ {
if (rec->name) if (rec->name)
return rec->name; return rec->name;
@ -361,9 +361,9 @@ static void append_data(char **ptrp, char *end, const void *data, int size)
int bootstage_stash(void *base, int size) int bootstage_stash(void *base, int size)
{ {
struct bootstage_data *data = gd->bootstage; const struct bootstage_data *data = gd->bootstage;
struct bootstage_hdr *hdr = (struct bootstage_hdr *)base; struct bootstage_hdr *hdr = (struct bootstage_hdr *)base;
struct bootstage_record *rec; const struct bootstage_record *rec;
char buf[20]; char buf[20];
char *ptr = base, *end = ptr + size; char *ptr = base, *end = ptr + size;
uint32_t count; uint32_t count;
@ -414,12 +414,12 @@ int bootstage_stash(void *base, int size)
return 0; return 0;
} }
int bootstage_unstash(void *base, int size) int bootstage_unstash(const void *base, int size)
{ {
const struct bootstage_hdr *hdr = (struct bootstage_hdr *)base;
struct bootstage_data *data = gd->bootstage; struct bootstage_data *data = gd->bootstage;
struct bootstage_hdr *hdr = (struct bootstage_hdr *)base; const char *ptr = base, *end = ptr + size;
struct bootstage_record *rec; struct bootstage_record *rec;
char *ptr = base, *end = ptr + size;
uint rec_size; uint rec_size;
int i; int i;

@ -333,7 +333,7 @@ int bootstage_stash(void *base, int size);
* there is not space for read the stacked data, or other error if * there is not space for read the stacked data, or other error if
* something else went wrong * something else went wrong
*/ */
int bootstage_unstash(void *base, int size); int bootstage_unstash(const void *base, int size);
/** /**
* bootstage_get_size() - Get the size of the bootstage data * bootstage_get_size() - Get the size of the bootstage data
@ -406,7 +406,7 @@ static inline int bootstage_stash(void *base, int size)
return 0; /* Pretend to succeed */ return 0; /* Pretend to succeed */
} }
static inline int bootstage_unstash(void *base, int size) static inline int bootstage_unstash(const void *base, int size)
{ {
return 0; /* Pretend to succeed */ return 0; /* Pretend to succeed */
} }

Loading…
Cancel
Save