+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2012
* Joe Hershberger, National Instruments, joe.hershberger@ni.com
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
-#include <environment.h>
-
-#if defined(CONFIG_NEEDS_MANUAL_RELOC)
-DECLARE_GLOBAL_DATA_PTR;
-#endif
+#include <env.h>
+#include <env_internal.h>
+#include <asm/global_data.h>
/*
* Look up a callback function pointer by name
* This is called specifically when the variable did not exist in the hash
* previously, so the blanket update did not find this variable.
*/
-void env_callback_init(ENTRY *var_entry)
+void env_callback_init(struct env_entry *var_entry)
{
const char *var_name = var_entry->key;
char callback_name[256] = "";
first_call = 0;
}
+ var_entry->callback = NULL;
+
/* look in the ".callbacks" var for a reference to this variable */
if (callback_list != NULL)
ret = env_attr_lookup(callback_list, var_name, callback_name);
if (!ret && strlen(callback_name)) {
clbkp = find_env_callback(callback_name);
if (clbkp != NULL)
-#if defined(CONFIG_NEEDS_MANUAL_RELOC)
- var_entry->callback = clbkp->callback + gd->reloc_off;
-#else
var_entry->callback = clbkp->callback;
-#endif
}
}
* Called on each existing env var prior to the blanket update since removing
* a callback association should remove its callback.
*/
-static int clear_callback(ENTRY *entry)
+static int clear_callback(struct env_entry *entry)
{
entry->callback = NULL;
*/
static int set_callback(const char *name, const char *value, void *priv)
{
- ENTRY e, *ep;
+ struct env_entry e, *ep;
struct env_clbk_tbl *clbkp;
e.key = name;
e.data = NULL;
e.callback = NULL;
- hsearch_r(e, FIND, &ep, &env_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
/* does the env variable actually exist? */
if (ep != NULL) {
/* assign the requested callback */
clbkp = find_env_callback(value);
if (clbkp != NULL)
-#if defined(CONFIG_NEEDS_MANUAL_RELOC)
- ep->callback = clbkp->callback + gd->reloc_off;
-#else
ep->callback = clbkp->callback;
-#endif
}
}