[PATCH] Export device_add_attributes() so drivers can use it.
From: Grant Likely
Date: Wed Feb 18 2009 - 10:11:51 EST
From: Grant Likely <grant.likely@xxxxxxxxxxxx>
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@xxxxxxxxxxxx>
CC: linux-kernel@xxxxxxxxxxxxxxx
CC: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
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,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/