xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Vikram Garhwal <fnu.vikram@xilinx.com>
Cc: xen-devel@lists.xenproject.org, sstabellini@kernel.org,
	julien@xen.org,  bertrand.marquis@arm.com,
	volodymyr_babchuk@epam.com
Subject: Re: [XEN][PATCH 2/2] xen: libfdt: Changes to make libfdt v1.6.1 compatible with Xen
Date: Fri, 5 Nov 2021 13:33:57 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2111051333312.284830@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <1636136354-68413-3-git-send-email-fnu.vikram@xilinx.com>

On Fri, 5 Nov 2021, Vikram Garhwal wrote:
> A few minor changes are done to make it compatible with Xen:
>     fdt_overlay.c: overlay_fixup_phandle()
> 
>         Replace strtoul() with simple_strtoul() as strtoul() is not available in
>         Xen lib and included lib.h.
> 
>         Change char *endptr to const char *endptr.
> 
>     libfdt_env.h:
>         Changed path for config.h and stdbool.h. Remaining Xen changes to
>         libfdt_env.h carried over from existing libfdt (v1.4.0)
> 
> Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>

Thanks! All makes sense to me.


> ---
>  xen/common/libfdt/fdt_overlay.c     |  6 ++++--
>  xen/include/xen/libfdt/libfdt.h     |  4 ++--
>  xen/include/xen/libfdt/libfdt_env.h | 14 ++++++++------
>  3 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/xen/common/libfdt/fdt_overlay.c b/xen/common/libfdt/fdt_overlay.c
> index d217e79..7b95e2b 100644
> --- a/xen/common/libfdt/fdt_overlay.c
> +++ b/xen/common/libfdt/fdt_overlay.c
> @@ -8,6 +8,7 @@
>  
>  #include <fdt.h>
>  #include <libfdt.h>
> +#include <xen/lib.h>
>  
>  #include "libfdt_internal.h"
>  
> @@ -446,7 +447,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off,
>  		const char *fixup_str = value;
>  		uint32_t path_len, name_len;
>  		uint32_t fixup_len;
> -		char *sep, *endptr;
> +		char *sep;
> +		const char *endptr;
>  		int poffset, ret;
>  
>  		fixup_end = memchr(value, '\0', len);
> @@ -476,7 +478,7 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off,
>  		if (!name_len)
>  			return -FDT_ERR_BADOVERLAY;
>  
> -		poffset = strtoul(sep + 1, &endptr, 10);
> +		poffset = simple_strtoul(sep + 1, &endptr, 10);
>  		if ((*endptr != '\0') || (endptr <= (sep + 1)))
>  			return -FDT_ERR_BADOVERLAY;
>  
> diff --git a/xen/include/xen/libfdt/libfdt.h b/xen/include/xen/libfdt/libfdt.h
> index 73467f7..c71689e 100644
> --- a/xen/include/xen/libfdt/libfdt.h
> +++ b/xen/include/xen/libfdt/libfdt.h
> @@ -6,8 +6,8 @@
>   * Copyright (C) 2006 David Gibson, IBM Corporation.
>   */
>  
> -#include <libfdt_env.h>
> -#include <fdt.h>
> +#include <xen/libfdt/libfdt_env.h>
> +#include <xen/libfdt/fdt.h>
>  
>  #ifdef __cplusplus
>  extern "C" {
> diff --git a/xen/include/xen/libfdt/libfdt_env.h b/xen/include/xen/libfdt/libfdt_env.h
> index 73b6d40..03380d5 100644
> --- a/xen/include/xen/libfdt/libfdt_env.h
> +++ b/xen/include/xen/libfdt/libfdt_env.h
> @@ -7,12 +7,11 @@
>   * Copyright 2012 Kim Phillips, Freescale Semiconductor.
>   */
>  
> -#include <stdbool.h>
> -#include <stddef.h>
> -#include <stdint.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <limits.h>
> +#include <xen/config.h>
> +#include <xen/types.h>
> +#include <xen/string.h>
> +#include <asm/byteorder.h>
> +#include <xen/stdbool.h>
>  
>  #ifdef __CHECKER__
>  #define FDT_FORCE __attribute__((force))
> @@ -35,6 +34,9 @@ typedef uint64_t FDT_BITWISE fdt64_t;
>  			 (EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 16) | \
>  			 (EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7))
>  
> +/* Xen-specific libfdt error code. */
> +#define FDT_ERR_XEN(err) (FDT_ERR_MAX + (err))
> +
>  static inline uint16_t fdt16_to_cpu(fdt16_t x)
>  {
>  	return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
> -- 
> 2.7.4
> 


      reply	other threads:[~2021-11-05 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 18:19 [XEN][PATCH 0/2] Changes for libfdt v.1.6.1 Vikram Garhwal
2021-11-05 18:19 ` [XEN][PATCH 1/2] Update libfdt to v1.6.1 Vikram Garhwal
2021-11-05 18:19 ` [XEN][PATCH 2/2] xen: libfdt: Changes to make libfdt v1.6.1 compatible with Xen Vikram Garhwal
2021-11-05 20:33   ` Stefano Stabellini [this message]

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=alpine.DEB.2.22.394.2111051333312.284830@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=bertrand.marquis@arm.com \
    --cc=fnu.vikram@xilinx.com \
    --cc=julien@xen.org \
    --cc=volodymyr_babchuk@epam.com \
    --cc=xen-devel@lists.xenproject.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).