diff options
Diffstat (limited to 'drivers/parisc')
-rw-r--r-- | drivers/parisc/pdc_stable.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 11750cbb05c6..38bdca2fac6b 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <asm/hardware.h> | 57 | #include <asm/hardware.h> |
58 | 58 | ||
59 | #define PDCS_VERSION "0.09" | 59 | #define PDCS_VERSION "0.10" |
60 | 60 | ||
61 | #define PDCS_ADDR_PPRI 0x00 | 61 | #define PDCS_ADDR_PPRI 0x00 |
62 | #define PDCS_ADDR_OSID 0x40 | 62 | #define PDCS_ADDR_OSID 0x40 |
@@ -194,7 +194,8 @@ pdcspath_store(struct pdcspath_entry *entry) | |||
194 | return -EIO; | 194 | return -EIO; |
195 | } | 195 | } |
196 | 196 | ||
197 | entry->ready = 1; | 197 | /* kobject is already registered */ |
198 | entry->ready = 2; | ||
198 | 199 | ||
199 | DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); | 200 | DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); |
200 | 201 | ||
@@ -653,15 +654,21 @@ pdcs_register_pathentries(void) | |||
653 | { | 654 | { |
654 | unsigned short i; | 655 | unsigned short i; |
655 | struct pdcspath_entry *entry; | 656 | struct pdcspath_entry *entry; |
657 | int err; | ||
656 | 658 | ||
657 | for (i = 0; (entry = pdcspath_entries[i]); i++) { | 659 | for (i = 0; (entry = pdcspath_entries[i]); i++) { |
658 | if (pdcspath_fetch(entry) < 0) | 660 | if (pdcspath_fetch(entry) < 0) |
659 | continue; | 661 | continue; |
660 | 662 | ||
661 | kobject_set_name(&entry->kobj, "%s", entry->name); | 663 | if ((err = kobject_set_name(&entry->kobj, "%s", entry->name))) |
664 | return err; | ||
662 | kobj_set_kset_s(entry, paths_subsys); | 665 | kobj_set_kset_s(entry, paths_subsys); |
663 | kobject_register(&entry->kobj); | 666 | if ((err = kobject_register(&entry->kobj))) |
664 | 667 | return err; | |
668 | |||
669 | /* kobject is now registered */ | ||
670 | entry->ready = 2; | ||
671 | |||
665 | if (!entry->dev) | 672 | if (!entry->dev) |
666 | continue; | 673 | continue; |
667 | 674 | ||
@@ -675,14 +682,14 @@ pdcs_register_pathentries(void) | |||
675 | /** | 682 | /** |
676 | * pdcs_unregister_pathentries - Routine called when unregistering the module. | 683 | * pdcs_unregister_pathentries - Routine called when unregistering the module. |
677 | */ | 684 | */ |
678 | static inline void __exit | 685 | static inline void |
679 | pdcs_unregister_pathentries(void) | 686 | pdcs_unregister_pathentries(void) |
680 | { | 687 | { |
681 | unsigned short i; | 688 | unsigned short i; |
682 | struct pdcspath_entry *entry; | 689 | struct pdcspath_entry *entry; |
683 | 690 | ||
684 | for (i = 0; (entry = pdcspath_entries[i]); i++) | 691 | for (i = 0; (entry = pdcspath_entries[i]); i++) |
685 | if (entry->ready) | 692 | if (entry->ready >= 2) |
686 | kobject_unregister(&entry->kobj); | 693 | kobject_unregister(&entry->kobj); |
687 | } | 694 | } |
688 | 695 | ||
@@ -704,7 +711,7 @@ pdc_stable_init(void) | |||
704 | 711 | ||
705 | /* For now we'll register the pdc subsys within this driver */ | 712 | /* For now we'll register the pdc subsys within this driver */ |
706 | if ((rc = firmware_register(&pdc_subsys))) | 713 | if ((rc = firmware_register(&pdc_subsys))) |
707 | return rc; | 714 | goto fail_firmreg; |
708 | 715 | ||
709 | /* Don't forget the info entry */ | 716 | /* Don't forget the info entry */ |
710 | for (i = 0; (attr = pdcs_subsys_attrs[i]) && !error; i++) | 717 | for (i = 0; (attr = pdcs_subsys_attrs[i]) && !error; i++) |
@@ -713,12 +720,25 @@ pdc_stable_init(void) | |||
713 | 720 | ||
714 | /* register the paths subsys as a subsystem of pdc subsys */ | 721 | /* register the paths subsys as a subsystem of pdc subsys */ |
715 | kset_set_kset_s(&paths_subsys, pdc_subsys); | 722 | kset_set_kset_s(&paths_subsys, pdc_subsys); |
716 | subsystem_register(&paths_subsys); | 723 | if ((rc= subsystem_register(&paths_subsys))) |
724 | goto fail_subsysreg; | ||
717 | 725 | ||
718 | /* now we create all "files" for the paths subsys */ | 726 | /* now we create all "files" for the paths subsys */ |
719 | pdcs_register_pathentries(); | 727 | if ((rc = pdcs_register_pathentries())) |
728 | goto fail_pdcsreg; | ||
729 | |||
730 | return rc; | ||
720 | 731 | ||
721 | return 0; | 732 | fail_pdcsreg: |
733 | pdcs_unregister_pathentries(); | ||
734 | subsystem_unregister(&paths_subsys); | ||
735 | |||
736 | fail_subsysreg: | ||
737 | firmware_unregister(&pdc_subsys); | ||
738 | |||
739 | fail_firmreg: | ||
740 | printk(KERN_INFO "PDC Stable Storage bailing out\n"); | ||
741 | return rc; | ||
722 | } | 742 | } |
723 | 743 | ||
724 | static void __exit | 744 | static void __exit |