diff options
author | Robert Love <robert.w.love@intel.com> | 2009-11-03 14:46:03 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:55 -0500 |
commit | 93e6d5ab9969a9200752658677eafd96772302f0 (patch) | |
tree | 80858e13b9ddeee57e1743438bbaedbf2e7740f0 /drivers/scsi/libfc | |
parent | 8866a5d9075b7129194576f5f810e85a693c40ba (diff) |
[SCSI] libfc: Move libfc_init and libfc_exit to fc_libfc.c
These routines are for the libfc kernel module and should be in
the libfc .c file.
Moving the libfc __init routine into fc_libfc.c caused the creation
of the fc_setup_fcp() and fc_destroy_fcp() routines so that
scsi_pkt_cachep was not exposed outside of fc_fcp.c.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r-- | drivers/scsi/libfc/fc_fcp.c | 63 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_libfc.c | 39 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_libfc.h | 2 |
3 files changed, 64 insertions, 40 deletions
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 8a31ced98bd0..866f78ac4ec2 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | #include "fc_libfc.h" | 42 | #include "fc_libfc.h" |
43 | 43 | ||
44 | static struct kmem_cache *scsi_pkt_cachep; | 44 | struct kmem_cache *scsi_pkt_cachep; |
45 | 45 | ||
46 | /* SRB state definitions */ | 46 | /* SRB state definitions */ |
47 | #define FC_SRB_FREE 0 /* cmd is free */ | 47 | #define FC_SRB_FREE 0 /* cmd is free */ |
@@ -2072,6 +2072,28 @@ void fc_fcp_destroy(struct fc_lport *lp) | |||
2072 | } | 2072 | } |
2073 | EXPORT_SYMBOL(fc_fcp_destroy); | 2073 | EXPORT_SYMBOL(fc_fcp_destroy); |
2074 | 2074 | ||
2075 | int fc_setup_fcp() | ||
2076 | { | ||
2077 | int rc = 0; | ||
2078 | |||
2079 | scsi_pkt_cachep = kmem_cache_create("libfc_fcp_pkt", | ||
2080 | sizeof(struct fc_fcp_pkt), | ||
2081 | 0, SLAB_HWCACHE_ALIGN, NULL); | ||
2082 | if (!scsi_pkt_cachep) { | ||
2083 | printk(KERN_ERR "libfc: Unable to allocate SRB cache, " | ||
2084 | "module load failed!"); | ||
2085 | rc = -ENOMEM; | ||
2086 | } | ||
2087 | |||
2088 | return rc; | ||
2089 | } | ||
2090 | |||
2091 | void fc_destroy_fcp() | ||
2092 | { | ||
2093 | if (scsi_pkt_cachep) | ||
2094 | kmem_cache_destroy(scsi_pkt_cachep); | ||
2095 | } | ||
2096 | |||
2075 | int fc_fcp_init(struct fc_lport *lp) | 2097 | int fc_fcp_init(struct fc_lport *lp) |
2076 | { | 2098 | { |
2077 | int rc; | 2099 | int rc; |
@@ -2104,42 +2126,3 @@ free_internal: | |||
2104 | return rc; | 2126 | return rc; |
2105 | } | 2127 | } |
2106 | EXPORT_SYMBOL(fc_fcp_init); | 2128 | EXPORT_SYMBOL(fc_fcp_init); |
2107 | |||
2108 | static int __init libfc_init(void) | ||
2109 | { | ||
2110 | int rc; | ||
2111 | |||
2112 | scsi_pkt_cachep = kmem_cache_create("libfc_fcp_pkt", | ||
2113 | sizeof(struct fc_fcp_pkt), | ||
2114 | 0, SLAB_HWCACHE_ALIGN, NULL); | ||
2115 | if (scsi_pkt_cachep == NULL) { | ||
2116 | printk(KERN_ERR "libfc: Unable to allocate SRB cache, " | ||
2117 | "module load failed!"); | ||
2118 | return -ENOMEM; | ||
2119 | } | ||
2120 | |||
2121 | rc = fc_setup_exch_mgr(); | ||
2122 | if (rc) | ||
2123 | goto destroy_pkt_cache; | ||
2124 | |||
2125 | rc = fc_setup_rport(); | ||
2126 | if (rc) | ||
2127 | goto destroy_em; | ||
2128 | |||
2129 | return rc; | ||
2130 | destroy_em: | ||
2131 | fc_destroy_exch_mgr(); | ||
2132 | destroy_pkt_cache: | ||
2133 | kmem_cache_destroy(scsi_pkt_cachep); | ||
2134 | return rc; | ||
2135 | } | ||
2136 | |||
2137 | static void __exit libfc_exit(void) | ||
2138 | { | ||
2139 | kmem_cache_destroy(scsi_pkt_cachep); | ||
2140 | fc_destroy_exch_mgr(); | ||
2141 | fc_destroy_rport(); | ||
2142 | } | ||
2143 | |||
2144 | module_init(libfc_init); | ||
2145 | module_exit(libfc_exit); | ||
diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c index e64ea870a4c8..01418ae8cb84 100644 --- a/drivers/scsi/libfc/fc_libfc.c +++ b/drivers/scsi/libfc/fc_libfc.c | |||
@@ -33,3 +33,42 @@ MODULE_LICENSE("GPL v2"); | |||
33 | unsigned int fc_debug_logging; | 33 | unsigned int fc_debug_logging; |
34 | module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR); | 34 | module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR); |
35 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); | 35 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); |
36 | |||
37 | /** | ||
38 | * libfc_init() - Initialize libfc.ko | ||
39 | */ | ||
40 | static int __init libfc_init(void) | ||
41 | { | ||
42 | int rc = 0; | ||
43 | |||
44 | rc = fc_setup_fcp(); | ||
45 | if (rc) | ||
46 | return rc; | ||
47 | |||
48 | rc = fc_setup_exch_mgr(); | ||
49 | if (rc) | ||
50 | goto destroy_pkt_cache; | ||
51 | |||
52 | rc = fc_setup_rport(); | ||
53 | if (rc) | ||
54 | goto destroy_em; | ||
55 | |||
56 | return rc; | ||
57 | destroy_em: | ||
58 | fc_destroy_exch_mgr(); | ||
59 | destroy_pkt_cache: | ||
60 | fc_destroy_fcp(); | ||
61 | return rc; | ||
62 | } | ||
63 | module_init(libfc_init); | ||
64 | |||
65 | /** | ||
66 | * libfc_exit() - Tear down libfc.ko | ||
67 | */ | ||
68 | static void __exit libfc_exit(void) | ||
69 | { | ||
70 | fc_destroy_fcp(); | ||
71 | fc_destroy_exch_mgr(); | ||
72 | fc_destroy_rport(); | ||
73 | } | ||
74 | module_exit(libfc_exit); | ||
diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h index 388fae4364af..0530149ac174 100644 --- a/drivers/scsi/libfc/fc_libfc.h +++ b/drivers/scsi/libfc/fc_libfc.h | |||
@@ -93,6 +93,8 @@ int fc_setup_exch_mgr(void); | |||
93 | void fc_destroy_exch_mgr(void); | 93 | void fc_destroy_exch_mgr(void); |
94 | int fc_setup_rport(void); | 94 | int fc_setup_rport(void); |
95 | void fc_destroy_rport(void); | 95 | void fc_destroy_rport(void); |
96 | int fc_setup_fcp(void); | ||
97 | void fc_destroy_fcp(void); | ||
96 | 98 | ||
97 | /* | 99 | /* |
98 | * Internal libfc functions | 100 | * Internal libfc functions |