diff options
author | Robert Love <robert.w.love@intel.com> | 2009-11-03 22:46:03 +0300 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 21:00:55 +0300 |
commit | 93e6d5ab9969a9200752658677eafd96772302f0 (patch) | |
tree | 80858e13b9ddeee57e1743438bbaedbf2e7740f0 /drivers/scsi/libfc/fc_fcp.c | |
parent | 8866a5d9075b7129194576f5f810e85a693c40ba (diff) | |
download | linux-93e6d5ab9969a9200752658677eafd96772302f0.tar.xz |
[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/fc_fcp.c')
-rw-r--r-- | drivers/scsi/libfc/fc_fcp.c | 63 |
1 files changed, 23 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 @@ #include "fc_libfc.h" -static struct kmem_cache *scsi_pkt_cachep; +struct kmem_cache *scsi_pkt_cachep; /* SRB state definitions */ #define FC_SRB_FREE 0 /* cmd is free */ @@ -2072,6 +2072,28 @@ void fc_fcp_destroy(struct fc_lport *lp) } EXPORT_SYMBOL(fc_fcp_destroy); +int fc_setup_fcp() +{ + int rc = 0; + + scsi_pkt_cachep = kmem_cache_create("libfc_fcp_pkt", + sizeof(struct fc_fcp_pkt), + 0, SLAB_HWCACHE_ALIGN, NULL); + if (!scsi_pkt_cachep) { + printk(KERN_ERR "libfc: Unable to allocate SRB cache, " + "module load failed!"); + rc = -ENOMEM; + } + + return rc; +} + +void fc_destroy_fcp() +{ + if (scsi_pkt_cachep) + kmem_cache_destroy(scsi_pkt_cachep); +} + int fc_fcp_init(struct fc_lport *lp) { int rc; @@ -2104,42 +2126,3 @@ free_internal: return rc; } EXPORT_SYMBOL(fc_fcp_init); - -static int __init libfc_init(void) -{ - int rc; - - scsi_pkt_cachep = kmem_cache_create("libfc_fcp_pkt", - sizeof(struct fc_fcp_pkt), - 0, SLAB_HWCACHE_ALIGN, NULL); - if (scsi_pkt_cachep == NULL) { - printk(KERN_ERR "libfc: Unable to allocate SRB cache, " - "module load failed!"); - return -ENOMEM; - } - - rc = fc_setup_exch_mgr(); - if (rc) - goto destroy_pkt_cache; - - rc = fc_setup_rport(); - if (rc) - goto destroy_em; - - return rc; -destroy_em: - fc_destroy_exch_mgr(); -destroy_pkt_cache: - kmem_cache_destroy(scsi_pkt_cachep); - return rc; -} - -static void __exit libfc_exit(void) -{ - kmem_cache_destroy(scsi_pkt_cachep); - fc_destroy_exch_mgr(); - fc_destroy_rport(); -} - -module_init(libfc_init); -module_exit(libfc_exit); |