Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
72f6e3a8 76e0377b

+13 -12
+13 -12
drivers/s390/char/vmlogrdr.c
··· 656 656 len = strlen(buf); 657 657 return len; 658 658 } 659 - 660 - 661 659 static DRIVER_ATTR(recording_status, 0444, vmlogrdr_recording_status_show, 662 660 NULL); 661 + static struct attribute *vmlogrdr_drv_attrs[] = { 662 + &driver_attr_recording_status.attr, 663 + NULL, 664 + }; 665 + static struct attribute_group vmlogrdr_drv_attr_group = { 666 + .attrs = vmlogrdr_drv_attrs, 667 + }; 668 + static const struct attribute_group *vmlogrdr_drv_attr_groups[] = { 669 + &vmlogrdr_drv_attr_group, 670 + NULL, 671 + }; 663 672 664 673 static struct attribute *vmlogrdr_attrs[] = { 665 674 &dev_attr_autopurge.attr, ··· 713 704 .name = "vmlogrdr", 714 705 .bus = &iucv_bus, 715 706 .pm = &vmlogrdr_pm_ops, 707 + .groups = vmlogrdr_drv_attr_groups, 716 708 }; 717 - 718 709 719 710 static int vmlogrdr_register_driver(void) 720 711 { ··· 729 720 if (ret) 730 721 goto out_iucv; 731 722 732 - ret = driver_create_file(&vmlogrdr_driver, 733 - &driver_attr_recording_status); 734 - if (ret) 735 - goto out_driver; 736 - 737 723 vmlogrdr_class = class_create(THIS_MODULE, "vmlogrdr"); 738 724 if (IS_ERR(vmlogrdr_class)) { 739 725 ret = PTR_ERR(vmlogrdr_class); 740 726 vmlogrdr_class = NULL; 741 - goto out_attr; 727 + goto out_driver; 742 728 } 743 729 return 0; 744 730 745 - out_attr: 746 - driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status); 747 731 out_driver: 748 732 driver_unregister(&vmlogrdr_driver); 749 733 out_iucv: ··· 750 748 { 751 749 class_destroy(vmlogrdr_class); 752 750 vmlogrdr_class = NULL; 753 - driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status); 754 751 driver_unregister(&vmlogrdr_driver); 755 752 iucv_unregister(&vmlogrdr_iucv_handler, 1); 756 753 }