[3/3] serial: sifive: Change include order

Message ID 20190508144252.31001-3-jagan@amarulasolutions.com
State New
Headers show
Series
  • [1/3] spi: atcspi200: Change include order
Related show

Commit Message

Jagan Teki May 8, 2019, 2:42 p.m. UTC
Like clk_get_by_index, there is requirement for
clk_get_by_index_nodev. In this case to make common
code functionalities for dev and nodev, clk_get_by_index
is trying to get the index of clock by passing ofnode
instead of actual dev like current gpio uclass does.

In these scenarios with current order of include files
the serial_sifive driver is unable to find CONFIG_ENV_SIZE.

In file included from arch/riscv/include/asm/u-boot.h:23:0,
                 from include/dm/of.h:10,
                 from include/dm/ofnode.h:12,
                 from include/clk.h:11,
                 from drivers/serial/serial_sifive.c:6:
include/environment.h:145:19: error: 'CONFIG_ENV_SIZE'
undeclared here (not in a function); did you mean 'CONFIG_CMD_XIMG'?
 #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)

So, fix consists of changing the order of include files
in serial_sifive.c to include first common.h file.

Cc: Anup Patel <Anup.Patel@wdc.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/serial/serial_sifive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bin Meng May 8, 2019, 2:51 p.m. UTC | #1
On Wed, May 8, 2019 at 10:44 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Like clk_get_by_index, there is requirement for
> clk_get_by_index_nodev. In this case to make common
> code functionalities for dev and nodev, clk_get_by_index
> is trying to get the index of clock by passing ofnode
> instead of actual dev like current gpio uclass does.
>
> In these scenarios with current order of include files
> the serial_sifive driver is unable to find CONFIG_ENV_SIZE.
>
> In file included from arch/riscv/include/asm/u-boot.h:23:0,
>                  from include/dm/of.h:10,
>                  from include/dm/ofnode.h:12,
>                  from include/clk.h:11,
>                  from drivers/serial/serial_sifive.c:6:
> include/environment.h:145:19: error: 'CONFIG_ENV_SIZE'
> undeclared here (not in a function); did you mean 'CONFIG_CMD_XIMG'?
>  #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)
>
> So, fix consists of changing the order of include files
> in serial_sifive.c to include first common.h file.
>
> Cc: Anup Patel <Anup.Patel@wdc.com>
> Cc: Rick Chen <rick@andestech.com>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  drivers/serial/serial_sifive.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Jagan Teki May 8, 2019, 7:19 p.m. UTC | #2
On Wed, May 8, 2019 at 8:13 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Like clk_get_by_index, there is requirement for
> clk_get_by_index_nodev. In this case to make common
> code functionalities for dev and nodev, clk_get_by_index
> is trying to get the index of clock by passing ofnode
> instead of actual dev like current gpio uclass does.
>
> In these scenarios with current order of include files
> the serial_sifive driver is unable to find CONFIG_ENV_SIZE.
>
> In file included from arch/riscv/include/asm/u-boot.h:23:0,
>                  from include/dm/of.h:10,
>                  from include/dm/ofnode.h:12,
>                  from include/clk.h:11,
>                  from drivers/serial/serial_sifive.c:6:
> include/environment.h:145:19: error: 'CONFIG_ENV_SIZE'
> undeclared here (not in a function); did you mean 'CONFIG_CMD_XIMG'?
>  #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)
>
> So, fix consists of changing the order of include files
> in serial_sifive.c to include first common.h file.
>
> Cc: Anup Patel <Anup.Patel@wdc.com>
> Cc: Rick Chen <rick@andestech.com>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---

Applied to u-boot-sunxi/master

Patch

diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
index 537bc7a975..fdfef69aaa 100644
--- a/drivers/serial/serial_sifive.c
+++ b/drivers/serial/serial_sifive.c
@@ -3,8 +3,8 @@ 
  * Copyright (C) 2018 Anup Patel <anup@brainfault.org>
  */
 
-#include <clk.h>
 #include <common.h>
+#include <clk.h>
 #include <debug_uart.h>
 #include <dm.h>
 #include <errno.h>