mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 2.6.26-git] pcmcia: simplify rsrc_nonstatic attributes
       [not found] <200804280105.28343.david-b@pacbell.net>
@ 2008-06-12 19:13 ` David Brownell
  2008-06-14 13:55   ` Dominik Brodowski
  0 siblings, 1 reply; 2+ messages in thread
From: David Brownell @ 2008-06-12 19:13 UTC (permalink / raw)
  To: linux-pcmcia; +Cc: lkml

From: David Brownell <dbrownell@users.sourceforge.net>

Simplify sysfs attribute registration for sockets without static
resource mappings by using an attribute_group.  This shrinks object
size a bit:  use loops in sysfs code, but have more data.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
Updated version of patch sent 28-April:
  http://lists.infradead.org/pipermail/linux-pcmcia/2008-April/005432.html

 drivers/pcmcia/rsrc_nonstatic.c |   27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

--- g26.orig/drivers/pcmcia/rsrc_nonstatic.c	2008-05-01 12:53:37.000000000 -0700
+++ g26/drivers/pcmcia/rsrc_nonstatic.c	2008-05-01 13:01:28.000000000 -0700
@@ -1008,41 +1008,34 @@ static ssize_t store_mem_db(struct devic
 }
 static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db);
 
-static struct device_attribute *pccard_rsrc_attributes[] = {
-	&dev_attr_available_resources_io,
-	&dev_attr_available_resources_mem,
+static struct attribute *pccard_rsrc_attributes[] = {
+	&dev_attr_available_resources_io.attr,
+	&dev_attr_available_resources_mem.attr,
 	NULL,
 };
 
+static const struct attribute_group rsrc_attributes = {
+	.attrs = pccard_rsrc_attributes,
+};
+
 static int __devinit pccard_sysfs_add_rsrc(struct device *dev,
 					   struct class_interface *class_intf)
 {
 	struct pcmcia_socket *s = dev_get_drvdata(dev);
-	struct device_attribute **attr;
-	int ret = 0;
+
 	if (s->resource_ops != &pccard_nonstatic_ops)
 		return 0;
-
-	for (attr = pccard_rsrc_attributes; *attr; attr++) {
-		ret = device_create_file(dev, *attr);
-		if (ret)
-			break;
-	}
-
-	return ret;
+	return sysfs_create_group(&dev->kobj, &rsrc_attributes);
 }
 
 static void __devexit pccard_sysfs_remove_rsrc(struct device *dev,
 					       struct class_interface *class_intf)
 {
 	struct pcmcia_socket *s = dev_get_drvdata(dev);
-	struct device_attribute **attr;
 
 	if (s->resource_ops != &pccard_nonstatic_ops)
 		return;
-
-	for (attr = pccard_rsrc_attributes; *attr; attr++)
-		device_remove_file(dev, *attr);
+	sysfs_remove_group(&dev->kobj, &rsrc_attributes);
 }
 
 static struct class_interface pccard_rsrc_interface __refdata = {

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

* Re: [patch 2.6.26-git] pcmcia: simplify rsrc_nonstatic attributes
  2008-06-12 19:13 ` [patch 2.6.26-git] pcmcia: simplify rsrc_nonstatic attributes David Brownell
@ 2008-06-14 13:55   ` Dominik Brodowski
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2008-06-14 13:55 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-pcmcia, lkml


On Thu, Jun 12, 2008 at 12:13:55PM -0700, David Brownell wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>

Applied to pcmcia-git, and in the queue for what to push upstream
post-2.6.26.

Thanks,
	Dominik

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

end of thread, other threads:[~2008-06-14 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200804280105.28343.david-b@pacbell.net>
2008-06-12 19:13 ` [patch 2.6.26-git] pcmcia: simplify rsrc_nonstatic attributes David Brownell
2008-06-14 13:55   ` Dominik Brodowski

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®