aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2012-06-04 13:33:09 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-06-05 07:23:38 -0400
commit72f6e3a8bc956fddf6e004ae9b804977d1458e77 (patch)
tree9f5f05693a44a840a046d089451e2df927e8525f /drivers/s390
parent76e0377b2450af577077c7e4e00ae6da738d1884 (diff)
s390/vmlogrdr: cleanup driver attribute usage
Let the driver core handle driver 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')
-rw-r--r--drivers/s390/char/vmlogrdr.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index e9d70aedbaa2..5138fc93dc00 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -656,10 +656,19 @@ static ssize_t vmlogrdr_recording_status_show(struct device_driver *driver,
656 len = strlen(buf); 656 len = strlen(buf);
657 return len; 657 return len;
658} 658}
659
660
661static DRIVER_ATTR(recording_status, 0444, vmlogrdr_recording_status_show, 659static DRIVER_ATTR(recording_status, 0444, vmlogrdr_recording_status_show,
662 NULL); 660 NULL);
661static struct attribute *vmlogrdr_drv_attrs[] = {
662 &driver_attr_recording_status.attr,
663 NULL,
664};
665static struct attribute_group vmlogrdr_drv_attr_group = {
666 .attrs = vmlogrdr_drv_attrs,
667};
668static const struct attribute_group *vmlogrdr_drv_attr_groups[] = {
669 &vmlogrdr_drv_attr_group,
670 NULL,
671};
663 672
664static struct attribute *vmlogrdr_attrs[] = { 673static struct attribute *vmlogrdr_attrs[] = {
665 &dev_attr_autopurge.attr, 674 &dev_attr_autopurge.attr,
@@ -704,9 +713,9 @@ static struct device_driver vmlogrdr_driver = {
704 .name = "vmlogrdr", 713 .name = "vmlogrdr",
705 .bus = &iucv_bus, 714 .bus = &iucv_bus,
706 .pm = &vmlogrdr_pm_ops, 715 .pm = &vmlogrdr_pm_ops,
716 .groups = vmlogrdr_drv_attr_groups,
707}; 717};
708 718
709
710static int vmlogrdr_register_driver(void) 719static int vmlogrdr_register_driver(void)
711{ 720{
712 int ret; 721 int ret;
@@ -720,21 +729,14 @@ static int vmlogrdr_register_driver(void)
720 if (ret) 729 if (ret)
721 goto out_iucv; 730 goto out_iucv;
722 731
723 ret = driver_create_file(&vmlogrdr_driver,
724 &driver_attr_recording_status);
725 if (ret)
726 goto out_driver;
727
728 vmlogrdr_class = class_create(THIS_MODULE, "vmlogrdr"); 732 vmlogrdr_class = class_create(THIS_MODULE, "vmlogrdr");
729 if (IS_ERR(vmlogrdr_class)) { 733 if (IS_ERR(vmlogrdr_class)) {
730 ret = PTR_ERR(vmlogrdr_class); 734 ret = PTR_ERR(vmlogrdr_class);
731 vmlogrdr_class = NULL; 735 vmlogrdr_class = NULL;
732 goto out_attr; 736 goto out_driver;
733 } 737 }
734 return 0; 738 return 0;
735 739
736out_attr:
737 driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status);
738out_driver: 740out_driver:
739 driver_unregister(&vmlogrdr_driver); 741 driver_unregister(&vmlogrdr_driver);
740out_iucv: 742out_iucv:
@@ -748,7 +750,6 @@ static void vmlogrdr_unregister_driver(void)
748{ 750{
749 class_destroy(vmlogrdr_class); 751 class_destroy(vmlogrdr_class);
750 vmlogrdr_class = NULL; 752 vmlogrdr_class = NULL;
751 driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status);
752 driver_unregister(&vmlogrdr_driver); 753 driver_unregister(&vmlogrdr_driver);
753 iucv_unregister(&vmlogrdr_iucv_handler, 1); 754 iucv_unregister(&vmlogrdr_iucv_handler, 1);
754} 755}