Merge tag 'for-linus-v3.10-rc1-2' of git://oss.sgi.com/xfs/xfs
[firefly-linux-kernel-4.4.55.git] / drivers / firmware / efi / efi-pstore.c
index 47ae712c950441a31979072440112b843567c2e1..202d2c85ba2e79e2db866e78a03dffa240967f25 100644 (file)
@@ -1,6 +1,8 @@
 #include <linux/efi.h>
 #include <linux/module.h>
 #include <linux/pstore.h>
+#include <linux/slab.h>
+#include <linux/ucs2_string.h>
 
 #define DUMP_NAME_LEN 52
 
@@ -72,7 +74,11 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
        } else
                return 0;
 
-       __efivar_entry_size(entry, &size);
+       entry->var.DataSize = 1024;
+       __efivar_entry_get(entry, &entry->var.Attributes,
+                          &entry->var.DataSize, entry->var.Data);
+       size = entry->var.DataSize;
+
        *cb_data->buf = kmalloc(size, GFP_KERNEL);
        if (*cb_data->buf == NULL)
                return -ENOMEM;
@@ -140,15 +146,15 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data)
        efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
        efi_char16_t efi_name_old[DUMP_NAME_LEN];
        efi_char16_t *efi_name = ed->name;
-       unsigned long utf16_len = utf16_strlen(ed->name);
+       unsigned long ucs2_len = ucs2_strlen(ed->name);
        char name_old[DUMP_NAME_LEN];
        int i;
 
        if (efi_guidcmp(entry->var.VendorGuid, vendor))
                return 0;
 
-       if (utf16_strncmp(entry->var.VariableName,
-                         efi_name, (size_t)utf16_len)) {
+       if (ucs2_strncmp(entry->var.VariableName,
+                         efi_name, (size_t)ucs2_len)) {
                /*
                 * Check if an old format, which doesn't support
                 * holding multiple logs, remains.
@@ -159,13 +165,15 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data)
                for (i = 0; i < DUMP_NAME_LEN; i++)
                        efi_name_old[i] = name_old[i];
 
-               if (utf16_strncmp(entry->var.VariableName, efi_name_old,
-                                 utf16_strlen(efi_name_old)))
+               if (ucs2_strncmp(entry->var.VariableName, efi_name_old,
+                                 ucs2_strlen(efi_name_old)))
                        return 0;
        }
 
        /* found */
        __efivar_entry_delete(entry);
+       list_del(&entry->list);
+
        return 1;
 }
 
@@ -173,7 +181,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
                            struct timespec time, struct pstore_info *psi)
 {
        struct pstore_erase_data edata;
-       struct efivar_entry *entry;
+       struct efivar_entry *entry = NULL;
        char name[DUMP_NAME_LEN];
        efi_char16_t efi_name[DUMP_NAME_LEN];
        int found, i;