Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47605971 authored by Rob Herring's avatar Rob Herring
Browse files

scripts/dtc: Update to upstream version 9d3649bd3be245c9



Sync dtc with upstream as of commit 9d3649bd3be2 (Add testcases for
fdt_path_offset_namelen()).

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: devicetree@vger.kernel.org
parent f1ec7187
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ struct check {
	void *data;
	bool warn, error;
	enum checkstatus status;
	int inprogress;
	bool inprogress;
	int num_prereqs;
	struct check **prereq;
};
@@ -113,6 +113,7 @@ static inline void check_msg(struct check *c, const char *fmt, ...)
		vfprintf(stderr, fmt, ap);
		fprintf(stderr, "\n");
	}
	va_end(ap);
}

#define FAIL(c, ...) \
@@ -141,9 +142,9 @@ static void check_nodes_props(struct check *c, struct node *dt, struct node *nod
		check_nodes_props(c, dt, child);
}

static int run_check(struct check *c, struct node *dt)
static bool run_check(struct check *c, struct node *dt)
{
	int error = 0;
	bool error = false;
	int i;

	assert(!c->inprogress);
@@ -151,11 +152,11 @@ static int run_check(struct check *c, struct node *dt)
	if (c->status != UNCHECKED)
		goto out;

	c->inprogress = 1;
	c->inprogress = true;

	for (i = 0; i < c->num_prereqs; i++) {
		struct check *prq = c->prereq[i];
		error |= run_check(prq, dt);
		error = error || run_check(prq, dt);
		if (prq->status != PASSED) {
			c->status = PREREQ;
			check_msg(c, "Failed prerequisite '%s'",
@@ -177,9 +178,9 @@ static int run_check(struct check *c, struct node *dt)
	TRACE(c, "\tCompleted, status %d", c->status);

out:
	c->inprogress = 0;
	c->inprogress = false;
	if ((c->status != PASSED) && (c->error))
		error = 1;
		error = true;
	return error;
}

@@ -624,11 +625,11 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt,
	if (!reg && !ranges)
		return;

	if ((node->parent->addr_cells == -1))
	if (node->parent->addr_cells == -1)
		FAIL(c, "Relying on default #address-cells value for %s",
		     node->fullpath);

	if ((node->parent->size_cells == -1))
	if (node->parent->size_cells == -1)
		FAIL(c, "Relying on default #size-cells value for %s",
		     node->fullpath);
}
@@ -706,15 +707,15 @@ static void disable_warning_error(struct check *c, bool warn, bool error)
	c->error = c->error && !error;
}

void parse_checks_option(bool warn, bool error, const char *optarg)
void parse_checks_option(bool warn, bool error, const char *arg)
{
	int i;
	const char *name = optarg;
	const char *name = arg;
	bool enable = true;

	if ((strncmp(optarg, "no-", 3) == 0)
	    || (strncmp(optarg, "no_", 3) == 0)) {
		name = optarg + 3;
	if ((strncmp(arg, "no-", 3) == 0)
	    || (strncmp(arg, "no_", 3) == 0)) {
		name = arg + 3;
		enable = false;
	}

@@ -733,7 +734,7 @@ void parse_checks_option(bool warn, bool error, const char *optarg)
	die("Unrecognized check name \"%s\"\n", name);
}

void process_checks(int force, struct boot_info *bi)
void process_checks(bool force, struct boot_info *bi)
{
	struct node *dt = bi->dt;
	int i;
+6 −6
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
	struct data d;
	char *q;

	d = data_grow_for(empty_data, strlen(s)+1);
	d = data_grow_for(empty_data, len + 1);

	q = d.val;
	while (i < len) {
@@ -250,20 +250,20 @@ struct data data_add_marker(struct data d, enum markertype type, char *ref)
	return data_append_markers(d, m);
}

int data_is_one_string(struct data d)
bool data_is_one_string(struct data d)
{
	int i;
	int len = d.len;

	if (len == 0)
		return 0;
		return false;

	for (i = 0; i < len-1; i++)
		if (d.val[i] == '\0')
			return 0;
			return false;

	if (d.val[len-1] != '\0')
		return 0;
		return false;

	return 1;
	return true;
}
+52 −13
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@

%option noyywrap nounput noinput never-interactive

%x INCLUDE
%x BYTESTRING
%x PROPNODENAME
%s V1
@@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
#include "dtc-parser.tab.h"

YYLTYPE yylloc;
extern bool treesource_error;

/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
#define	YY_USER_ACTION \
@@ -61,7 +61,8 @@ static int dts_version = 1;
				BEGIN(V1); \

static void push_input_file(const char *filename);
static int pop_input_file(void);
static bool pop_input_file(void);
static void lexical_error(const char *fmt, ...);
%}

%%
@@ -75,11 +76,11 @@ static int pop_input_file(void);
			char *line, *tmp, *fn;
			/* skip text before line # */
			line = yytext;
			while (!isdigit(*line))
			while (!isdigit((unsigned char)*line))
				line++;
			/* skip digits in line # */
			tmp = line;
			while (!isspace(*tmp))
			while (!isspace((unsigned char)*tmp))
				tmp++;
			/* "NULL"-terminate line # */
			*tmp = '\0';
@@ -146,15 +147,42 @@ static int pop_input_file(void);
		}

<V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
			yylval.literal = xstrdup(yytext);
			DPRINT("Literal: '%s'\n", yylval.literal);
			char *e;
			DPRINT("Integer Literal: '%s'\n", yytext);

			errno = 0;
			yylval.integer = strtoull(yytext, &e, 0);

			assert(!(*e) || !e[strspn(e, "UL")]);

			if (errno == ERANGE)
				lexical_error("Integer literal '%s' out of range",
					      yytext);
			else
				/* ERANGE is the only strtoull error triggerable
				 *  by strings matching the pattern */
				assert(errno == 0);
			return DT_LITERAL;
		}

<*>{CHAR_LITERAL}	{
			yytext[yyleng-1] = '\0';
			yylval.literal = xstrdup(yytext+1);
			DPRINT("Character literal: %s\n", yylval.literal);
			struct data d;
			DPRINT("Character literal: %s\n", yytext);

			d = data_copy_escape_string(yytext+1, yyleng-2);
			if (d.len == 1) {
				lexical_error("Empty character literal");
				yylval.integer = 0;
				return DT_CHAR_LITERAL;
			}

			yylval.integer = (unsigned char)d.val[0];

			if (d.len > 2)
				lexical_error("Character literal has %d"
					      " characters instead of 1",
					      d.len - 1);

			return DT_CHAR_LITERAL;
		}

@@ -164,7 +192,7 @@ static int pop_input_file(void);
			return DT_REF;
		}

<*>"&{/"{PATHCHAR}+\}	{	/* new-style path reference */
<*>"&{/"{PATHCHAR}*\}	{	/* new-style path reference */
			yytext[yyleng-1] = '\0';
			DPRINT("Ref: %s\n", yytext+2);
			yylval.labelref = xstrdup(yytext+2);
@@ -238,13 +266,24 @@ static void push_input_file(const char *filename)
}


static int pop_input_file(void)
static bool pop_input_file(void)
{
	if (srcfile_pop() == 0)
		return 0;
		return false;

	yypop_buffer_state();
	yyin = current_srcfile->f;

	return 1;
	return true;
}

static void lexical_error(const char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	srcpos_verror(&yylloc, "Lexical error", fmt, ap);
	va_end(ap);

	treesource_error = true;
}
+278 −238

File changed.

Preview size limit exceeded, changes collapsed.

+832 −941

File changed.

Preview size limit exceeded, changes collapsed.

Loading