[PATCH 2/4] sandbox: only access of_add_memory_bank if it's defined

Alexander Aring alex.aring at gmail.com
Thu Jun 26 02:43:56 PDT 2014


On Thu, Jun 26, 2014 at 11:37:01AM +0200, Alexander Aring wrote:
> Hi Holger,
> 
> can you please check if this is also a solution for this?
> 
> diff --git a/include/of.h b/include/of.h
> index e6993fd..76845e7 100644
> --- a/include/of.h
> +++ b/include/of.h
> @@ -227,7 +227,14 @@ int of_parse_partitions(struct cdev *cdev, struct device_node *node);
>  int of_device_is_stdout_path(struct device_d *dev);
>  const char *of_get_model(void);
>  void *of_flatten_dtb(struct device_node *node);
> +#ifdef CONFIG_OFTREE_MEM_GENERIC
>  int of_add_memory(struct device_node *node, bool dump);
> +#else
> +static inline int of_add_memory(struct device_node *node, bool dump)
> +{
> +       return -EINVAL;
> +}
> +#endif
>  void of_add_memory_bank(struct device_node *node, bool dump, int r,
>                 u64 base, u64 size);
>  struct device_d *of_find_device_by_node_path(const char *path);
> 
> 
> 

Okay the implementation "#ifdef CONFIG_OFTREE_MEM_GENERIC" for function
of_add_memory, need to be there.

Other option would be to put this function in a separete file which
depends on CONFIG_OFTREE_MEM_GENERIC and do in the header file the above
solution one. Don't know if this is better. Then you could drop the
#ifdef CONFIG_OFTREE_MEM_GENERIC from the implementation.

- Alex



More information about the barebox mailing list