Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75765
b: refs/heads/master
c: 97fa5bb
h: refs/heads/master
i:
  75763: 438f7a8
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jan 25, 2008
1 parent 8a3b867 commit e240ca2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 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: af6370ea9268443351d6e931c702dc8162a1c8a1
refs/heads/master: 97fa5bb74c26fda93757b94ed248f5dabd4ad3d7
51 changes: 23 additions & 28 deletions trunk/drivers/firmware/efivars.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,6 @@ struct efivar_attribute efivar_attr_##_name = { \
.store = _store, \
};

#define VAR_SUBSYS_ATTR(_name, _mode, _show, _store) \
struct subsys_attribute var_subsys_attr_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode}, \
.show = _show, \
.store = _store, \
};

#define to_efivar_attr(_attr) container_of(_attr, struct efivar_attribute, attr)
#define to_efivar_entry(obj) container_of(obj, struct efivar_entry, kobj)

Expand Down Expand Up @@ -408,21 +401,16 @@ static struct kobj_type efivar_ktype = {
.default_attrs = def_attrs,
};

static ssize_t
dummy(struct kset *kset, char *buf)
{
return -ENODEV;
}

static inline void
efivar_unregister(struct efivar_entry *var)
{
kobject_unregister(&var->kobj);
}


static ssize_t
efivar_create(struct kset *kset, const char *buf, size_t count)
static ssize_t efivar_create(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{
struct efi_variable *new_var = (struct efi_variable *)buf;
struct efivar_entry *search_efivar, *n;
Expand Down Expand Up @@ -479,8 +467,9 @@ efivar_create(struct kset *kset, const char *buf, size_t count)
return count;
}

static ssize_t
efivar_delete(struct kset *kset, const char *buf, size_t count)
static ssize_t efivar_delete(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{
struct efi_variable *del_var = (struct efi_variable *)buf;
struct efivar_entry *search_efivar, *n;
Expand Down Expand Up @@ -537,13 +526,14 @@ efivar_delete(struct kset *kset, const char *buf, size_t count)
return count;
}

static VAR_SUBSYS_ATTR(new_var, 0200, dummy, efivar_create);
static VAR_SUBSYS_ATTR(del_var, 0200, dummy, efivar_delete);
static struct bin_attribute var_subsys_attr_new_var = {
.attr = {.name = "new_var", .mode = 0200},
.write = efivar_create,
};

static struct subsys_attribute *var_subsys_attrs[] = {
&var_subsys_attr_new_var,
&var_subsys_attr_del_var,
NULL,
static struct bin_attribute var_subsys_attr_del_var = {
.attr = {.name = "del_var", .mode = 0200},
.write = efivar_delete,
};

/*
Expand Down Expand Up @@ -728,11 +718,16 @@ efivars_init(void)
* Now add attributes to allow creation of new vars
* and deletion of existing ones...
*/

for (i = 0; (attr = var_subsys_attrs[i]) && !error; i++) {
if (attr->show && attr->store)
error = subsys_create_file(&vars_subsys, attr);
}
error = sysfs_create_bin_file(&vars_subsys.kobj,
&var_subsys_attr_new_var);
if (error)
printk(KERN_ERR "efivars: unable to create new_var sysfs file"
" due to error %d\n", error);
error = sysfs_create_bin_file(&vars_subsys.kobj,
&var_subsys_attr_del_var);
if (error)
printk(KERN_ERR "efivars: unable to create del_var sysfs file"
" due to error %d\n", error);

/* Don't forget the systab entry */

Expand Down

0 comments on commit e240ca2

Please sign in to comment.