diff mbox series

[3/4] lib/hashtable.c: don't test ->callback in SPL

Message ID 20200227135600.28853-4-rasmus.villemoes@prevas.dk
State Accepted
Commit 34284970a1736e7be35bef74e4f8e429e703c1ce
Headers show
Series remove (more) env callback code for SPL | expand

Commit Message

Rasmus Villemoes Feb. 27, 2020, 1:56 p.m. UTC
In SPL, environment callbacks are not supported, so e->callback is
always NULL. Removing this makes the SPL a little smaller (about 400
bytes in my ppc build) with no functional change.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
---
 lib/hashtable.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Simon Glass Feb. 27, 2020, 11:40 p.m. UTC | #1
On Thu, 27 Feb 2020 at 05:56, Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> In SPL, environment callbacks are not supported, so e->callback is
> always NULL. Removing this makes the SPL a little smaller (about 400
> bytes in my ppc build) with no functional change.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
>  lib/hashtable.c | 2 ++
>  1 file changed, 2 insertions(+)

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

>
> diff --git a/lib/hashtable.c b/lib/hashtable.c
> index 574ec6af86..c4e1e2bd45 100644
> --- a/lib/hashtable.c
> +++ b/lib/hashtable.c
> @@ -226,8 +226,10 @@ static int
>  do_callback(const struct env_entry *e, const char *name, const char *value,
>             enum env_op op, int flags)
>  {
> +#ifndef CONFIG_SPL_BUILD
>         if (e->callback)
>                 return e->callback(name, value, op, flags);
> +#endif

blank line before return

>         return 0;
>  }


>
> --
> 2.23.0
>
Tom Rini April 24, 2020, 5:08 p.m. UTC | #2
On Thu, Feb 27, 2020 at 01:56:11PM +0000, Rasmus Villemoes wrote:

> In SPL, environment callbacks are not supported, so e->callback is
> always NULL. Removing this makes the SPL a little smaller (about 400
> bytes in my ppc build) with no functional change.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/lib/hashtable.c b/lib/hashtable.c
index 574ec6af86..c4e1e2bd45 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -226,8 +226,10 @@  static int
 do_callback(const struct env_entry *e, const char *name, const char *value,
 	    enum env_op op, int flags)
 {
+#ifndef CONFIG_SPL_BUILD
 	if (e->callback)
 		return e->callback(name, value, op, flags);
+#endif
 	return 0;
 }