linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] attribute_container: update to use the group interface
@ 2008-01-03  0:48 James Bottomley
  2008-01-12  5:12 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: James Bottomley @ 2008-01-03  0:48 UTC (permalink / raw)
  To: Greg KH, Kay Sievers; +Cc: linux-kernel, linux-scsi

This patch is the beginning of moving the attribute_containers to use
attribute groups exclusively.  The attr element is now deprecated and
will eventually be removed (along with all the hand rolled code for
doing exactly what attribute groups do) when all the consumers are
converted to attribute groups.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---

Would you believe this is another one I'd like to send via the SCSI tree?

James


 drivers/base/attribute_container.c  |   14 ++++++++++++--
 include/linux/attribute_container.h |    1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c
index 7370d7c..5bf25c6 100644
--- a/drivers/base/attribute_container.c
+++ b/drivers/base/attribute_container.c
@@ -320,9 +320,14 @@ attribute_container_add_attrs(struct class_device *classdev)
 	struct class_device_attribute **attrs =	cont->attrs;
 	int i, error;
 
-	if (!attrs)
+	BUG_ON(attrs && cont->grp);
+
+	if (!attrs && !cont->grp)
 		return 0;
 
+	if (cont->grp)
+		return sysfs_create_group(&classdev->kobj, cont->grp);
+
 	for (i = 0; attrs[i]; i++) {
 		error = class_device_create_file(classdev, attrs[i]);
 		if (error)
@@ -378,9 +383,14 @@ attribute_container_remove_attrs(struct class_device *classdev)
 	struct class_device_attribute **attrs =	cont->attrs;
 	int i;
 
-	if (!attrs)
+	if (!attrs && !cont->grp)
 		return;
 
+	if (cont->grp) {
+		sysfs_remove_group(&classdev->kobj, cont->grp);
+		return ;
+	}
+
 	for (i = 0; attrs[i]; i++)
 		class_device_remove_file(classdev, attrs[i]);
 }
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 8ff2749..f558233 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -17,6 +17,7 @@ struct attribute_container {
 	struct list_head	node;
 	struct klist		containers;
 	struct class		*class;
+	struct attribute_group	*grp;
 	struct class_device_attribute **attrs;
 	int (*match)(struct attribute_container *, struct device *);
 #define	ATTRIBUTE_CONTAINER_NO_CLASSDEVS	0x01
-- 
1.5.3.7




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] attribute_container: update to use the group interface
  2008-01-03  0:48 [PATCH] attribute_container: update to use the group interface James Bottomley
@ 2008-01-12  5:12 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2008-01-12  5:12 UTC (permalink / raw)
  To: James Bottomley; +Cc: Kay Sievers, linux-kernel, linux-scsi

On Wed, Jan 02, 2008 at 06:48:47PM -0600, James Bottomley wrote:
> This patch is the beginning of moving the attribute_containers to use
> attribute groups exclusively.  The attr element is now deprecated and
> will eventually be removed (along with all the hand rolled code for
> doing exactly what attribute groups do) when all the consumers are
> converted to attribute groups.
> 
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Feel free to add:
	Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

and take it through your tree.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-12  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03  0:48 [PATCH] attribute_container: update to use the group interface James Bottomley
2008-01-12  5:12 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).