Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45858
b: refs/heads/master
c: 496a0fc
h: refs/heads/master
v: v3
  • Loading branch information
Matt Domsch authored and Linus Torvalds committed Jan 26, 2007
1 parent 1ced8ef commit ae641cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01f2073411e01777e3c6f45a4bf05ea76493f326
refs/heads/master: 496a0fc8c5572a626de41d56d7c7ed005a2c1b48
29 changes: 12 additions & 17 deletions trunk/drivers/firmware/efivars.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ struct efivar_entry {
struct kobject kobj;
};

#define get_efivar_entry(n) list_entry(n, struct efivar_entry, list)

struct efivar_attribute {
struct attribute attr;
ssize_t (*show) (struct efivar_entry *entry, char *buf);
Expand Down Expand Up @@ -386,9 +384,6 @@ static struct sysfs_ops efivar_attr_ops = {
static void efivar_release(struct kobject *kobj)
{
struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj);
spin_lock(&efivars_lock);
list_del(&var->list);
spin_unlock(&efivars_lock);
kfree(var);
}

Expand Down Expand Up @@ -430,9 +425,8 @@ static ssize_t
efivar_create(struct subsystem *sub, const char *buf, size_t count)
{
struct efi_variable *new_var = (struct efi_variable *)buf;
struct efivar_entry *search_efivar = NULL;
struct efivar_entry *search_efivar, *n;
unsigned long strsize1, strsize2;
struct list_head *pos, *n;
efi_status_t status = EFI_NOT_FOUND;
int found = 0;

Expand All @@ -444,8 +438,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count)
/*
* Does this variable already exist?
*/
list_for_each_safe(pos, n, &efivar_list) {
search_efivar = get_efivar_entry(pos);
list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
strsize2 = utf8_strsize(new_var->VariableName, 1024);
if (strsize1 == strsize2 &&
Expand Down Expand Up @@ -490,9 +483,8 @@ static ssize_t
efivar_delete(struct subsystem *sub, const char *buf, size_t count)
{
struct efi_variable *del_var = (struct efi_variable *)buf;
struct efivar_entry *search_efivar = NULL;
struct efivar_entry *search_efivar, *n;
unsigned long strsize1, strsize2;
struct list_head *pos, *n;
efi_status_t status = EFI_NOT_FOUND;
int found = 0;

Expand All @@ -504,8 +496,7 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
/*
* Does this variable already exist?
*/
list_for_each_safe(pos, n, &efivar_list) {
search_efivar = get_efivar_entry(pos);
list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
strsize2 = utf8_strsize(del_var->VariableName, 1024);
if (strsize1 == strsize2 &&
Expand Down Expand Up @@ -537,9 +528,9 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
spin_unlock(&efivars_lock);
return -EIO;
}
list_del(&search_efivar->list);
/* We need to release this lock before unregistering. */
spin_unlock(&efivars_lock);

efivar_unregister(search_efivar);

/* It's dead Jim.... */
Expand Down Expand Up @@ -768,10 +759,14 @@ efivars_init(void)
static void __exit
efivars_exit(void)
{
struct list_head *pos, *n;
struct efivar_entry *entry, *n;

list_for_each_safe(pos, n, &efivar_list)
efivar_unregister(get_efivar_entry(pos));
list_for_each_entry_safe(entry, n, &efivar_list, list) {
spin_lock(&efivars_lock);
list_del(&entry->list);
spin_unlock(&efivars_lock);
efivar_unregister(entry);
}

subsystem_unregister(&vars_subsys);
firmware_unregister(&efi_subsys);
Expand Down

0 comments on commit ae641cf

Please sign in to comment.