aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/serio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r--drivers/input/serio/serio.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index b28ea3379356..0beacb77ee18 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -388,6 +388,24 @@ static ssize_t serio_show_id_extra(struct device *dev, char *buf)
388 return sprintf(buf, "%02x\n", serio->id.extra); 388 return sprintf(buf, "%02x\n", serio->id.extra);
389} 389}
390 390
391static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL);
392static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
393static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
394static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
395
396static struct attribute *serio_device_id_attrs[] = {
397 &dev_attr_type.attr,
398 &dev_attr_proto.attr,
399 &dev_attr_id.attr,
400 &dev_attr_extra.attr,
401 NULL
402};
403
404static struct attribute_group serio_id_attr_group = {
405 .name = "id",
406 .attrs = serio_device_id_attrs,
407};
408
391static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) 409static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count)
392{ 410{
393 struct serio *serio = to_serio_port(dev); 411 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 462
445static struct device_attribute serio_device_attrs[] = { 463static struct device_attribute serio_device_attrs[] = {
446 __ATTR(description, S_IRUGO, serio_show_description, NULL), 464 __ATTR(description, S_IRUGO, serio_show_description, NULL),
447 __ATTR(id_type, S_IRUGO, serio_show_id_type, NULL),
448 __ATTR(id_proto, S_IRUGO, serio_show_id_proto, NULL),
449 __ATTR(id_id, S_IRUGO, serio_show_id_id, NULL),
450 __ATTR(id_extra, S_IRUGO, serio_show_id_extra, NULL),
451 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 465 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
452 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 466 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
453 __ATTR_NULL 467 __ATTR_NULL
@@ -498,6 +512,7 @@ static void serio_add_port(struct serio *serio)
498 if (serio->start) 512 if (serio->start)
499 serio->start(serio); 513 serio->start(serio);
500 device_add(&serio->dev); 514 device_add(&serio->dev);
515 sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
501 serio->registered = 1; 516 serio->registered = 1;
502} 517}
503 518
@@ -526,6 +541,7 @@ static void serio_destroy_port(struct serio *serio)
526 } 541 }
527 542
528 if (serio->registered) { 543 if (serio->registered) {
544 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
529 device_del(&serio->dev); 545 device_del(&serio->dev);
530 list_del_init(&serio->node); 546 list_del_init(&serio->node);
531 serio->registered = 0; 547 serio->registered = 0;