aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmlogrdr.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2012-06-04 13:32:13 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-06-05 07:23:37 -0400
commit76e0377b2450af577077c7e4e00ae6da738d1884 (patch)
treef2f8679ee66d1787ec3e7643a9611f193d0dc850 /drivers/s390/char/vmlogrdr.c
parent8d4ecfcb6bd19c562e60f80f13cf222db5b4a073 (diff)
s390/vmlogrdr: cleanup device attribute usage
Let the driver core handle device attribute creation and removal. This will simplify the code and eliminates races between attribute availability and userspace notification via uevents. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char/vmlogrdr.c')
-rw-r--r--drivers/s390/char/vmlogrdr.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index 524d988d89dd..e9d70aedbaa2 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -668,6 +668,13 @@ static struct attribute *vmlogrdr_attrs[] = {
668 &dev_attr_recording.attr, 668 &dev_attr_recording.attr,
669 NULL, 669 NULL,
670}; 670};
671static struct attribute_group vmlogrdr_attr_group = {
672 .attrs = vmlogrdr_attrs,
673};
674static const struct attribute_group *vmlogrdr_attr_groups[] = {
675 &vmlogrdr_attr_group,
676 NULL,
677};
671 678
672static int vmlogrdr_pm_prepare(struct device *dev) 679static int vmlogrdr_pm_prepare(struct device *dev)
673{ 680{
@@ -692,10 +699,6 @@ static const struct dev_pm_ops vmlogrdr_pm_ops = {
692 .prepare = vmlogrdr_pm_prepare, 699 .prepare = vmlogrdr_pm_prepare,
693}; 700};
694 701
695static struct attribute_group vmlogrdr_attr_group = {
696 .attrs = vmlogrdr_attrs,
697};
698
699static struct class *vmlogrdr_class; 702static struct class *vmlogrdr_class;
700static struct device_driver vmlogrdr_driver = { 703static struct device_driver vmlogrdr_driver = {
701 .name = "vmlogrdr", 704 .name = "vmlogrdr",
@@ -762,6 +765,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
762 dev->bus = &iucv_bus; 765 dev->bus = &iucv_bus;
763 dev->parent = iucv_root; 766 dev->parent = iucv_root;
764 dev->driver = &vmlogrdr_driver; 767 dev->driver = &vmlogrdr_driver;
768 dev->groups = vmlogrdr_attr_groups;
765 dev_set_drvdata(dev, priv); 769 dev_set_drvdata(dev, priv);
766 /* 770 /*
767 * The release function could be called after the 771 * The release function could be called after the
@@ -779,11 +783,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
779 return ret; 783 return ret;
780 } 784 }
781 785
782 ret = sysfs_create_group(&dev->kobj, &vmlogrdr_attr_group);
783 if (ret) {
784 device_unregister(dev);
785 return ret;
786 }
787 priv->class_device = device_create(vmlogrdr_class, dev, 786 priv->class_device = device_create(vmlogrdr_class, dev,
788 MKDEV(vmlogrdr_major, 787 MKDEV(vmlogrdr_major,
789 priv->minor_num), 788 priv->minor_num),
@@ -791,7 +790,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
791 if (IS_ERR(priv->class_device)) { 790 if (IS_ERR(priv->class_device)) {
792 ret = PTR_ERR(priv->class_device); 791 ret = PTR_ERR(priv->class_device);
793 priv->class_device=NULL; 792 priv->class_device=NULL;
794 sysfs_remove_group(&dev->kobj, &vmlogrdr_attr_group);
795 device_unregister(dev); 793 device_unregister(dev);
796 return ret; 794 return ret;
797 } 795 }
@@ -804,7 +802,6 @@ static int vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv)
804{ 802{
805 device_destroy(vmlogrdr_class, MKDEV(vmlogrdr_major, priv->minor_num)); 803 device_destroy(vmlogrdr_class, MKDEV(vmlogrdr_major, priv->minor_num));
806 if (priv->device != NULL) { 804 if (priv->device != NULL) {
807 sysfs_remove_group(&priv->device->kobj, &vmlogrdr_attr_group);
808 device_unregister(priv->device); 805 device_unregister(priv->device);
809 priv->device=NULL; 806 priv->device=NULL;
810 } 807 }