Re: [PATCH 1/1] board: Fixed compilation of board.c

2017-03-22 Thread Greg KH
On Wed, Mar 22, 2017 at 03:03:20PM +0100, Artur Lorincz wrote:
> Implementing the find_by_address(...) function differently based on
> the CONFIG_OF switch. The function  of_find_all_nodes() invoked in the
> function body is only available in case the CONFIG_OF switch is set.
> 
> For the other architectures the find_by_address(...) call returns false.
> 
> Signed-off-by: Artur Lorincz 
> ---
>  drivers/staging/board/board.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
> index 86dc411..d383857 100644
> --- a/drivers/staging/board/board.c
> +++ b/drivers/staging/board/board.c
> @@ -25,6 +25,7 @@
>  static struct device_node *irqc_node __initdata;
>  static unsigned int irqc_base __initdata;
> 
> +#ifdef CONFIG_OF
>  static bool find_by_address(u64 base_address)
>  {
>   struct device_node *dn = of_find_all_nodes(NULL);
> @@ -42,6 +43,12 @@ static bool find_by_address(u64 base_address)
> 
>   return false;
>  }
> +#else
> +static bool find_by_address(u64 base_address)
> +{
> + return false;
> +}
> +#endif

Shouldn't the default of_* functions just return the correct "of is not
enabled" options here?  Why is the #ifdef needed?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] board: Fixed compilation of board.c

2017-03-22 Thread Greg KH
On Wed, Mar 22, 2017 at 02:00:31PM +0100, Artur Lorincz wrote:
> Made the compilation of board.c depend on the CONFIG_OF flag. The
> source file board.c is referencing of_find_all_nodes(...) which is
> included only if the CONFIG_OF flag is set.
> 
> Signed-off-by: Artur Lorincz 
> ---
>  drivers/staging/board/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/board/Makefile b/drivers/staging/board/Makefile
> index 6842745..146aab0 100644
> --- a/drivers/staging/board/Makefile
> +++ b/drivers/staging/board/Makefile
> @@ -1,3 +1,3 @@
> -obj-y:= board.o
> +obj-$(CONFIG_OF) += board.o

Ick, no, what about building this code for other systems?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel