globalvar: sync with nvvars
This patch fixes the behaviour when a driver creates a globalvar using
globalvar_add_simple_[string|int|bool|enum|ip]) *after* nvvars are
initialized and this globalvar is overwritten with a nvvar. Currently
this fix is not needed because all globalvars are registered before the
nvvars are initialized.

We have two different typed of globalvars. The first type, here referred
to as qualified globalvars, has a backend variable storage (the ones
created with globalvar_add_simple_[string|int|bool|enum|ip]), the other
created with globalvar_add_simple only has a dynamically allocted string
as backend.

Normally during startup of barebox the qualified globalvars are
registered and during load of nvvars are synced with the values from the
nvvars. Everything works fine in this case. However, when during nvvar
initialisation a globalvar for a nvvar does not exist, then it is
registered as unqualified globalvar. When then later some driver wants
to register a qualified globalvar for which a unqualified globalvar
already exists, it will get a -EEXIST. This is not the expected
behaviour. Instead, the current unqualified globalvar should be removed,
recreated as qualified globalvar and then afterwards synced with the
corresponding nvvar. This behaviour is fixed with this patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 5126579 commit 8776eca37aca1f8d5d2d7091314989d0cc24b89b
@Sascha Hauer Sascha Hauer authored on 7 Jun 2016
Showing 2 changed files
View
common/globalvar.c
View
include/param.h