mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
efi: Merge boolean flag arguments
The parameters atomic and duplicates of efivar_init always have opposite values. Drop the parameter atomic, replace the uses of !atomic with duplicates, and update the call sites accordingly. The code using duplicates is slightly reorganized with an 'else', to avoid duplicating the lock code. Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Matt Fleming <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Jeremy Kerr <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Matthew Garrett <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Saurabh Sengar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vaishali Thakkar <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
fb7a84cac0
commit
1cfd63166c
4 changed files with 14 additions and 20 deletions
|
|
@ -661,7 +661,7 @@ static void efivar_update_sysfs_entries(struct work_struct *work)
|
|||
return;
|
||||
|
||||
err = efivar_init(efivar_update_sysfs_entry, entry,
|
||||
true, false, &efivar_sysfs_list);
|
||||
false, &efivar_sysfs_list);
|
||||
if (!err)
|
||||
break;
|
||||
|
||||
|
|
@ -730,8 +730,7 @@ int efivars_sysfs_init(void)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
efivar_init(efivars_sysfs_callback, NULL, false,
|
||||
true, &efivar_sysfs_list);
|
||||
efivar_init(efivars_sysfs_callback, NULL, true, &efivar_sysfs_list);
|
||||
|
||||
error = create_efivars_bin_attributes();
|
||||
if (error) {
|
||||
|
|
|
|||
|
|
@ -419,8 +419,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
|
|||
* Returns 0 on success, or a kernel error code on failure.
|
||||
*/
|
||||
int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
|
||||
void *data, bool atomic, bool duplicates,
|
||||
struct list_head *head)
|
||||
void *data, bool duplicates, struct list_head *head)
|
||||
{
|
||||
const struct efivar_operations *ops = __efivars->ops;
|
||||
unsigned long variable_name_size = 1024;
|
||||
|
|
@ -450,7 +449,7 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
|
|||
&vendor_guid);
|
||||
switch (status) {
|
||||
case EFI_SUCCESS:
|
||||
if (!atomic)
|
||||
if (duplicates)
|
||||
spin_unlock_irq(&__efivars->lock);
|
||||
|
||||
variable_name_size = var_name_strnsize(variable_name,
|
||||
|
|
@ -465,21 +464,19 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
|
|||
* and may end up looping here forever.
|
||||
*/
|
||||
if (duplicates &&
|
||||
variable_is_present(variable_name, &vendor_guid, head)) {
|
||||
variable_is_present(variable_name, &vendor_guid,
|
||||
head)) {
|
||||
dup_variable_bug(variable_name, &vendor_guid,
|
||||
variable_name_size);
|
||||
if (!atomic)
|
||||
spin_lock_irq(&__efivars->lock);
|
||||
|
||||
status = EFI_NOT_FOUND;
|
||||
break;
|
||||
} else {
|
||||
err = func(variable_name, vendor_guid,
|
||||
variable_name_size, data);
|
||||
if (err)
|
||||
status = EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
err = func(variable_name, vendor_guid, variable_name_size, data);
|
||||
if (err)
|
||||
status = EFI_NOT_FOUND;
|
||||
|
||||
if (!atomic)
|
||||
if (duplicates)
|
||||
spin_lock_irq(&__efivars->lock);
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue