|
@@ -1309,9 +1309,7 @@ static const struct inode_operations efivarfs_dir_inode_operations = {
|
|
|
.create = efivarfs_create,
|
|
|
};
|
|
|
|
|
|
-static struct pstore_info efi_pstore_info;
|
|
|
-
|
|
|
-#ifdef CONFIG_PSTORE
|
|
|
+#ifdef CONFIG_EFI_VARS_PSTORE
|
|
|
|
|
|
static int efi_pstore_open(struct pstore_info *psi)
|
|
|
{
|
|
@@ -1514,38 +1512,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-#else
|
|
|
-static int efi_pstore_open(struct pstore_info *psi)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int efi_pstore_close(struct pstore_info *psi)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count,
|
|
|
- struct timespec *timespec,
|
|
|
- char **buf, struct pstore_info *psi)
|
|
|
-{
|
|
|
- return -1;
|
|
|
-}
|
|
|
-
|
|
|
-static int efi_pstore_write(enum pstore_type_id type,
|
|
|
- enum kmsg_dump_reason reason, u64 *id,
|
|
|
- unsigned int part, int count, size_t size,
|
|
|
- struct pstore_info *psi)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
|
|
|
- struct timespec time, struct pstore_info *psi)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-#endif
|
|
|
|
|
|
static struct pstore_info efi_pstore_info = {
|
|
|
.owner = THIS_MODULE,
|
|
@@ -1557,6 +1523,24 @@ static struct pstore_info efi_pstore_info = {
|
|
|
.erase = efi_pstore_erase,
|
|
|
};
|
|
|
|
|
|
+static void efivar_pstore_register(struct efivars *efivars)
|
|
|
+{
|
|
|
+ efivars->efi_pstore_info = efi_pstore_info;
|
|
|
+ efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
|
|
|
+ if (efivars->efi_pstore_info.buf) {
|
|
|
+ efivars->efi_pstore_info.bufsize = 1024;
|
|
|
+ efivars->efi_pstore_info.data = efivars;
|
|
|
+ spin_lock_init(&efivars->efi_pstore_info.buf_lock);
|
|
|
+ pstore_register(&efivars->efi_pstore_info);
|
|
|
+ }
|
|
|
+}
|
|
|
+#else
|
|
|
+static void efivar_pstore_register(struct efivars *efivars)
|
|
|
+{
|
|
|
+ return;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
|
|
|
struct bin_attribute *bin_attr,
|
|
|
char *buf, loff_t pos, size_t count)
|
|
@@ -2025,15 +2009,7 @@ int register_efivars(struct efivars *efivars,
|
|
|
if (error)
|
|
|
unregister_efivars(efivars);
|
|
|
|
|
|
- efivars->efi_pstore_info = efi_pstore_info;
|
|
|
-
|
|
|
- efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
|
|
|
- if (efivars->efi_pstore_info.buf) {
|
|
|
- efivars->efi_pstore_info.bufsize = 1024;
|
|
|
- efivars->efi_pstore_info.data = efivars;
|
|
|
- spin_lock_init(&efivars->efi_pstore_info.buf_lock);
|
|
|
- pstore_register(&efivars->efi_pstore_info);
|
|
|
- }
|
|
|
+ efivar_pstore_register(efivars);
|
|
|
|
|
|
register_filesystem(&efivarfs_type);
|
|
|
|