All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Export device_add_attributes() so drivers can use it.
@ 2009-02-18 15:11 Grant Likely
  2009-02-18 15:29 ` Greg KH
  0 siblings, 1 reply; 18+ messages in thread
From: Grant Likely @ 2009-02-18 15:11 UTC (permalink / raw)
  Cc: Grant Likely, linux-kernel, Greg Kroah-Hartman

From: Grant Likely <grant.likely@secretlab.ca>

I find myself using the pattern of device_add_attributes() and
device_remove_attributes() frequently in my drivers.  Rather than
reinventing the wheel every time, I'm floating this patch to export
the symbols to see how it is received.  If this looks okay then I'll
rework my drivers and post additional patches to use these functions.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
CC: linux-kernel@vger.kernel.org
CC: Greg Kroah-Hartman <gregkh@suse.de>
---

 drivers/base/core.c    |   10 ++++++----
 include/linux/device.h |    4 ++++
 2 files changed, 10 insertions(+), 4 deletions(-)


diff --git a/drivers/base/core.c b/drivers/base/core.c
index f3eae63..5393eb6 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -302,8 +302,8 @@ out:
 static struct device_attribute uevent_attr =
 	__ATTR(uevent, S_IRUGO | S_IWUSR, show_uevent, store_uevent);
 
-static int device_add_attributes(struct device *dev,
-				 struct device_attribute *attrs)
+int device_add_attributes(struct device *dev,
+			  struct device_attribute *attrs)
 {
 	int error = 0;
 	int i;
@@ -320,9 +320,10 @@ static int device_add_attributes(struct device *dev,
 	}
 	return error;
 }
+EXPORT_SYMBOL(device_add_attributes);
 
-static void device_remove_attributes(struct device *dev,
-				     struct device_attribute *attrs)
+void device_remove_attributes(struct device *dev,
+			      struct device_attribute *attrs)
 {
 	int i;
 
@@ -330,6 +331,7 @@ static void device_remove_attributes(struct device *dev,
 		for (i = 0; attr_name(attrs[i]); i++)
 			device_remove_file(dev, &attrs[i]);
 }
+EXPORT_SYMBOL(device_remove_attributes);
 
 static int device_add_groups(struct device *dev,
 			     struct attribute_group **groups)
diff --git a/include/linux/device.h b/include/linux/device.h
index 45e5b19..2a64d84 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -310,6 +310,10 @@ extern int __must_check device_create_file(struct device *device,
 					   struct device_attribute *entry);
 extern void device_remove_file(struct device *dev,
 			       struct device_attribute *attr);
+extern int device_add_attributes(struct device *dev,
+				 struct device_attribute *attrs);
+extern void device_remove_attributes(struct device *dev,
+				     struct device_attribute *attrs);
 extern int __must_check device_create_bin_file(struct device *dev,
 					       struct bin_attribute *attr);
 extern void device_remove_bin_file(struct device *dev,


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

end of thread, other threads:[~2009-02-26 23:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-18 15:11 [PATCH] Export device_add_attributes() so drivers can use it Grant Likely
2009-02-18 15:29 ` Greg KH
2009-02-18 15:45   ` Kay Sievers
2009-02-18 15:48     ` Grant Likely
2009-02-18 15:53       ` Kay Sievers
2009-02-18 16:34         ` Grant Likely
2009-02-18 16:49           ` Kay Sievers
2009-02-18 17:51             ` Grant Likely
2009-02-18 18:32               ` Kay Sievers
2009-02-18 18:39                 ` Greg KH
2009-02-18 19:14                   ` Kay Sievers
2009-02-19  6:50                   ` Grant Likely
2009-02-19 23:08                     ` Kay Sievers
2009-02-20 15:28                       ` Grant Likely
2009-02-20 18:35                         ` Greg KH
2009-02-26 22:28                         ` Kay Sievers
2009-02-26 23:52                           ` Grant Likely
2009-02-18 15:46   ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.