* [PATCH v2] sandbox: fix a compilation error
@ 2023-06-12 21:19 Sergei Antonov
2023-06-13 14:58 ` Simon Glass
0 siblings, 1 reply; 7+ messages in thread
From: Sergei Antonov @ 2023-06-12 21:19 UTC (permalink / raw)
To: u-boot; +Cc: Sergei Antonov, Simon Glass, Tom Rini
With sandbox and sandbox64 configurations:
In file included from .../u-boot/include/test/test.h:156,
from .../u-boot/include/test/lib.h:9,
from .../u-boot/test/lib/test_crc8.c:8:
.../u-boot/arch/sandbox/include/asm/test.h: In function ‘sandbox_sdl_set_bpp’:
.../u-boot/arch/sandbox/include/asm/test.h:323:17: error: ‘ENOSYS’ undeclared (first use in this function)
323 | return -ENOSYS;
| ^~~~~~
Per Tom Rini's suggestion:
move that function prototype over to arch/sandbox/include/asm/sdl.h
and make test/dm/video.c include <asm/sdl.h>
Cc: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Sergei Antonov <saproj@gmail.com>
---
v2:
* move the function to another file instead of including <errno.h>
arch/sandbox/include/asm/sdl.h | 23 +++++++++++++++++++++++
arch/sandbox/include/asm/test.h | 25 -------------------------
test/dm/video.c | 1 +
3 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
index 56dcb84803d3..ee4991f7c24a 100644
--- a/arch/sandbox/include/asm/sdl.h
+++ b/arch/sandbox/include/asm/sdl.h
@@ -7,6 +7,7 @@
#define __SANDBOX_SDL_H
#include <errno.h>
+#include <video.h>
#ifdef CONFIG_SANDBOX_SDL
@@ -87,6 +88,22 @@ int sandbox_sdl_sound_stop(void);
*/
int sandbox_sdl_sound_init(int rate, int channels);
+/**
+ * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
+ *
+ * The device must not be active when this function is called. It activiates it
+ * before returning.
+ *
+ * This updates the depth value and adjusts a few other settings accordingly.
+ * It must be called before the display is probed.
+ *
+ * @dev: Device to adjust
+ * @l2bpp: depth to set
+ * Return: 0 if the device was already active, other error if it fails to probe
+ * after the change
+ */
+int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
+
#else
static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp,
bool double_size)
@@ -134,6 +151,12 @@ static inline int sandbox_sdl_sound_init(int rate, int channels)
return -ENODEV;
}
+static inline int sandbox_sdl_set_bpp(struct udevice *dev,
+ enum video_log2_bpp l2bpp)
+{
+ return -ENOSYS;
+}
+
#endif
#endif
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index e482271fe975..17159f8d674a 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -8,7 +8,6 @@
#ifndef __ASM_TEST_H
#define __ASM_TEST_H
-#include <video.h>
#include <pci_ids.h>
struct unit_test_state;
@@ -300,30 +299,6 @@ void sandbox_cros_ec_set_test_flags(struct udevice *dev, uint flags);
*/
int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint index, uint *duty);
-#if IS_ENABLED(CONFIG_SANDBOX_SDL)
-/**
- * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
- *
- * The device must not be active when this function is called. It activiates it
- * before returning.
- *
- * This updates the depth value and adjusts a few other settings accordingly.
- * It must be called before the display is probed.
- *
- * @dev: Device to adjust
- * @l2bpp: depth to set
- * Return: 0 if the device was already active, other error if it fails to probe
- * after the change
- */
-int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
-#else
-static inline int sandbox_sdl_set_bpp(struct udevice *dev,
- enum video_log2_bpp l2bpp)
-{
- return -ENOSYS;
-}
-#endif
-
/**
* sandbox_set_fake_efi_mgr_dev() - Control EFI bootmgr producing valid bootflow
*
diff --git a/test/dm/video.c b/test/dm/video.c
index 30778157d940..1c63d16bd28b 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -15,6 +15,7 @@
#include <video.h>
#include <video_console.h>
#include <asm/test.h>
+#include <asm/sdl.h>
#include <dm/test.h>
#include <dm/uclass-internal.h>
#include <test/test.h>
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] sandbox: fix a compilation error
2023-06-12 21:19 [PATCH v2] sandbox: fix a compilation error Sergei Antonov
@ 2023-06-13 14:58 ` Simon Glass
2023-06-13 15:00 ` Tom Rini
2023-06-13 16:05 ` Sergei Antonov
0 siblings, 2 replies; 7+ messages in thread
From: Simon Glass @ 2023-06-13 14:58 UTC (permalink / raw)
To: Sergei Antonov; +Cc: u-boot, Tom Rini
Hi Sergei,
On Mon, 12 Jun 2023 at 22:19, Sergei Antonov <saproj@gmail.com> wrote:
>
> With sandbox and sandbox64 configurations:
>
> In file included from .../u-boot/include/test/test.h:156,
> from .../u-boot/include/test/lib.h:9,
> from .../u-boot/test/lib/test_crc8.c:8:
> .../u-boot/arch/sandbox/include/asm/test.h: In function ‘sandbox_sdl_set_bpp’:
> .../u-boot/arch/sandbox/include/asm/test.h:323:17: error: ‘ENOSYS’ undeclared (first use in this function)
> 323 | return -ENOSYS;
> | ^~~~~~
>
> Per Tom Rini's suggestion:
> move that function prototype over to arch/sandbox/include/asm/sdl.h
> and make test/dm/video.c include <asm/sdl.h>
>
> Cc: Simon Glass <sjg@chromium.org>
> Suggested-by: Tom Rini <trini@konsulko.com>
> Signed-off-by: Sergei Antonov <saproj@gmail.com>
> ---
>
> v2:
> * move the function to another file instead of including <errno.h>
>
> arch/sandbox/include/asm/sdl.h | 23 +++++++++++++++++++++++
> arch/sandbox/include/asm/test.h | 25 -------------------------
> test/dm/video.c | 1 +
> 3 files changed, 24 insertions(+), 25 deletions(-)
>
> diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
> index 56dcb84803d3..ee4991f7c24a 100644
> --- a/arch/sandbox/include/asm/sdl.h
> +++ b/arch/sandbox/include/asm/sdl.h
> @@ -7,6 +7,7 @@
> #define __SANDBOX_SDL_H
>
> #include <errno.h>
> +#include <video.h>
>
> #ifdef CONFIG_SANDBOX_SDL
>
> @@ -87,6 +88,22 @@ int sandbox_sdl_sound_stop(void);
> */
> int sandbox_sdl_sound_init(int rate, int channels);
>
> +/**
> + * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
> + *
> + * The device must not be active when this function is called. It activiates it
> + * before returning.
> + *
> + * This updates the depth value and adjusts a few other settings accordingly.
> + * It must be called before the display is probed.
> + *
> + * @dev: Device to adjust
> + * @l2bpp: depth to set
> + * Return: 0 if the device was already active, other error if it fails to probe
> + * after the change
> + */
> +int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
> +
> #else
> static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp,
> bool double_size)
> @@ -134,6 +151,12 @@ static inline int sandbox_sdl_sound_init(int rate, int channels)
> return -ENODEV;
> }
>
> +static inline int sandbox_sdl_set_bpp(struct udevice *dev,
> + enum video_log2_bpp l2bpp)
> +{
> + return -ENOSYS;
> +}
> +
> #endif
>
> #endif
> diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
> index e482271fe975..17159f8d674a 100644
> --- a/arch/sandbox/include/asm/test.h
> +++ b/arch/sandbox/include/asm/test.h
> @@ -8,7 +8,6 @@
> #ifndef __ASM_TEST_H
> #define __ASM_TEST_H
>
> -#include <video.h>
> #include <pci_ids.h>
>
> struct unit_test_state;
> @@ -300,30 +299,6 @@ void sandbox_cros_ec_set_test_flags(struct udevice *dev, uint flags);
> */
> int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint index, uint *duty);
>
> -#if IS_ENABLED(CONFIG_SANDBOX_SDL)
> -/**
> - * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
> - *
> - * The device must not be active when this function is called. It activiates it
> - * before returning.
> - *
> - * This updates the depth value and adjusts a few other settings accordingly.
> - * It must be called before the display is probed.
> - *
> - * @dev: Device to adjust
> - * @l2bpp: depth to set
> - * Return: 0 if the device was already active, other error if it fails to probe
> - * after the change
> - */
> -int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
> -#else
> -static inline int sandbox_sdl_set_bpp(struct udevice *dev,
> - enum video_log2_bpp l2bpp)
> -{
> - return -ENOSYS;
> -}
> -#endif
> -
> /**
> * sandbox_set_fake_efi_mgr_dev() - Control EFI bootmgr producing valid bootflow
> *
> diff --git a/test/dm/video.c b/test/dm/video.c
> index 30778157d940..1c63d16bd28b 100644
> --- a/test/dm/video.c
> +++ b/test/dm/video.c
> @@ -15,6 +15,7 @@
> #include <video.h>
> #include <video_console.h>
> #include <asm/test.h>
> +#include <asm/sdl.h>
The problem with this is it then cannot be built on non-sandbox
boards. I think v1 was OK.
> #include <dm/test.h>
> #include <dm/uclass-internal.h>
> #include <test/test.h>
> --
> 2.37.2
>
Regards,
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] sandbox: fix a compilation error
2023-06-13 14:58 ` Simon Glass
@ 2023-06-13 15:00 ` Tom Rini
2023-06-13 16:05 ` Sergei Antonov
1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-06-13 15:00 UTC (permalink / raw)
To: Simon Glass; +Cc: Sergei Antonov, u-boot
[-- Attachment #1: Type: text/plain, Size: 5020 bytes --]
On Tue, Jun 13, 2023 at 03:58:25PM +0100, Simon Glass wrote:
> Hi Sergei,
>
> On Mon, 12 Jun 2023 at 22:19, Sergei Antonov <saproj@gmail.com> wrote:
> >
> > With sandbox and sandbox64 configurations:
> >
> > In file included from .../u-boot/include/test/test.h:156,
> > from .../u-boot/include/test/lib.h:9,
> > from .../u-boot/test/lib/test_crc8.c:8:
> > .../u-boot/arch/sandbox/include/asm/test.h: In function ‘sandbox_sdl_set_bpp’:
> > .../u-boot/arch/sandbox/include/asm/test.h:323:17: error: ‘ENOSYS’ undeclared (first use in this function)
> > 323 | return -ENOSYS;
> > | ^~~~~~
> >
> > Per Tom Rini's suggestion:
> > move that function prototype over to arch/sandbox/include/asm/sdl.h
> > and make test/dm/video.c include <asm/sdl.h>
> >
> > Cc: Simon Glass <sjg@chromium.org>
> > Suggested-by: Tom Rini <trini@konsulko.com>
> > Signed-off-by: Sergei Antonov <saproj@gmail.com>
> > ---
> >
> > v2:
> > * move the function to another file instead of including <errno.h>
> >
> > arch/sandbox/include/asm/sdl.h | 23 +++++++++++++++++++++++
> > arch/sandbox/include/asm/test.h | 25 -------------------------
> > test/dm/video.c | 1 +
> > 3 files changed, 24 insertions(+), 25 deletions(-)
> >
> > diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h
> > index 56dcb84803d3..ee4991f7c24a 100644
> > --- a/arch/sandbox/include/asm/sdl.h
> > +++ b/arch/sandbox/include/asm/sdl.h
> > @@ -7,6 +7,7 @@
> > #define __SANDBOX_SDL_H
> >
> > #include <errno.h>
> > +#include <video.h>
> >
> > #ifdef CONFIG_SANDBOX_SDL
> >
> > @@ -87,6 +88,22 @@ int sandbox_sdl_sound_stop(void);
> > */
> > int sandbox_sdl_sound_init(int rate, int channels);
> >
> > +/**
> > + * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
> > + *
> > + * The device must not be active when this function is called. It activiates it
> > + * before returning.
> > + *
> > + * This updates the depth value and adjusts a few other settings accordingly.
> > + * It must be called before the display is probed.
> > + *
> > + * @dev: Device to adjust
> > + * @l2bpp: depth to set
> > + * Return: 0 if the device was already active, other error if it fails to probe
> > + * after the change
> > + */
> > +int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
> > +
> > #else
> > static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp,
> > bool double_size)
> > @@ -134,6 +151,12 @@ static inline int sandbox_sdl_sound_init(int rate, int channels)
> > return -ENODEV;
> > }
> >
> > +static inline int sandbox_sdl_set_bpp(struct udevice *dev,
> > + enum video_log2_bpp l2bpp)
> > +{
> > + return -ENOSYS;
> > +}
> > +
> > #endif
> >
> > #endif
> > diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
> > index e482271fe975..17159f8d674a 100644
> > --- a/arch/sandbox/include/asm/test.h
> > +++ b/arch/sandbox/include/asm/test.h
> > @@ -8,7 +8,6 @@
> > #ifndef __ASM_TEST_H
> > #define __ASM_TEST_H
> >
> > -#include <video.h>
> > #include <pci_ids.h>
> >
> > struct unit_test_state;
> > @@ -300,30 +299,6 @@ void sandbox_cros_ec_set_test_flags(struct udevice *dev, uint flags);
> > */
> > int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint index, uint *duty);
> >
> > -#if IS_ENABLED(CONFIG_SANDBOX_SDL)
> > -/**
> > - * sandbox_sdl_set_bpp() - Set the depth of the sandbox display
> > - *
> > - * The device must not be active when this function is called. It activiates it
> > - * before returning.
> > - *
> > - * This updates the depth value and adjusts a few other settings accordingly.
> > - * It must be called before the display is probed.
> > - *
> > - * @dev: Device to adjust
> > - * @l2bpp: depth to set
> > - * Return: 0 if the device was already active, other error if it fails to probe
> > - * after the change
> > - */
> > -int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
> > -#else
> > -static inline int sandbox_sdl_set_bpp(struct udevice *dev,
> > - enum video_log2_bpp l2bpp)
> > -{
> > - return -ENOSYS;
> > -}
> > -#endif
> > -
> > /**
> > * sandbox_set_fake_efi_mgr_dev() - Control EFI bootmgr producing valid bootflow
> > *
> > diff --git a/test/dm/video.c b/test/dm/video.c
> > index 30778157d940..1c63d16bd28b 100644
> > --- a/test/dm/video.c
> > +++ b/test/dm/video.c
> > @@ -15,6 +15,7 @@
> > #include <video.h>
> > #include <video_console.h>
> > #include <asm/test.h>
> > +#include <asm/sdl.h>
>
> The problem with this is it then cannot be built on non-sandbox
> boards. I think v1 was OK.
I suggested this since the test is sandbox specific (the code itself is
full of sandbox_foo).
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] sandbox: fix a compilation error
2023-06-13 14:58 ` Simon Glass
2023-06-13 15:00 ` Tom Rini
@ 2023-06-13 16:05 ` Sergei Antonov
2023-06-13 17:33 ` Tom Rini
1 sibling, 1 reply; 7+ messages in thread
From: Sergei Antonov @ 2023-06-13 16:05 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, Tom Rini
On Tue, 13 Jun 2023 at 17:58, Simon Glass <sjg@chromium.org> wrote:
> The problem with this is it then cannot be built on non-sandbox
> boards. I think v1 was OK.
Before the patch as well as after the patch:
if CONFIG_SANDBOX_SDL
declaration of sandbox_sdl_set_bpp()
else
definition of sandbox_sdl_set_bpp() returning error
end
This patch only moves code to another header file in arch/sandbox/include/asm.
How can a non-sandbox build fail because of this patch?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] sandbox: fix a compilation error
2023-06-13 16:05 ` Sergei Antonov
@ 2023-06-13 17:33 ` Tom Rini
2023-06-13 20:12 ` Simon Glass
2023-07-23 13:23 ` Simon Glass
0 siblings, 2 replies; 7+ messages in thread
From: Tom Rini @ 2023-06-13 17:33 UTC (permalink / raw)
To: Sergei Antonov; +Cc: Simon Glass, u-boot
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
On Tue, Jun 13, 2023 at 07:05:52PM +0300, Sergei Antonov wrote:
> On Tue, 13 Jun 2023 at 17:58, Simon Glass <sjg@chromium.org> wrote:
> > The problem with this is it then cannot be built on non-sandbox
> > boards. I think v1 was OK.
>
> Before the patch as well as after the patch:
> if CONFIG_SANDBOX_SDL
> declaration of sandbox_sdl_set_bpp()
> else
> definition of sandbox_sdl_set_bpp() returning error
> end
> This patch only moves code to another header file in arch/sandbox/include/asm.
> How can a non-sandbox build fail because of this patch?
Right, test/dm/video.c is for sandbox-only.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] sandbox: fix a compilation error
2023-06-13 17:33 ` Tom Rini
@ 2023-06-13 20:12 ` Simon Glass
2023-07-23 13:23 ` Simon Glass
1 sibling, 0 replies; 7+ messages in thread
From: Simon Glass @ 2023-06-13 20:12 UTC (permalink / raw)
To: Tom Rini; +Cc: Sergei Antonov, u-boot
Hi,
On Tue, 13 Jun 2023 at 18:33, Tom Rini <trini@konsulko.com> wrote:
>
> On Tue, Jun 13, 2023 at 07:05:52PM +0300, Sergei Antonov wrote:
> > On Tue, 13 Jun 2023 at 17:58, Simon Glass <sjg@chromium.org> wrote:
> > > The problem with this is it then cannot be built on non-sandbox
> > > boards. I think v1 was OK.
> >
> > Before the patch as well as after the patch:
> > if CONFIG_SANDBOX_SDL
> > declaration of sandbox_sdl_set_bpp()
> > else
> > definition of sandbox_sdl_set_bpp() returning error
> > end
> > This patch only moves code to another header file in arch/sandbox/include/asm.
> > How can a non-sandbox build fail because of this patch?
>
> Right, test/dm/video.c is for sandbox-only.
OK, yes.
Reviewed-by: Simon Glass <sjg@chromium.org>
Regards,
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] sandbox: fix a compilation error
2023-06-13 17:33 ` Tom Rini
2023-06-13 20:12 ` Simon Glass
@ 2023-07-23 13:23 ` Simon Glass
1 sibling, 0 replies; 7+ messages in thread
From: Simon Glass @ 2023-07-23 13:23 UTC (permalink / raw)
To: Simon Glass; +Cc: Sergei Antonov, u-boot, Tom Rini
Hi,
On Tue, 13 Jun 2023 at 18:33, Tom Rini <trini@konsulko.com> wrote:
>
> On Tue, Jun 13, 2023 at 07:05:52PM +0300, Sergei Antonov wrote:
> > On Tue, 13 Jun 2023 at 17:58, Simon Glass <sjg@chromium.org> wrote:
> > > The problem with this is it then cannot be built on non-sandbox
> > > boards. I think v1 was OK.
> >
> > Before the patch as well as after the patch:
> > if CONFIG_SANDBOX_SDL
> > declaration of sandbox_sdl_set_bpp()
> > else
> > definition of sandbox_sdl_set_bpp() returning error
> > end
> > This patch only moves code to another header file in arch/sandbox/include/asm.
> > How can a non-sandbox build fail because of this patch?
>
> Right, test/dm/video.c is for sandbox-only.
OK, yes.
Reviewed-by: Simon Glass <sjg@chromium.org>
Regards,
Simon
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-23 13:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 21:19 [PATCH v2] sandbox: fix a compilation error Sergei Antonov
2023-06-13 14:58 ` Simon Glass
2023-06-13 15:00 ` Tom Rini
2023-06-13 16:05 ` Sergei Antonov
2023-06-13 17:33 ` Tom Rini
2023-06-13 20:12 ` Simon Glass
2023-07-23 13:23 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.