diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:00 -0500 |
commit | f1cc54f8c6ad76cf41e21cbb4620b9549b882a01 (patch) | |
tree | c33aaee58dc5fbd609537e7b501684921736670b | |
parent | 140e92abe2bc9a0cd3ccfd11744ff4eb65319bb3 (diff) |
[PATCH] Char: istallion, move init and exit code
Let's have these function at the end of the driver and expand stli_init
directly into module_init fucntion, since there is nothing other to have
there.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/char/istallion.c | 113 |
1 files changed, 52 insertions, 61 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 1050c426dcd0..0f287f1b4342 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -595,7 +595,6 @@ static struct pci_driver stli_pcidriver; | |||
595 | */ | 595 | */ |
596 | 596 | ||
597 | static int stli_parsebrd(struct stlconf *confp, char **argp); | 597 | static int stli_parsebrd(struct stlconf *confp, char **argp); |
598 | static int stli_init(void); | ||
599 | static int stli_open(struct tty_struct *tty, struct file *filp); | 598 | static int stli_open(struct tty_struct *tty, struct file *filp); |
600 | static void stli_close(struct tty_struct *tty, struct file *filp); | 599 | static void stli_close(struct tty_struct *tty, struct file *filp); |
601 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count); | 600 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count); |
@@ -744,65 +743,6 @@ static void stli_cleanup_ports(struct stlibrd *brdp) | |||
744 | } | 743 | } |
745 | } | 744 | } |
746 | 745 | ||
747 | /* | ||
748 | * Loadable module initialization stuff. | ||
749 | */ | ||
750 | |||
751 | static int __init istallion_module_init(void) | ||
752 | { | ||
753 | stli_init(); | ||
754 | return 0; | ||
755 | } | ||
756 | |||
757 | /*****************************************************************************/ | ||
758 | |||
759 | static void __exit istallion_module_exit(void) | ||
760 | { | ||
761 | struct stlibrd *brdp; | ||
762 | unsigned int j; | ||
763 | int i; | ||
764 | |||
765 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, | ||
766 | stli_drvversion); | ||
767 | |||
768 | pci_unregister_driver(&stli_pcidriver); | ||
769 | /* | ||
770 | * Free up all allocated resources used by the ports. This includes | ||
771 | * memory and interrupts. | ||
772 | */ | ||
773 | if (stli_timeron) { | ||
774 | stli_timeron = 0; | ||
775 | del_timer_sync(&stli_timerlist); | ||
776 | } | ||
777 | |||
778 | i = tty_unregister_driver(stli_serial); | ||
779 | put_tty_driver(stli_serial); | ||
780 | for (j = 0; j < 4; j++) | ||
781 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, j)); | ||
782 | class_destroy(istallion_class); | ||
783 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | ||
784 | printk("STALLION: failed to un-register serial memory device, " | ||
785 | "errno=%d\n", -i); | ||
786 | |||
787 | kfree(stli_txcookbuf); | ||
788 | |||
789 | for (j = 0; (j < stli_nrbrds); j++) { | ||
790 | if ((brdp = stli_brds[j]) == NULL || (brdp->state & BST_PROBED)) | ||
791 | continue; | ||
792 | |||
793 | stli_cleanup_ports(brdp); | ||
794 | |||
795 | iounmap(brdp->membase); | ||
796 | if (brdp->iosize > 0) | ||
797 | release_region(brdp->iobase, brdp->iosize); | ||
798 | kfree(brdp); | ||
799 | stli_brds[j] = NULL; | ||
800 | } | ||
801 | } | ||
802 | |||
803 | module_init(istallion_module_init); | ||
804 | module_exit(istallion_module_exit); | ||
805 | |||
806 | /*****************************************************************************/ | 746 | /*****************************************************************************/ |
807 | 747 | ||
808 | /* | 748 | /* |
@@ -4601,10 +4541,14 @@ static const struct tty_operations stli_ops = { | |||
4601 | }; | 4541 | }; |
4602 | 4542 | ||
4603 | /*****************************************************************************/ | 4543 | /*****************************************************************************/ |
4544 | /* | ||
4545 | * Loadable module initialization stuff. | ||
4546 | */ | ||
4604 | 4547 | ||
4605 | static int __init stli_init(void) | 4548 | static int __init istallion_module_init(void) |
4606 | { | 4549 | { |
4607 | int i; | 4550 | int i; |
4551 | |||
4608 | printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); | 4552 | printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); |
4609 | 4553 | ||
4610 | spin_lock_init(&stli_lock); | 4554 | spin_lock_init(&stli_lock); |
@@ -4661,3 +4605,50 @@ static int __init stli_init(void) | |||
4661 | } | 4605 | } |
4662 | 4606 | ||
4663 | /*****************************************************************************/ | 4607 | /*****************************************************************************/ |
4608 | |||
4609 | static void __exit istallion_module_exit(void) | ||
4610 | { | ||
4611 | struct stlibrd *brdp; | ||
4612 | unsigned int j; | ||
4613 | int i; | ||
4614 | |||
4615 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, | ||
4616 | stli_drvversion); | ||
4617 | |||
4618 | pci_unregister_driver(&stli_pcidriver); | ||
4619 | /* | ||
4620 | * Free up all allocated resources used by the ports. This includes | ||
4621 | * memory and interrupts. | ||
4622 | */ | ||
4623 | if (stli_timeron) { | ||
4624 | stli_timeron = 0; | ||
4625 | del_timer_sync(&stli_timerlist); | ||
4626 | } | ||
4627 | |||
4628 | i = tty_unregister_driver(stli_serial); | ||
4629 | put_tty_driver(stli_serial); | ||
4630 | for (j = 0; j < 4; j++) | ||
4631 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, j)); | ||
4632 | class_destroy(istallion_class); | ||
4633 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | ||
4634 | printk("STALLION: failed to un-register serial memory device, " | ||
4635 | "errno=%d\n", -i); | ||
4636 | |||
4637 | kfree(stli_txcookbuf); | ||
4638 | |||
4639 | for (j = 0; (j < stli_nrbrds); j++) { | ||
4640 | if ((brdp = stli_brds[j]) == NULL || (brdp->state & BST_PROBED)) | ||
4641 | continue; | ||
4642 | |||
4643 | stli_cleanup_ports(brdp); | ||
4644 | |||
4645 | iounmap(brdp->membase); | ||
4646 | if (brdp->iosize > 0) | ||
4647 | release_region(brdp->iobase, brdp->iosize); | ||
4648 | kfree(brdp); | ||
4649 | stli_brds[j] = NULL; | ||
4650 | } | ||
4651 | } | ||
4652 | |||
4653 | module_init(istallion_module_init); | ||
4654 | module_exit(istallion_module_exit); | ||