提交 baae9561 编写于 作者: D Dmitry Torokhov 提交者: 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: NDmitry Torokhov <dtor@mail.ru>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 1ff2c873
......@@ -388,6 +388,24 @@ static ssize_t serio_show_id_extra(struct device *dev, char *buf)
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)
{
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
static struct device_attribute serio_device_attrs[] = {
__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(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
__ATTR_NULL
......@@ -498,6 +512,7 @@ static void serio_add_port(struct serio *serio)
if (serio->start)
serio->start(serio);
device_add(&serio->dev);
sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
serio->registered = 1;
}
......@@ -526,6 +541,7 @@ static void serio_destroy_port(struct serio *serio)
}
if (serio->registered) {
sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
device_del(&serio->dev);
list_del_init(&serio->node);
serio->registered = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册