lkml.org 
[lkml]   [2009]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] device class: add symlink creation helpers
Date
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
drivers/base/class.c | 21 +++++++++++++++++++++
include/linux/device.h | 4 ++++
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 161746d..818cbe2 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -92,6 +92,25 @@ void class_remove_file(struct class *cls, const struct class_attribute *attr)
sysfs_remove_file(&cls->p->class_subsys.kobj, &attr->attr);
}

+int class_create_link(struct class *cls, struct kobject *target,
+ const char *name)
+{
+ int error;
+
+ if (cls)
+ error = sysfs_create_link(&cls->p->class_subsys.kobj,
+ target, name);
+ else
+ error = -EINVAL;
+ return error;
+}
+
+void class_remove_link(struct class *cls, const char *name)
+{
+ if (cls)
+ sysfs_remove_link(&cls->p->class_subsys.kobj, name);
+}
+
static struct class *class_get(struct class *cls)
{
if (cls)
@@ -585,6 +604,8 @@ int __init classes_init(void)

EXPORT_SYMBOL_GPL(class_create_file);
EXPORT_SYMBOL_GPL(class_remove_file);
+EXPORT_SYMBOL_GPL(class_create_link);
+EXPORT_SYMBOL_GPL(class_remove_link);
EXPORT_SYMBOL_GPL(class_unregister);
EXPORT_SYMBOL_GPL(class_destroy);

diff --git a/include/linux/device.h b/include/linux/device.h
index 2ea3e49..e877be6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -262,6 +262,10 @@ extern int __must_check class_create_file(struct class *class,
const struct class_attribute *attr);
extern void class_remove_file(struct class *class,
const struct class_attribute *attr);
+extern int __must_check class_create_link(struct class *class,
+ struct kobject *target,
+ const char *name);
+extern void class_remove_link(struct class *class, const char *name);

struct class_interface {
struct list_head node;
--
1.6.5.2


\
 
 \ /
  Last update: 2009-12-09 14:53    [W:0.131 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site