diff options
author | Adrian Bunk <bunk@stusta.de> | 2007-03-25 11:14:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:07 -0400 |
commit | 9ab7e323af9f9efad3e20a14faa4d947adfac381 (patch) | |
tree | b91a69e506fe612875eac933ccf0e5eecc85e3e5 /drivers/media/video/cpia_pp.c | |
parent | 585553ecedabf434e5cdc59d05bf64596ceab7bc (diff) |
V4L/DVB (5471): Cpia_pp.c: convert to module_{init,exit}
After looking at a section bug (in the non-modular case, clearly
non-init code referenced the __initdata parport_nr[]), I thought it was
time to convert this driver to module_{init,exit}.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cpia_pp.c')
-rw-r--r-- | drivers/media/video/cpia_pp.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c index 86bd08270ded..19711aaf9a3e 100644 --- a/drivers/media/video/cpia_pp.c +++ b/drivers/media/video/cpia_pp.c | |||
@@ -62,7 +62,6 @@ static int cpia_pp_close(void *privdata); | |||
62 | #define PPCPIA_PARPORT_OFF -2 | 62 | #define PPCPIA_PARPORT_OFF -2 |
63 | #define PPCPIA_PARPORT_NONE -1 | 63 | #define PPCPIA_PARPORT_NONE -1 |
64 | 64 | ||
65 | #ifdef MODULE | ||
66 | static int parport_nr[PARPORT_MAX] = {[0 ... PARPORT_MAX - 1] = PPCPIA_PARPORT_UNSPEC}; | 65 | static int parport_nr[PARPORT_MAX] = {[0 ... PARPORT_MAX - 1] = PPCPIA_PARPORT_UNSPEC}; |
67 | static char *parport[PARPORT_MAX] = {NULL,}; | 66 | static char *parport[PARPORT_MAX] = {NULL,}; |
68 | 67 | ||
@@ -72,11 +71,6 @@ MODULE_LICENSE("GPL"); | |||
72 | 71 | ||
73 | module_param_array(parport, charp, NULL, 0); | 72 | module_param_array(parport, charp, NULL, 0); |
74 | MODULE_PARM_DESC(parport, "'auto' or a list of parallel port numbers. Just like lp."); | 73 | MODULE_PARM_DESC(parport, "'auto' or a list of parallel port numbers. Just like lp."); |
75 | #else | ||
76 | static int parport_nr[PARPORT_MAX] __initdata = | ||
77 | {[0 ... PARPORT_MAX - 1] = PPCPIA_PARPORT_UNSPEC}; | ||
78 | static int parport_ptr = 0; | ||
79 | #endif | ||
80 | 74 | ||
81 | struct pp_cam_entry { | 75 | struct pp_cam_entry { |
82 | struct pardevice *pdev; | 76 | struct pardevice *pdev; |
@@ -819,7 +813,7 @@ static struct parport_driver cpia_pp_driver = { | |||
819 | .detach = cpia_pp_detach, | 813 | .detach = cpia_pp_detach, |
820 | }; | 814 | }; |
821 | 815 | ||
822 | static int cpia_pp_init(void) | 816 | static int __init cpia_pp_init(void) |
823 | { | 817 | { |
824 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, | 818 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, |
825 | CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); | 819 | CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); |
@@ -838,8 +832,7 @@ static int cpia_pp_init(void) | |||
838 | return 0; | 832 | return 0; |
839 | } | 833 | } |
840 | 834 | ||
841 | #ifdef MODULE | 835 | static int __init cpia_init(void) |
842 | int init_module(void) | ||
843 | { | 836 | { |
844 | if (parport[0]) { | 837 | if (parport[0]) { |
845 | /* The user gave some parameters. Let's see what they were. */ | 838 | /* The user gave some parameters. Let's see what they were. */ |
@@ -866,38 +859,11 @@ int init_module(void) | |||
866 | return cpia_pp_init(); | 859 | return cpia_pp_init(); |
867 | } | 860 | } |
868 | 861 | ||
869 | void cleanup_module(void) | 862 | static void __exit cpia_cleanup(void) |
870 | { | 863 | { |
871 | parport_unregister_driver (&cpia_pp_driver); | 864 | parport_unregister_driver(&cpia_pp_driver); |
872 | return; | 865 | return; |
873 | } | 866 | } |
874 | 867 | ||
875 | #else /* !MODULE */ | 868 | module_init(cpia_init); |
876 | 869 | module_exit(cpia_cleanup); | |
877 | static int __init cpia_pp_setup(char *str) | ||
878 | { | ||
879 | int err; | ||
880 | |||
881 | if (!strncmp(str, "parport", 7)) { | ||
882 | int n = simple_strtoul(str + 7, NULL, 10); | ||
883 | if (parport_ptr < PARPORT_MAX) { | ||
884 | parport_nr[parport_ptr++] = n; | ||
885 | } else { | ||
886 | LOG("too many ports, %s ignored.\n", str); | ||
887 | } | ||
888 | } else if (!strcmp(str, "auto")) { | ||
889 | parport_nr[0] = PPCPIA_PARPORT_AUTO; | ||
890 | } else if (!strcmp(str, "none")) { | ||
891 | parport_nr[parport_ptr++] = PPCPIA_PARPORT_NONE; | ||
892 | } | ||
893 | |||
894 | err=cpia_pp_init(); | ||
895 | if (err) | ||
896 | return err; | ||
897 | |||
898 | return 1; | ||
899 | } | ||
900 | |||
901 | __setup("cpia_pp=", cpia_pp_setup); | ||
902 | |||
903 | #endif /* !MODULE */ | ||