Commit 5ac94136 authored by Ard Biesheuvel's avatar Ard Biesheuvel

efi: vars: Drop __efivar_entry_iter() helper which is no longer used

__efivar_entry_iter() uses a list iterator in a dubious way, i.e., it
assumes that the iteration variable always points to an object of the
appropriate type, even if the list traversal exhausts the list
completely, in which case it will point somewhere in the vicinity of the
list's anchor instead.

Fortunately, we no longer use this function so we can just get rid of it
entirely.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 3a75f9f2
...@@ -1034,59 +1034,6 @@ void efivar_entry_iter_end(void) ...@@ -1034,59 +1034,6 @@ void efivar_entry_iter_end(void)
} }
EXPORT_SYMBOL_GPL(efivar_entry_iter_end); EXPORT_SYMBOL_GPL(efivar_entry_iter_end);
/**
* __efivar_entry_iter - iterate over variable list
* @func: callback function
* @head: head of the variable list
* @data: function-specific data to pass to callback
* @prev: entry to begin iterating from
*
* Iterate over the list of EFI variables and call @func with every
* entry on the list. It is safe for @func to remove entries in the
* list via efivar_entry_delete().
*
* You MUST call efivar_entry_iter_begin() before this function, and
* efivar_entry_iter_end() afterwards.
*
* It is possible to begin iteration from an arbitrary entry within
* the list by passing @prev. @prev is updated on return to point to
* the last entry passed to @func. To begin iterating from the
* beginning of the list @prev must be %NULL.
*
* The restrictions for @func are the same as documented for
* efivar_entry_iter().
*/
int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
struct list_head *head, void *data,
struct efivar_entry **prev)
{
struct efivar_entry *entry, *n;
int err = 0;
if (!prev || !*prev) {
list_for_each_entry_safe(entry, n, head, list) {
err = func(entry, data);
if (err)
break;
}
if (prev)
*prev = entry;
return err;
}
list_for_each_entry_safe_continue((*prev), n, head, list) {
err = func(*prev, data);
if (err)
break;
}
return err;
}
EXPORT_SYMBOL_GPL(__efivar_entry_iter);
/** /**
* efivar_entry_iter - iterate over variable list * efivar_entry_iter - iterate over variable list
* @func: callback function * @func: callback function
...@@ -1104,12 +1051,18 @@ EXPORT_SYMBOL_GPL(__efivar_entry_iter); ...@@ -1104,12 +1051,18 @@ EXPORT_SYMBOL_GPL(__efivar_entry_iter);
int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
struct list_head *head, void *data) struct list_head *head, void *data)
{ {
struct efivar_entry *entry, *n;
int err = 0; int err = 0;
err = efivar_entry_iter_begin(); err = efivar_entry_iter_begin();
if (err) if (err)
return err; return err;
err = __efivar_entry_iter(func, head, data, NULL);
list_for_each_entry_safe(entry, n, head, list) {
err = func(entry, data);
if (err)
break;
}
efivar_entry_iter_end(); efivar_entry_iter_end();
return err; return err;
......
...@@ -1083,9 +1083,6 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, ...@@ -1083,9 +1083,6 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes,
int efivar_entry_iter_begin(void); int efivar_entry_iter_begin(void);
void efivar_entry_iter_end(void); void efivar_entry_iter_end(void);
int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
struct list_head *head, void *data,
struct efivar_entry **prev);
int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
struct list_head *head, void *data); struct list_head *head, void *data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment