devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Devicetree Compiler
	<devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v6 2/8] Add a way to control the level of checks in the code
Date: Wed, 12 Feb 2020 15:35:45 +1100	[thread overview]
Message-ID: <20200212043545.GR22584@umbus.fritz.box> (raw)
In-Reply-To: <20200211200945.46606-3-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

On Tue, Feb 11, 2020 at 01:09:39PM -0700, Simon Glass wrote:
> Add a new ASSUME_MASK option, which allows for some control over the
> checks used in libfdt. With all assumptions enabled, libfdt assumes that
> the input data and parameters are all correct and that internal errors
> cannot happen.
> 
> By default no assumptions are made and all checks are enabled.
> 
> Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

LGTM, except...

[snip]
> +	/*
> +	 * This assumes that the device tree components appear in the correct
> +	 * order. As such it disables a check in fdt_open_into() and removes the
> +	 * ability to fix the problem there. This is safe if you know that the
> +	 * device tree is correctly ordered. See fdt_blocks_misordered_().
> +	 */
> +	ASSUME_CORRECT_ORDER	= 1 << 4,

.. I don't like this name.  The spec doesn't specify an order, so
having it in a different order isn't incorrect, just a bit harder to
work with.

> +};
> +
> +/**
> + * can_assume_() - check if a particular assumption is enabled
> + *
> + * @mask: Mask to check (ASSUME_...)
> + * @return true if that assumption is enabled, else false
> + */
> +static inline bool can_assume_(int mask)
> +{
> +	return FDT_ASSUME_MASK & mask;
> +}
> +
> +/** helper macros for checking assumptions */
> +#define can_assume(_assume)	can_assume_(ASSUME_ ## _assume)
> +
>  #endif /* LIBFDT_INTERNAL_H */

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2020-02-12  4:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 20:09 [PATCH v6 0/8] libfdt: Allow more control of code size Simon Glass
     [not found] ` <20200211200945.46606-1-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2020-02-11 20:09   ` [PATCH v6 1/8] libfdt: De-inline fdt_header_size() Simon Glass
     [not found]     ` <20200211200945.46606-2-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2020-02-12  4:15       ` David Gibson
2020-02-11 20:09   ` [PATCH v6 2/8] Add a way to control the level of checks in the code Simon Glass
     [not found]     ` <20200211200945.46606-3-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2020-02-12  4:35       ` David Gibson [this message]
2020-02-11 20:09   ` [PATCH v6 3/8] libfdt: Add support for disabling dtb checks Simon Glass
     [not found]     ` <20200211200945.46606-4-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2020-02-12  4:38       ` David Gibson
2020-02-11 20:09   ` [PATCH v6 4/8] libfdt: Add support for disabling sanity checks Simon Glass
     [not found]     ` <20200211200945.46606-5-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2020-02-12  4:57       ` David Gibson
2020-02-11 20:09   ` [PATCH v6 5/8] libfdt: Add support for disabling rollback handling Simon Glass
2020-02-11 20:09   ` [PATCH v6 6/8] libfdt: Add support for disabling version checks Simon Glass
2020-02-11 20:09   ` [PATCH v6 7/8] libfdt: Add support for disabling ordering check/fixup Simon Glass
     [not found]     ` <20200211200945.46606-8-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2020-02-12  4:57       ` David Gibson
     [not found]         ` <CAPnjgZ2BtNuFX0TG_7G0ydJ5jbBOQxUHgf0Khrs0snOkpkb-Wg@mail.gmail.com>
     [not found]           ` <CAPnjgZ2BtNuFX0TG_7G0ydJ5jbBOQxUHgf0Khrs0snOkpkb-Wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-12  5:39             ` David Gibson
2020-02-11 20:09   ` [PATCH v6 8/8] libfdt: Allow exclusion of fdt_check_full() Simon Glass

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=20200212043545.GR22584@umbus.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).