Re: [PATCH v3 1/6] libfdt: De-inline fdt_header_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Oct 24, 2019 at 09:29:20PM -0600, Simon Glass wrote:
> There does not seem to be a strong reason to inline this function. Also
> we are about to add some extra code to it which will increase its
> size.

Seems reasonable, but..

> Move it into fdt.c and use a simple declaration in libfdt.h

.. if you're going to do this, you can eliminate fdt_header_size_()
entirely.

Ugh.. wait.. no you can't, because ABI.

But speaking of ABI, I think we'll now need to add fdt_header_size()
to the version.lds.


> 
> Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx>
> ---
> 
> Changes in v3:
> - Add a new patch to de-inline fdt_header_size()
> 
> Changes in v2: None
> 
>  libfdt/fdt.c      | 5 +++++
>  libfdt/libfdt.h   | 9 +++++----
>  tests/testutils.c | 1 -
>  3 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/libfdt/fdt.c b/libfdt/fdt.c
> index d6ce7c0..3e37a4b 100644
> --- a/libfdt/fdt.c
> +++ b/libfdt/fdt.c
> @@ -70,6 +70,11 @@ size_t fdt_header_size_(uint32_t version)
>  		return FDT_V17_SIZE;
>  }
>  
> +size_t fdt_header_size(const void *fdt)
> +{
> +	return fdt_header_size_(fdt_version(fdt));
> +}
> +
>  int fdt_check_header(const void *fdt)
>  {
>  	size_t hdrsize;
> diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
> index fc4c496..48f375c 100644
> --- a/libfdt/libfdt.h
> +++ b/libfdt/libfdt.h
> @@ -266,11 +266,12 @@ fdt_set_hdr_(size_dt_struct);
>   * fdt_header_size - return the size of the tree's header
>   * @fdt: pointer to a flattened device tree
>   */
> +size_t fdt_header_size(const void *fdt);
> +
> +/**
> + * fdt_header_size_ - internal function which takes a version number
> + */
>  size_t fdt_header_size_(uint32_t version);
> -static inline size_t fdt_header_size(const void *fdt)
> -{
> -	return fdt_header_size_(fdt_version(fdt));
> -}
>  
>  /**
>   * fdt_check_header - sanity check a device tree header
> diff --git a/tests/testutils.c b/tests/testutils.c
> index 5e494c5..53cb35f 100644
> --- a/tests/testutils.c
> +++ b/tests/testutils.c
> @@ -261,7 +261,6 @@ void vg_prepare_blob(void *fdt, size_t bufsize)
>  
>  	VALGRIND_MAKE_MEM_UNDEFINED(blob, bufsize);
>  	VALGRIND_MAKE_MEM_DEFINED(blob, FDT_V1_SIZE);
> -	VALGRIND_MAKE_MEM_DEFINED(blob, fdt_header_size(fdt));
>  
>  	if (fdt_magic(fdt) == FDT_MAGIC) {
>  		off_strings = fdt_off_dt_strings(fdt);

-- 
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: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux