Reduce number of ALIGN macros defines and rename to avoid namespace clash
This commit is contained in:
parent
1a8ce3a63b
commit
97d12aea86
2
external/gpl2/dtc/dist/data.c
vendored
2
external/gpl2/dtc/dist/data.c
vendored
@ -233,7 +233,7 @@ struct data data_append_zeroes(struct data d, int len)
|
||||
|
||||
struct data data_append_align(struct data d, int align)
|
||||
{
|
||||
int newlen = ALIGN(d.len, align);
|
||||
int newlen = FDTALIGN2(d.len, align);
|
||||
return data_append_zeroes(d, newlen - d.len);
|
||||
}
|
||||
|
||||
|
2
external/gpl2/dtc/dist/dtc.h
vendored
2
external/gpl2/dtc/dist/dtc.h
vendored
@ -65,8 +65,6 @@ typedef uint32_t cell_t;
|
||||
#define streq(a, b) (strcmp((a), (b)) == 0)
|
||||
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
|
||||
|
||||
#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
||||
|
||||
/* Data blobs */
|
||||
enum markertype {
|
||||
REF_PHANDLE,
|
||||
|
2
external/gpl2/dtc/dist/fdtdump.c
vendored
2
external/gpl2/dtc/dist/fdtdump.c
vendored
@ -15,8 +15,6 @@
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
|
||||
#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a))))
|
||||
#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4)))
|
||||
|
||||
static const char *tagname(uint32_t tag)
|
||||
|
6
external/gpl2/dtc/dist/fdtput.c
vendored
6
external/gpl2/dtc/dist/fdtput.c
vendored
@ -128,7 +128,7 @@ static int encode_value(struct display_info *disp, char **arg, int arg_count,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ALIGN(x) (((x) + (FDT_TAGSIZE) - 1) & ~((FDT_TAGSIZE) - 1))
|
||||
#define FDTALIGN(x) (((x) + (FDT_TAGSIZE) - 1) & ~((FDT_TAGSIZE) - 1))
|
||||
|
||||
static char *_realloc_fdt(char *fdt, int delta)
|
||||
{
|
||||
@ -142,7 +142,7 @@ static char *realloc_node(char *fdt, const char *name)
|
||||
{
|
||||
int delta;
|
||||
/* FDT_BEGIN_NODE, node name in off_struct and FDT_END_NODE */
|
||||
delta = sizeof(struct fdt_node_header) + ALIGN(strlen(name) + 1)
|
||||
delta = sizeof(struct fdt_node_header) + FDTALIGN(strlen(name) + 1)
|
||||
+ FDT_TAGSIZE;
|
||||
return _realloc_fdt(fdt, delta);
|
||||
}
|
||||
@ -159,7 +159,7 @@ static char *realloc_property(char *fdt, int nodeoffset,
|
||||
|
||||
if (newlen > oldlen)
|
||||
/* actual value in off_struct */
|
||||
delta += ALIGN(newlen) - ALIGN(oldlen);
|
||||
delta += FDTALIGN(newlen) - FDTALIGN(oldlen);
|
||||
|
||||
return _realloc_fdt(fdt, delta);
|
||||
}
|
||||
|
4
external/gpl2/dtc/dist/flattree.c
vendored
4
external/gpl2/dtc/dist/flattree.c
vendored
@ -350,7 +350,7 @@ static void make_fdt_header(struct fdt_header *fdt,
|
||||
fdt->last_comp_version = cpu_to_fdt32(vi->last_comp_version);
|
||||
|
||||
/* Reserve map should be doubleword aligned */
|
||||
reserve_off = ALIGN(vi->hdr_size, 8);
|
||||
reserve_off = FDTALIGN2(vi->hdr_size, 8);
|
||||
|
||||
fdt->off_mem_rsvmap = cpu_to_fdt32(reserve_off);
|
||||
fdt->off_dt_struct = cpu_to_fdt32(reserve_off + reservesize);
|
||||
@ -613,7 +613,7 @@ static void flat_realign(struct inbuf *inb, int align)
|
||||
{
|
||||
int off = inb->ptr - inb->base;
|
||||
|
||||
inb->ptr = inb->base + ALIGN(off, align);
|
||||
inb->ptr = inb->base + FDTALIGN2(off, align);
|
||||
if (inb->ptr > inb->limit)
|
||||
die("Premature end of data parsing flat device tree\n");
|
||||
}
|
||||
|
2
external/gpl2/dtc/dist/srcpos.c
vendored
2
external/gpl2/dtc/dist/srcpos.c
vendored
@ -226,7 +226,7 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
|
||||
current_srcfile->colno = 1;
|
||||
} else if (text[i] == '\t') {
|
||||
current_srcfile->colno =
|
||||
ALIGN(current_srcfile->colno, TAB_SIZE);
|
||||
FDTALIGN2(current_srcfile->colno, TAB_SIZE);
|
||||
} else {
|
||||
current_srcfile->colno++;
|
||||
}
|
||||
|
2
external/gpl2/dtc/dist/tests/mangle-layout.c
vendored
2
external/gpl2/dtc/dist/tests/mangle-layout.c
vendored
@ -95,7 +95,7 @@ static void add_block(struct bufstate *buf, int version, char block, const void
|
||||
}
|
||||
|
||||
oldsize = buf->size;
|
||||
offset = ALIGN(oldsize, align);
|
||||
offset = FDTALIGN2(oldsize, align);
|
||||
expand_buf(buf, offset+size);
|
||||
memset(buf->buf + oldsize, 0, offset - oldsize);
|
||||
|
||||
|
2
external/gpl2/dtc/dist/tests/move_and_save.c
vendored
2
external/gpl2/dtc/dist/tests/move_and_save.c
vendored
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
|
||||
fdt = load_blob_arg(argc, argv);
|
||||
inname = argv[1];
|
||||
|
||||
shuntsize = ALIGN(fdt_totalsize(fdt) / 2, sizeof(uint64_t));
|
||||
shuntsize = FDTALIGN2(fdt_totalsize(fdt) / 2, sizeof(uint64_t));
|
||||
bufsize = fdt_totalsize(fdt) + shuntsize;
|
||||
buf = xmalloc(bufsize);
|
||||
|
||||
|
4
external/gpl2/dtc/dist/tests/tests.h
vendored
4
external/gpl2/dtc/dist/tests/tests.h
vendored
@ -32,8 +32,8 @@ extern int verbose_test;
|
||||
extern char *test_name;
|
||||
void test_init(int argc, char *argv[]);
|
||||
|
||||
#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
||||
#define PALIGN(p, a) ((void *)ALIGN((unsigned long)(p), (a)))
|
||||
#define FDTALIGN2(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
||||
#define PALIGN(p, a) ((void *)FDTALIGN2((unsigned long)(p), (a)))
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
#define streq(s1, s2) (strcmp((s1),(s2)) == 0)
|
||||
|
2
external/gpl2/dtc/dist/util.h
vendored
2
external/gpl2/dtc/dist/util.h
vendored
@ -26,6 +26,8 @@
|
||||
*/
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define FDTALIGN2(x, a) (((x) + (a) - 1) & ~((a) - 1))
|
||||
#define PALIGN(p, a) ((void *)(FDTALIGN2((unsigned long)(p), (a))))
|
||||
|
||||
static inline void __attribute__((noreturn)) die(const char *str, ...)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user