diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-01-05 20:56:03 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-01-06 03:19:48 -0500 |
commit | 386d8772980be01b94bd463ea1e745732d7eb502 (patch) | |
tree | c688b53250241684d8fd9f338e054066b5e1748e /drivers/input/serio | |
parent | b45d44e7e00c1726dac9437b66c05d3d27acb3f0 (diff) |
Input: serio - use device core to create 'id' attribute group
Instead of creating 'id' sysfs attribute group by ourselves rely on
device core to do that for us.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/serio.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 0236f0d5fd91..0a278f9f1d3a 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -452,6 +452,11 @@ static struct attribute_group serio_id_attr_group = { | |||
452 | .attrs = serio_device_id_attrs, | 452 | .attrs = serio_device_id_attrs, |
453 | }; | 453 | }; |
454 | 454 | ||
455 | static const struct attribute_group *serio_device_attr_groups[] = { | ||
456 | &serio_id_attr_group, | ||
457 | NULL | ||
458 | }; | ||
459 | |||
455 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 460 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
456 | { | 461 | { |
457 | struct serio *serio = to_serio_port(dev); | 462 | struct serio *serio = to_serio_port(dev); |
@@ -539,6 +544,7 @@ static void serio_init_port(struct serio *serio) | |||
539 | (long)atomic_inc_return(&serio_no) - 1); | 544 | (long)atomic_inc_return(&serio_no) - 1); |
540 | serio->dev.bus = &serio_bus; | 545 | serio->dev.bus = &serio_bus; |
541 | serio->dev.release = serio_release_port; | 546 | serio->dev.release = serio_release_port; |
547 | serio->dev.groups = serio_device_attr_groups; | ||
542 | if (serio->parent) { | 548 | if (serio->parent) { |
543 | serio->dev.parent = &serio->parent->dev; | 549 | serio->dev.parent = &serio->parent->dev; |
544 | serio->depth = serio->parent->depth + 1; | 550 | serio->depth = serio->parent->depth + 1; |
@@ -562,21 +568,17 @@ static void serio_add_port(struct serio *serio) | |||
562 | } | 568 | } |
563 | 569 | ||
564 | list_add_tail(&serio->node, &serio_list); | 570 | list_add_tail(&serio->node, &serio_list); |
571 | |||
565 | if (serio->start) | 572 | if (serio->start) |
566 | serio->start(serio); | 573 | serio->start(serio); |
574 | |||
567 | error = device_add(&serio->dev); | 575 | error = device_add(&serio->dev); |
568 | if (error) | 576 | if (error) |
569 | printk(KERN_ERR | 577 | printk(KERN_ERR |
570 | "serio: device_add() failed for %s (%s), error: %d\n", | 578 | "serio: device_add() failed for %s (%s), error: %d\n", |
571 | serio->phys, serio->name, error); | 579 | serio->phys, serio->name, error); |
572 | else { | 580 | else |
573 | serio->registered = true; | 581 | serio->registered = true; |
574 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | ||
575 | if (error) | ||
576 | printk(KERN_ERR | ||
577 | "serio: sysfs_create_group() failed for %s (%s), error: %d\n", | ||
578 | serio->phys, serio->name, error); | ||
579 | } | ||
580 | } | 582 | } |
581 | 583 | ||
582 | /* | 584 | /* |
@@ -604,7 +606,6 @@ static void serio_destroy_port(struct serio *serio) | |||
604 | } | 606 | } |
605 | 607 | ||
606 | if (serio->registered) { | 608 | if (serio->registered) { |
607 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); | ||
608 | device_del(&serio->dev); | 609 | device_del(&serio->dev); |
609 | serio->registered = false; | 610 | serio->registered = false; |
610 | } | 611 | } |