mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: joeyli <jlee@suse.com>
To: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	glin@suse.com, Lee@grenadilla.canonical.com,
	Matthew Garrett <mjg@redhat.com>, Peter Jones <pjones@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Matt Fleming <matt.fleming@intel.com>
Subject: Re: [PATCH 2/3] efi: add efivars kobject to efi sysfs folder
Date: Fri, 05 Oct 2012 14:51:18 +0800	[thread overview]
Message-ID: <1349419878.7884.15.camel@linux-s257.site> (raw)
In-Reply-To: <1349416496.810874.88263724621.2.gpush@pecola>

Hi Jeremy, 

於 五,2012-10-05 於 13:54 +0800,Jeremy Kerr 提到:
> 
> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
> index 4174f1b..e1253d6 100644
> --- a/drivers/firmware/efivars.c
> +++ b/drivers/firmware/efivars.c
> @@ -1487,6 +1487,7 @@ void unregister_efivars(struct efivars *efivars)
>                 sysfs_remove_bin_file(&efivars->kset->kobj,
> efivars->del_var);
>         kfree(efivars->new_var);
>         kfree(efivars->del_var);
> +       kobject_put(efivars->kobject);
>         kset_unregister(efivars->kset);
>  }
>  EXPORT_SYMBOL_GPL(unregister_efivars);
> @@ -1518,6 +1519,13 @@ int register_efivars(struct efivars *efivars,


Since more people prefer to use "efivarfs", so, I modified the patch for
replace "efivars" to "efivarfs" like following:


Thanks
Joey Lee


>From 5e64382a9a4ad538dd5ca94072d19c7a70e4c650 Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@suse.com>
Date: Sat, 15 Sep 2012 10:33:46 +0800
Subject: [PATCH] efi: add efivarfs kobject to efi sysfs folder

UEFI variable filesystem need a new mount point, so this patch add
efivarfs kobject to efi_kobj for create a /sys/firmware/efi/efivarfs
folder.

Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
 drivers/firmware/efivars.c |   11 +++++++++++
 include/linux/efi.h        |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 1e1aad0..7c1234e 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -1487,6 +1487,7 @@ void unregister_efivars(struct efivars *efivars)
 		sysfs_remove_bin_file(&efivars->kset->kobj, efivars->del_var);
 	kfree(efivars->new_var);
 	kfree(efivars->del_var);
+	kobject_put(efivars->kobject);
 	kset_unregister(efivars->kset);
 }
 EXPORT_SYMBOL_GPL(unregister_efivars);
@@ -1518,6 +1519,13 @@ int register_efivars(struct efivars *efivars,
 		goto out;
 	}
 
+	efivars->kobject = kobject_create_and_add("efivarfs", parent_kobj);
+	if (!efivars->kobject) {
+		pr_err("efivars: Subsystem registration failed.\n");
+		error = -ENOMEM;
+		goto err_unreg_vars;
+	}
+
 	/*
 	 * Per EFI spec, the maximum storage allocated for both
 	 * the variable name and variable data is 1024 bytes.
@@ -1562,6 +1570,9 @@ int register_efivars(struct efivars *efivars,
 
 	register_filesystem(&efivars_fs_type);
 
+err_unreg_vars:
+	kset_unregister(efivars->kset);
+
 out:
 	kfree(variable_name);
 
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 1829a97..c993f54 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -654,6 +654,7 @@ struct efivars {
 	spinlock_t lock;
 	struct list_head list;
 	struct kset *kset;
+	struct kobject *kobject;
 	struct bin_attribute *new_var, *del_var;
 	const struct efivar_operations *ops;
 	struct efivar_entry *walk_entry;
-- 
1.7.7

 


  reply	other threads:[~2012-10-05  6:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05  5:54 [PATCH 1/3] efi: Add support for a UEFI variable filesystem Jeremy Kerr
2012-10-05  5:54 ` [PATCH 3/3] efi: Handle deletions and size changes in efivarfs_write_file Jeremy Kerr
2012-10-05  5:54 ` [PATCH 2/3] efi: add efivars kobject to efi sysfs folder Jeremy Kerr
2012-10-05  6:51   ` joeyli [this message]
2012-10-05  7:44     ` Jeremy Kerr
2012-10-06 19:32 ` [PATCH 1/3] efi: Add support for a UEFI variable filesystem Matt Fleming
2012-10-11 10:32 ` [PATCH 0/5] efivarfs: fixes and cleanups Andy Whitcroft
2012-10-11 10:32   ` [PATCH 1/5] efivarfs: efivarfs_file_read ensure we free data in error paths Andy Whitcroft
2012-10-11 13:53     ` Jeremy Kerr
2012-10-11 10:32   ` [PATCH 2/5] efivarfs: efivarfs_create() ensure we drop our reference on inode on error Andy Whitcroft
2012-10-11 14:13     ` Jeremy Kerr
2012-10-12 19:03     ` Khalid Aziz
2012-10-12 19:21       ` Matt Fleming
2012-10-12 20:11         ` Khalid Aziz
2012-10-11 10:32   ` [PATCH 3/5] efivarfs: efivarfs_fill_super() fix inode reference counts Andy Whitcroft
2012-10-11 14:10     ` Jeremy Kerr
2012-10-11 10:32   ` [PATCH 4/5] efivarfs: efivarfs_fill_super() ensure we free our temporary name Andy Whitcroft
2012-10-11 13:59     ` Jeremy Kerr
2012-10-11 10:32   ` [PATCH 5/5] efivarfs: efivarfs_fill_super() ensure we clean up correctly on error Andy Whitcroft
2012-10-11 14:04     ` Jeremy Kerr
2012-10-11 16:06       ` Andy Whitcroft
2012-10-16  9:16         ` Jeremy Kerr
2012-10-11 12:40   ` [PATCH 0/5] efivarfs: fixes and cleanups Matthew Garrett
2012-10-11 12:48   ` Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349419878.7884.15.camel@linux-s257.site \
    --to=jlee@suse.com \
    --cc=Lee@grenadilla.canonical.com \
    --cc=glin@suse.com \
    --cc=hpa@zytor.com \
    --cc=jeremy.kerr@canonical.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mjg@redhat.com \
    --cc=pjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®