Subject: Re: [PATCH 2/3] Use embedded libfdt in the bootwrapper

From: Scott Wood <[email-masked]>
Date: Mon, 10 Dec 2007 11:32:17 -0600

On Mon, Dec 10, 2007 at 02:28:39PM +1100, David Gibson wrote:
> +#define check_err(err) \
> +	({ \
> +		if (BAD_ERROR(err) || ((err < 0) && DEBUG)) \
> +			printf("%s():%d  %s\n\r", __FUNCTION__, __LINE__, \
> +			       fdt_strerror(err)); \
> +		if (BAD_ERROR(err)) \
> +			exit(); \
> +		(err < 0) ? -1 : 0; \
> +	})
> +
> +#define offset_devp(off)	\
> +	({ \
> +		int offset = (off); \
> +		check_err(offset) ? NULL : (void *)(offset+1); \
> +	})
> +
> +#define devp_offset(devp)	(((int)(devp))-1)

How does using offsets as devps work if a devp was previously acquired to a
node that has to be moved due to a change later made in an earlier part of
the tree?

-Scott