aboutsummaryrefslogtreecommitdiff
path: root/common/splash.c
diff options
context:
space:
mode:
authorNikhil M Jain <n-jain1@ti.com>2023-04-20 17:41:12 +0530
committerAnatolij Gustschin <agust@denx.de>2023-04-24 21:37:45 +0200
commit9eeb1a299d40a4587d5b3c2b87ae8022998cf766 (patch)
tree4c2fa3efe6bf04365faae3cc0f2a5de4ea0a6633 /common/splash.c
parent53ae978af51df7926ffa2e2cd0ab2b5196a66ec8 (diff)
common: Replace #ifdef and #if with if's
Avoid using preprocessor compilation directives and instead use simple logical expressions for better readability since compiler will anyway optimize out the respective code block if condition is not satisfied. Signed-off-by: Nikhil M Jain <n-jain1@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Diffstat (limited to 'common/splash.c')
-rw-r--r--common/splash.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/splash.c b/common/splash.c
index a4e68b7042..6820db683b 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -96,12 +96,11 @@ __weak int splash_screen_prepare(void)
return splash_video_logo_load();
}
-#if CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN)
void splash_get_pos(int *x, int *y)
{
char *s = env_get("splashpos");
- if (!s)
+ if (!CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) || !s)
return;
if (s[0] == 'm')
@@ -117,7 +116,6 @@ void splash_get_pos(int *x, int *y)
*y = simple_strtol(s + 1, NULL, 0);
}
}
-#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
#if CONFIG_IS_ENABLED(VIDEO) && !CONFIG_IS_ENABLED(HIDE_LOGO_VERSION)
@@ -159,13 +157,13 @@ void splash_display_banner(void)
* Common function to show a splash image if env("splashimage") is set.
* For additional details please refer to doc/README.splashprepare.
*/
-#if CONFIG_IS_ENABLED(SPLASH_SCREEN) && CONFIG_IS_ENABLED(BMP)
int splash_display(void)
{
ulong addr;
char *s;
int x = 0, y = 0, ret;
-
+ if (!CONFIG_IS_ENABLED(SPLASH_SCREEN))
+ return -ENOSYS;
s = env_get("splashimage");
if (!s)
return -EINVAL;
@@ -177,7 +175,10 @@ int splash_display(void)
splash_get_pos(&x, &y);
- ret = bmp_display(addr, x, y);
+ if (CONFIG_IS_ENABLED(BMP))
+ ret = bmp_display(addr, x, y);
+ else
+ return -ENOSYS;
/* Skip banner output on video console if the logo is not at 0,0 */
if (x || y)
@@ -189,4 +190,3 @@ int splash_display(void)
end:
return ret;
}
-#endif