diff mbox series

[4/5] sandbox: Audit config.h and common.h usage

Message ID 20231117225313.2144665-4-trini@konsulko.com
State Superseded
Delegated to: Tom Rini
Headers show
Series [1/5] qe: Add <config.h> to linux/immap_qe.h | expand

Commit Message

Tom Rini Nov. 17, 2023, 10:53 p.m. UTC
Remove and replace common.h and config.h in sandbox when it's not needed
and add some explicit includes where needed.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 arch/sandbox/cpu/cache.c         | 1 -
 arch/sandbox/cpu/cpu.c           | 1 -
 arch/sandbox/cpu/sdl.c           | 2 +-
 arch/sandbox/cpu/spl.c           | 1 -
 arch/sandbox/cpu/start.c         | 2 +-
 arch/sandbox/cpu/state.c         | 2 +-
 arch/sandbox/include/asm/io.h    | 2 ++
 arch/sandbox/include/asm/state.h | 1 -
 arch/sandbox/lib/bootm.c         | 1 -
 arch/sandbox/lib/fdt_fixup.c     | 1 -
 arch/sandbox/lib/interrupts.c    | 1 -
 arch/sandbox/lib/pci_io.c        | 1 -
 board/sandbox/sandbox.c          | 2 +-
 13 files changed, 6 insertions(+), 12 deletions(-)

Comments

Simon Glass Nov. 18, 2023, 5:09 p.m. UTC | #1
Hi Tom,

On Fri, 17 Nov 2023 at 15:54, Tom Rini <trini@konsulko.com> wrote:
>
> Remove and replace common.h and config.h in sandbox when it's not needed
> and add some explicit includes where needed.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  arch/sandbox/cpu/cache.c         | 1 -
>  arch/sandbox/cpu/cpu.c           | 1 -
>  arch/sandbox/cpu/sdl.c           | 2 +-
>  arch/sandbox/cpu/spl.c           | 1 -
>  arch/sandbox/cpu/start.c         | 2 +-
>  arch/sandbox/cpu/state.c         | 2 +-
>  arch/sandbox/include/asm/io.h    | 2 ++
>  arch/sandbox/include/asm/state.h | 1 -
>  arch/sandbox/lib/bootm.c         | 1 -
>  arch/sandbox/lib/fdt_fixup.c     | 1 -
>  arch/sandbox/lib/interrupts.c    | 1 -
>  arch/sandbox/lib/pci_io.c        | 1 -
>  board/sandbox/sandbox.c          | 2 +-
>  13 files changed, 6 insertions(+), 12 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Is it possible to move CFG_SYS_SDRAM_BASE/SIZE to Kconfig?

For CFG_SYS_BAUDRATE_TABLE perhaps we could have a standard set that
most boards use, or turn it into a set of word flags with a bit for
each rate?

>
> diff --git a/arch/sandbox/cpu/cache.c b/arch/sandbox/cpu/cache.c
> index 46c62c0b4461..c8a5e64214b6 100644
> --- a/arch/sandbox/cpu/cache.c
> +++ b/arch/sandbox/cpu/cache.c
> @@ -3,7 +3,6 @@
>   * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
>   */
>
> -#include <common.h>
>  #include <cpu_func.h>
>  #include <asm/state.h>
>
> diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
> index a1c5c7c4311a..d6475c969c4d 100644
> --- a/arch/sandbox/cpu/cpu.c
> +++ b/arch/sandbox/cpu/cpu.c
> @@ -5,7 +5,6 @@
>
>  #define LOG_CATEGORY   LOGC_SANDBOX
>
> -#include <common.h>
>  #include <bootstage.h>
>  #include <cpu_func.h>
>  #include <errno.h>
> diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
> index 590e406517bf..ed84646bdab7 100644
> --- a/arch/sandbox/cpu/sdl.c
> +++ b/arch/sandbox/cpu/sdl.c
> @@ -72,7 +72,7 @@ static struct sdl_info {
>  static void sandbox_sdl_poll_events(void)
>  {
>         /*
> -        * We don't want to include common.h in this file since it uses
> +        * We don't want to include cpu_func.h in this file since it uses
>          * system headers. So add a declation here.
>          */
>         extern void reset_cpu(void);
> diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
> index 16b766279833..9ad9da686c6a 100644
> --- a/arch/sandbox/cpu/spl.c
> +++ b/arch/sandbox/cpu/spl.c
> @@ -3,7 +3,6 @@
>   * Copyright (c) 2016 Google, Inc
>   */
>
> -#include <common.h>
>  #include <dm.h>
>  #include <hang.h>
>  #include <handoff.h>
> diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
> index 2589c2eba738..dce804165296 100644
> --- a/arch/sandbox/cpu/start.c
> +++ b/arch/sandbox/cpu/start.c
> @@ -3,7 +3,7 @@
>   * Copyright (c) 2011-2012 The Chromium OS Authors.
>   */
>
> -#include <common.h>
> +#include <config.h>
>  #include <cli.h>
>  #include <command.h>
>  #include <efi_loader.h>
> diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
> index e38bb248b7ff..2462f990baae 100644
> --- a/arch/sandbox/cpu/state.c
> +++ b/arch/sandbox/cpu/state.c
> @@ -3,7 +3,7 @@
>   * Copyright (c) 2011-2012 The Chromium OS Authors.
>   */
>
> -#include <common.h>
> +#include <config.h>
>  #include <autoboot.h>
>  #include <bloblist.h>
>  #include <errno.h>
> diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
> index 31ab7289b4bd..1ccb25a0fe1e 100644
> --- a/arch/sandbox/include/asm/io.h
> +++ b/arch/sandbox/include/asm/io.h
> @@ -6,6 +6,8 @@
>  #ifndef __SANDBOX_ASM_IO_H
>  #define __SANDBOX_ASM_IO_H
>
> +#include <linux/types.h>
> +
>  enum sandboxio_size_t {
>         SB_SIZE_8,
>         SB_SIZE_16,
> diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
> index 59a20595f51d..c84a1f7060f4 100644
> --- a/arch/sandbox/include/asm/state.h
> +++ b/arch/sandbox/include/asm/state.h
> @@ -6,7 +6,6 @@
>  #ifndef __SANDBOX_STATE_H
>  #define __SANDBOX_STATE_H
>
> -#include <config.h>
>  #include <sysreset.h>
>  #include <stdbool.h>
>  #include <linux/list.h>
> diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
> index dc8b8e46cb41..270671145a0b 100644
> --- a/arch/sandbox/lib/bootm.c
> +++ b/arch/sandbox/lib/bootm.c
> @@ -4,7 +4,6 @@
>   * Copyright (c) 2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>   */
>
> -#include <common.h>
>  #include <bootstage.h>
>  #include <image.h>
>  #include <asm/io.h>
> diff --git a/arch/sandbox/lib/fdt_fixup.c b/arch/sandbox/lib/fdt_fixup.c
> index a646f2059c2c..e333bd52ea28 100644
> --- a/arch/sandbox/lib/fdt_fixup.c
> +++ b/arch/sandbox/lib/fdt_fixup.c
> @@ -2,7 +2,6 @@
>
>  #define LOG_CATEGORY LOGC_ARCH
>
> -#include <common.h>
>  #include <fdt_support.h>
>  #include <log.h>
>
> diff --git a/arch/sandbox/lib/interrupts.c b/arch/sandbox/lib/interrupts.c
> index 4d7cbff802c6..3f6583e11f04 100644
> --- a/arch/sandbox/lib/interrupts.c
> +++ b/arch/sandbox/lib/interrupts.c
> @@ -5,7 +5,6 @@
>   * found in the LICENSE file.
>   */
>
> -#include <common.h>
>  #include <efi_loader.h>
>  #include <irq_func.h>
>  #include <os.h>
> diff --git a/arch/sandbox/lib/pci_io.c b/arch/sandbox/lib/pci_io.c
> index 2038141947ab..6040eacb594f 100644
> --- a/arch/sandbox/lib/pci_io.c
> +++ b/arch/sandbox/lib/pci_io.c
> @@ -8,7 +8,6 @@
>   * IO space access commands.
>   */
>
> -#include <common.h>
>  #include <command.h>
>  #include <dm.h>
>  #include <log.h>
> diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
> index 9d58860451c5..802596569c64 100644
> --- a/board/sandbox/sandbox.c
> +++ b/board/sandbox/sandbox.c
> @@ -3,8 +3,8 @@
>   * Copyright (c) 2011 The Chromium OS Authors.
>   */
>
> -#include <common.h>
>  #include <addr_map.h>
> +#include <config.h>

It seems strange to add config.h anywhere other than first. But I
don't mind if that is what you intend.

>  #include <cpu_func.h>
>  #include <cros_ec.h>
>  #include <dm.h>
> --
> 2.34.1
>

Regards,
Simon
Tom Rini Nov. 18, 2023, 5:45 p.m. UTC | #2
On Sat, Nov 18, 2023 at 10:09:55AM -0700, Simon Glass wrote:
> Hi Tom,
> 
> On Fri, 17 Nov 2023 at 15:54, Tom Rini <trini@konsulko.com> wrote:
> >
> > Remove and replace common.h and config.h in sandbox when it's not needed
> > and add some explicit includes where needed.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> >  arch/sandbox/cpu/cache.c         | 1 -
> >  arch/sandbox/cpu/cpu.c           | 1 -
> >  arch/sandbox/cpu/sdl.c           | 2 +-
> >  arch/sandbox/cpu/spl.c           | 1 -
> >  arch/sandbox/cpu/start.c         | 2 +-
> >  arch/sandbox/cpu/state.c         | 2 +-
> >  arch/sandbox/include/asm/io.h    | 2 ++
> >  arch/sandbox/include/asm/state.h | 1 -
> >  arch/sandbox/lib/bootm.c         | 1 -
> >  arch/sandbox/lib/fdt_fixup.c     | 1 -
> >  arch/sandbox/lib/interrupts.c    | 1 -
> >  arch/sandbox/lib/pci_io.c        | 1 -
> >  board/sandbox/sandbox.c          | 2 +-
> >  13 files changed, 6 insertions(+), 12 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Is it possible to move CFG_SYS_SDRAM_BASE/SIZE to Kconfig?

Possible? Sure. But I think it would end up being fairly horrible. What
would be nice I think is some Zephyr-style "convert
CONFIG_DEFAULT_DEVICE_TREE to some defines" because we could parse out
/memory to CFG_SYS_SDRAM_BASE/SIZE and that's something we _need_ at
build time.

> For CFG_SYS_BAUDRATE_TABLE perhaps we could have a standard set that
> most boards use, or turn it into a set of word flags with a bit for
> each rate?

We do, largely, use a default table. I forget which further rework I
posted as an RFC a few years ago, but I believe it was largely seen as
being uglier than what we have today.
Simon Glass Nov. 18, 2023, 5:58 p.m. UTC | #3
Hi Tom,

On Sat, 18 Nov 2023 at 10:45, Tom Rini <trini@konsulko.com> wrote:
>
> On Sat, Nov 18, 2023 at 10:09:55AM -0700, Simon Glass wrote:
> > Hi Tom,
> >
> > On Fri, 17 Nov 2023 at 15:54, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > Remove and replace common.h and config.h in sandbox when it's not needed
> > > and add some explicit includes where needed.
> > >
> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > ---
> > >  arch/sandbox/cpu/cache.c         | 1 -
> > >  arch/sandbox/cpu/cpu.c           | 1 -
> > >  arch/sandbox/cpu/sdl.c           | 2 +-
> > >  arch/sandbox/cpu/spl.c           | 1 -
> > >  arch/sandbox/cpu/start.c         | 2 +-
> > >  arch/sandbox/cpu/state.c         | 2 +-
> > >  arch/sandbox/include/asm/io.h    | 2 ++
> > >  arch/sandbox/include/asm/state.h | 1 -
> > >  arch/sandbox/lib/bootm.c         | 1 -
> > >  arch/sandbox/lib/fdt_fixup.c     | 1 -
> > >  arch/sandbox/lib/interrupts.c    | 1 -
> > >  arch/sandbox/lib/pci_io.c        | 1 -
> > >  board/sandbox/sandbox.c          | 2 +-
> > >  13 files changed, 6 insertions(+), 12 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Is it possible to move CFG_SYS_SDRAM_BASE/SIZE to Kconfig?
>
> Possible? Sure. But I think it would end up being fairly horrible. What
> would be nice I think is some Zephyr-style "convert
> CONFIG_DEFAULT_DEVICE_TREE to some defines" because we could parse out
> /memory to CFG_SYS_SDRAM_BASE/SIZE and that's something we _need_ at
> build time.

That would be pretty easy to do. But I would prefer to have it create
CONFIG_SYS_SDRAM_BASE/SIZE so that it fits in with Kconfig, just that
the value is set for you.

If you like you could create an issue for it.

>
> > For CFG_SYS_BAUDRATE_TABLE perhaps we could have a standard set that
> > most boards use, or turn it into a set of word flags with a bit for
> > each rate?
>
> We do, largely, use a default table. I forget which further rework I
> posted as an RFC a few years ago, but I believe it was largely seen as
> being uglier than what we have today.

I found these:

https://patchwork.ozlabs.org/project/uboot/list/?series=262148&state=*
http://patchwork.ozlabs.org/project/uboot/patch/20210925121958.26001-1-pali@kernel.org/

IMO the second one from Pali makes sense, but it was never followed
up. It doesn't look too difficult.

We should have a policy that if people complain about a patch but
don't follow up, we apply the patch we have.

I would like to drop configs/sandbox.h at some point and these two
points are all that is left.

Regards,
Simon
Tom Rini Nov. 18, 2023, 6:04 p.m. UTC | #4
Splitting this in to two different threads..

On Sat, Nov 18, 2023 at 10:58:50AM -0700, Simon Glass wrote:
> Hi Tom,
> 
> On Sat, 18 Nov 2023 at 10:45, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Sat, Nov 18, 2023 at 10:09:55AM -0700, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Fri, 17 Nov 2023 at 15:54, Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > Remove and replace common.h and config.h in sandbox when it's not needed
> > > > and add some explicit includes where needed.
> > > >
> > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > ---
> > > >  arch/sandbox/cpu/cache.c         | 1 -
> > > >  arch/sandbox/cpu/cpu.c           | 1 -
> > > >  arch/sandbox/cpu/sdl.c           | 2 +-
> > > >  arch/sandbox/cpu/spl.c           | 1 -
> > > >  arch/sandbox/cpu/start.c         | 2 +-
> > > >  arch/sandbox/cpu/state.c         | 2 +-
> > > >  arch/sandbox/include/asm/io.h    | 2 ++
> > > >  arch/sandbox/include/asm/state.h | 1 -
> > > >  arch/sandbox/lib/bootm.c         | 1 -
> > > >  arch/sandbox/lib/fdt_fixup.c     | 1 -
> > > >  arch/sandbox/lib/interrupts.c    | 1 -
> > > >  arch/sandbox/lib/pci_io.c        | 1 -
> > > >  board/sandbox/sandbox.c          | 2 +-
> > > >  13 files changed, 6 insertions(+), 12 deletions(-)
> > >
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > Is it possible to move CFG_SYS_SDRAM_BASE/SIZE to Kconfig?
> >
> > Possible? Sure. But I think it would end up being fairly horrible. What
> > would be nice I think is some Zephyr-style "convert
> > CONFIG_DEFAULT_DEVICE_TREE to some defines" because we could parse out
> > /memory to CFG_SYS_SDRAM_BASE/SIZE and that's something we _need_ at
> > build time.
> 
> That would be pretty easy to do. But I would prefer to have it create
> CONFIG_SYS_SDRAM_BASE/SIZE so that it fits in with Kconfig, just that
> the value is set for you.

I _think_ we need it to be non-CONFIG namespace or we'll run in to other
problems? We could get the new autogenerated header to be included along
with generated/autoconf.h but since we couldn't use it within Kconfig
logic it would be confusing.

> If you like you could create an issue for it.

Please, thanks.
Tom Rini Nov. 18, 2023, 6:44 p.m. UTC | #5
On Sat, Nov 18, 2023 at 10:58:50AM -0700, Simon Glass wrote:

[snip]
> I found these:
> 
> https://patchwork.ozlabs.org/project/uboot/list/?series=262148&state=*
> http://patchwork.ozlabs.org/project/uboot/patch/20210925121958.26001-1-pali@kernel.org/
> 
> IMO the second one from Pali makes sense, but it was never followed
> up. It doesn't look too difficult.
> 
> We should have a policy that if people complain about a patch but
> don't follow up, we apply the patch we have.

I think the patch from Pali was the right direction, but as I noted, I
wanted to see it implemented for some other UARTs as well, and it wasn't
high on anyone elses priority list. Covering ns16550-style UARTs too
would be good.
Simon Glass Dec. 2, 2023, 6:27 p.m. UTC | #6
Hi Tom,

On Sat, 18 Nov 2023 at 11:44, Tom Rini <trini@konsulko.com> wrote:
>
> On Sat, Nov 18, 2023 at 10:58:50AM -0700, Simon Glass wrote:
>
> [snip]
> > I found these:
> >
> > https://patchwork.ozlabs.org/project/uboot/list/?series=262148&state=*
> > http://patchwork.ozlabs.org/project/uboot/patch/20210925121958.26001-1-pali@kernel.org/
> >
> > IMO the second one from Pali makes sense, but it was never followed
> > up. It doesn't look too difficult.
> >
> > We should have a policy that if people complain about a patch but
> > don't follow up, we apply the patch we have.
>
> I think the patch from Pali was the right direction, but as I noted, I
> wanted to see it implemented for some other UARTs as well, and it wasn't
> high on anyone elses priority list. Covering ns16550-style UARTs too
> would be good.

https://source.denx.de/u-boot/u-boot/-/issues/28

Regards,
Simon
Simon Glass Dec. 2, 2023, 6:29 p.m. UTC | #7
Hi Tom,

On Sat, 18 Nov 2023 at 11:04, Tom Rini <trini@konsulko.com> wrote:
>
> Splitting this in to two different threads..
>
> On Sat, Nov 18, 2023 at 10:58:50AM -0700, Simon Glass wrote:
> > Hi Tom,
> >
> > On Sat, 18 Nov 2023 at 10:45, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > On Sat, Nov 18, 2023 at 10:09:55AM -0700, Simon Glass wrote:
> > > > Hi Tom,
> > > >
> > > > On Fri, 17 Nov 2023 at 15:54, Tom Rini <trini@konsulko.com> wrote:
> > > > >
> > > > > Remove and replace common.h and config.h in sandbox when it's not needed
> > > > > and add some explicit includes where needed.
> > > > >
> > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > ---
> > > > >  arch/sandbox/cpu/cache.c         | 1 -
> > > > >  arch/sandbox/cpu/cpu.c           | 1 -
> > > > >  arch/sandbox/cpu/sdl.c           | 2 +-
> > > > >  arch/sandbox/cpu/spl.c           | 1 -
> > > > >  arch/sandbox/cpu/start.c         | 2 +-
> > > > >  arch/sandbox/cpu/state.c         | 2 +-
> > > > >  arch/sandbox/include/asm/io.h    | 2 ++
> > > > >  arch/sandbox/include/asm/state.h | 1 -
> > > > >  arch/sandbox/lib/bootm.c         | 1 -
> > > > >  arch/sandbox/lib/fdt_fixup.c     | 1 -
> > > > >  arch/sandbox/lib/interrupts.c    | 1 -
> > > > >  arch/sandbox/lib/pci_io.c        | 1 -
> > > > >  board/sandbox/sandbox.c          | 2 +-
> > > > >  13 files changed, 6 insertions(+), 12 deletions(-)
> > > >
> > > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > > >
> > > > Is it possible to move CFG_SYS_SDRAM_BASE/SIZE to Kconfig?
> > >
> > > Possible? Sure. But I think it would end up being fairly horrible. What
> > > would be nice I think is some Zephyr-style "convert
> > > CONFIG_DEFAULT_DEVICE_TREE to some defines" because we could parse out
> > > /memory to CFG_SYS_SDRAM_BASE/SIZE and that's something we _need_ at
> > > build time.
> >
> > That would be pretty easy to do. But I would prefer to have it create
> > CONFIG_SYS_SDRAM_BASE/SIZE so that it fits in with Kconfig, just that
> > the value is set for you.
>
> I _think_ we need it to be non-CONFIG namespace or we'll run in to other
> problems? We could get the new autogenerated header to be included along
> with generated/autoconf.h but since we couldn't use it within Kconfig
> logic it would be confusing.
>
> > If you like you could create an issue for it.
>
> Please, thanks.

https://source.denx.de/u-boot/u-boot/-/issues/27

Regards,
Simon
diff mbox series

Patch

diff --git a/arch/sandbox/cpu/cache.c b/arch/sandbox/cpu/cache.c
index 46c62c0b4461..c8a5e64214b6 100644
--- a/arch/sandbox/cpu/cache.c
+++ b/arch/sandbox/cpu/cache.c
@@ -3,7 +3,6 @@ 
  * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
  */
 
-#include <common.h>
 #include <cpu_func.h>
 #include <asm/state.h>
 
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index a1c5c7c4311a..d6475c969c4d 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -5,7 +5,6 @@ 
 
 #define LOG_CATEGORY	LOGC_SANDBOX
 
-#include <common.h>
 #include <bootstage.h>
 #include <cpu_func.h>
 #include <errno.h>
diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 590e406517bf..ed84646bdab7 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -72,7 +72,7 @@  static struct sdl_info {
 static void sandbox_sdl_poll_events(void)
 {
 	/*
-	 * We don't want to include common.h in this file since it uses
+	 * We don't want to include cpu_func.h in this file since it uses
 	 * system headers. So add a declation here.
 	 */
 	extern void reset_cpu(void);
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 16b766279833..9ad9da686c6a 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -3,7 +3,6 @@ 
  * Copyright (c) 2016 Google, Inc
  */
 
-#include <common.h>
 #include <dm.h>
 #include <hang.h>
 #include <handoff.h>
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 2589c2eba738..dce804165296 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -3,7 +3,7 @@ 
  * Copyright (c) 2011-2012 The Chromium OS Authors.
  */
 
-#include <common.h>
+#include <config.h>
 #include <cli.h>
 #include <command.h>
 #include <efi_loader.h>
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index e38bb248b7ff..2462f990baae 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -3,7 +3,7 @@ 
  * Copyright (c) 2011-2012 The Chromium OS Authors.
  */
 
-#include <common.h>
+#include <config.h>
 #include <autoboot.h>
 #include <bloblist.h>
 #include <errno.h>
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 31ab7289b4bd..1ccb25a0fe1e 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -6,6 +6,8 @@ 
 #ifndef __SANDBOX_ASM_IO_H
 #define __SANDBOX_ASM_IO_H
 
+#include <linux/types.h>
+
 enum sandboxio_size_t {
 	SB_SIZE_8,
 	SB_SIZE_16,
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index 59a20595f51d..c84a1f7060f4 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -6,7 +6,6 @@ 
 #ifndef __SANDBOX_STATE_H
 #define __SANDBOX_STATE_H
 
-#include <config.h>
 #include <sysreset.h>
 #include <stdbool.h>
 #include <linux/list.h>
diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index dc8b8e46cb41..270671145a0b 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -4,7 +4,6 @@ 
  * Copyright (c) 2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  */
 
-#include <common.h>
 #include <bootstage.h>
 #include <image.h>
 #include <asm/io.h>
diff --git a/arch/sandbox/lib/fdt_fixup.c b/arch/sandbox/lib/fdt_fixup.c
index a646f2059c2c..e333bd52ea28 100644
--- a/arch/sandbox/lib/fdt_fixup.c
+++ b/arch/sandbox/lib/fdt_fixup.c
@@ -2,7 +2,6 @@ 
 
 #define LOG_CATEGORY LOGC_ARCH
 
-#include <common.h>
 #include <fdt_support.h>
 #include <log.h>
 
diff --git a/arch/sandbox/lib/interrupts.c b/arch/sandbox/lib/interrupts.c
index 4d7cbff802c6..3f6583e11f04 100644
--- a/arch/sandbox/lib/interrupts.c
+++ b/arch/sandbox/lib/interrupts.c
@@ -5,7 +5,6 @@ 
  * found in the LICENSE file.
  */
 
-#include <common.h>
 #include <efi_loader.h>
 #include <irq_func.h>
 #include <os.h>
diff --git a/arch/sandbox/lib/pci_io.c b/arch/sandbox/lib/pci_io.c
index 2038141947ab..6040eacb594f 100644
--- a/arch/sandbox/lib/pci_io.c
+++ b/arch/sandbox/lib/pci_io.c
@@ -8,7 +8,6 @@ 
  * IO space access commands.
  */
 
-#include <common.h>
 #include <command.h>
 #include <dm.h>
 #include <log.h>
diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
index 9d58860451c5..802596569c64 100644
--- a/board/sandbox/sandbox.c
+++ b/board/sandbox/sandbox.c
@@ -3,8 +3,8 @@ 
  * Copyright (c) 2011 The Chromium OS Authors.
  */
 
-#include <common.h>
 #include <addr_map.h>
+#include <config.h>
 #include <cpu_func.h>
 #include <cros_ec.h>
 #include <dm.h>