[patch 2.6.25-git 2/3] pcmcia: remove pccard_rsrc_interface warnings

David Brownell david-b at pacbell.net
Mon Apr 28 04:05:28 EDT 2008


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

Remove section warnings from sysfs attribute support for PCMCIA
sockets that don't force static resource mappings:  just rename
the "class_interface" as a *_driver.

Simplify that attribute registration by using an attribute_group.
This is a minor shrink in object size.

Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
---
 drivers/pcmcia/rsrc_nonstatic.c |   33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

--- g26.orig/drivers/pcmcia/rsrc_nonstatic.c	2008-04-27 23:01:43.000000000 -0700
+++ g26/drivers/pcmcia/rsrc_nonstatic.c	2008-04-27 23:04:54.000000000 -0700
@@ -1008,44 +1008,37 @@ 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 = {
+static struct class_interface pccard_rsrc_driver = {
 	.class = &pcmcia_socket_class,
 	.add_dev = &pccard_sysfs_add_rsrc,
 	.remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc),
@@ -1053,12 +1046,12 @@ static struct class_interface pccard_rsr
 
 static int __init nonstatic_sysfs_init(void)
 {
-	return class_interface_register(&pccard_rsrc_interface);
+	return class_interface_register(&pccard_rsrc_driver);
 }
 
 static void __exit nonstatic_sysfs_exit(void)
 {
-	class_interface_unregister(&pccard_rsrc_interface);
+	class_interface_unregister(&pccard_rsrc_driver);
 }
 
 module_init(nonstatic_sysfs_init);



More information about the linux-pcmcia mailing list