Commit baae9561 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Linus Torvalds

[PATCH] serio 'id' attributes

move serio port's id attributes into separate subdirectory:
       ..devices/serioX/id_type  -> ..devices/serioX/id/type
       ..devices/serioX/id_proto -> ..devices/serioX/id/proto
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ff2c873
...@@ -388,6 +388,24 @@ static ssize_t serio_show_id_extra(struct device *dev, char *buf) ...@@ -388,6 +388,24 @@ static ssize_t serio_show_id_extra(struct device *dev, char *buf)
return sprintf(buf, "%02x\n", serio->id.extra); return sprintf(buf, "%02x\n", serio->id.extra);
} }
static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL);
static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
static struct attribute *serio_device_id_attrs[] = {
&dev_attr_type.attr,
&dev_attr_proto.attr,
&dev_attr_id.attr,
&dev_attr_extra.attr,
NULL
};
static struct attribute_group serio_id_attr_group = {
.name = "id",
.attrs = serio_device_id_attrs,
};
static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count)
{ {
struct serio *serio = to_serio_port(dev); struct serio *serio = to_serio_port(dev);
...@@ -444,10 +462,6 @@ static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t c ...@@ -444,10 +462,6 @@ static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t c
static struct device_attribute serio_device_attrs[] = { static struct device_attribute serio_device_attrs[] = {
__ATTR(description, S_IRUGO, serio_show_description, NULL), __ATTR(description, S_IRUGO, serio_show_description, NULL),
__ATTR(id_type, S_IRUGO, serio_show_id_type, NULL),
__ATTR(id_proto, S_IRUGO, serio_show_id_proto, NULL),
__ATTR(id_id, S_IRUGO, serio_show_id_id, NULL),
__ATTR(id_extra, S_IRUGO, serio_show_id_extra, NULL),
__ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
__ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
__ATTR_NULL __ATTR_NULL
...@@ -498,6 +512,7 @@ static void serio_add_port(struct serio *serio) ...@@ -498,6 +512,7 @@ static void serio_add_port(struct serio *serio)
if (serio->start) if (serio->start)
serio->start(serio); serio->start(serio);
device_add(&serio->dev); device_add(&serio->dev);
sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
serio->registered = 1; serio->registered = 1;
} }
...@@ -526,6 +541,7 @@ static void serio_destroy_port(struct serio *serio) ...@@ -526,6 +541,7 @@ static void serio_destroy_port(struct serio *serio)
} }
if (serio->registered) { if (serio->registered) {
sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
device_del(&serio->dev); device_del(&serio->dev);
list_del_init(&serio->node); list_del_init(&serio->node);
serio->registered = 0; serio->registered = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment