vmxnet3: Disable napi in suspend, reenable in resume.
[linux-2.6.git] / drivers / firmware / efivars.c
index 018ca1c..2a62ec6 100644 (file)
@@ -77,6 +77,7 @@
 #include <linux/sysfs.h>
 #include <linux/kobject.h>
 #include <linux/device.h>
+#include <linux/slab.h>
 
 #include <asm/uaccess.h>
 
@@ -362,7 +363,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,
        return ret;
 }
 
-static struct sysfs_ops efivar_attr_ops = {
+static const struct sysfs_ops efivar_attr_ops = {
        .show = efivar_attr_show,
        .store = efivar_attr_store,
 };
@@ -397,11 +398,11 @@ static struct kobj_type efivar_ktype = {
 static inline void
 efivar_unregister(struct efivar_entry *var)
 {
-       kobject_unregister(&var->kobj);
+       kobject_put(&var->kobj);
 }
 
 
-static ssize_t efivar_create(struct kobject *kobj,
+static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
                             struct bin_attribute *bin_attr,
                             char *buf, loff_t pos, size_t count)
 {
@@ -460,7 +461,7 @@ static ssize_t efivar_create(struct kobject *kobj,
        return count;
 }
 
-static ssize_t efivar_delete(struct kobject *kobj,
+static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
                             struct bin_attribute *bin_attr,
                             char *buf, loff_t pos, size_t count)
 {
@@ -572,8 +573,8 @@ static struct attribute_group efi_subsys_attr_group = {
 };
 
 
-static decl_subsys(vars, NULL);
-static struct kset *efi_kset;
+static struct kset *vars_kset;
+static struct kobject *efi_kobj;
 
 /*
  * efivar_create_sysfs_entry()
@@ -617,16 +618,16 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
        *(short_name + strlen(short_name)) = '-';
        efi_guid_unparse(vendor_guid, short_name + strlen(short_name));
 
-       kobject_set_name(&new_efivar->kobj, "%s", short_name);
-       new_efivar->kobj.kset = &vars_subsys;
-       new_efivar->kobj.ktype = &efivar_ktype;
-       i = kobject_register(&new_efivar->kobj);
+       new_efivar->kobj.kset = vars_kset;
+       i = kobject_init_and_add(&new_efivar->kobj, &efivar_ktype, NULL,
+                                "%s", short_name);
        if (i) {
                kfree(short_name);
                kfree(new_efivar);
                return 1;
        }
 
+       kobject_uevent(&new_efivar->kobj, KOBJ_ADD);
        kfree(short_name);
        short_name = NULL;
 
@@ -665,22 +666,18 @@ efivars_init(void)
        printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
               EFIVARS_DATE);
 
-       /*
-        * For now we'll register the efi subsys within this driver
-        */
-       efi_kset = kset_create_and_add("efi", NULL, &firmware_kset->kobj);
-       if (!efi_kset) {
+       /* For now we'll register the efi directory at /sys/firmware/efi */
+       efi_kobj = kobject_create_and_add("efi", firmware_kobj);
+       if (!efi_kobj) {
                printk(KERN_ERR "efivars: Firmware registration failed.\n");
                error = -ENOMEM;
                goto out_free;
        }
 
-       vars_subsys.kobj.kset = efi_kset;
-
-       error = subsystem_register(&vars_subsys);
-
-       if (error) {
-               printk(KERN_ERR "efivars: Subsystem registration failed with error %d.\n", error);
+       vars_kset = kset_create_and_add("vars", NULL, efi_kobj);
+       if (!vars_kset) {
+               printk(KERN_ERR "efivars: Subsystem registration failed.\n");
+               error = -ENOMEM;
                goto out_firmware_unregister;
        }
 
@@ -715,28 +712,28 @@ efivars_init(void)
         * Now add attributes to allow creation of new vars
         * and deletion of existing ones...
         */
-       error = sysfs_create_bin_file(&vars_subsys.kobj,
+       error = sysfs_create_bin_file(&vars_kset->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,
+       error = sysfs_create_bin_file(&vars_kset->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 */
-       error = sysfs_create_group(&efi_kset->kobj, &efi_subsys_attr_group);
+       error = sysfs_create_group(efi_kobj, &efi_subsys_attr_group);
        if (error)
                printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n", error);
        else
                goto out_free;
 
-       subsystem_unregister(&vars_subsys);
+       kset_unregister(vars_kset);
 
 out_firmware_unregister:
-       kset_unregister(efi_kset);
+       kobject_put(efi_kobj);
 
 out_free:
        kfree(variable_name);
@@ -756,8 +753,8 @@ efivars_exit(void)
                efivar_unregister(entry);
        }
 
-       subsystem_unregister(&vars_subsys);
-       kset_unregister(efi_kset);
+       kset_unregister(vars_kset);
+       kobject_put(efi_kobj);
 }
 
 module_init(efivars_init);