diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2009-11-24 10:54:04 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:02:06 -0500 |
commit | c1fad4176464281e776022dee7d029144afbeb13 (patch) | |
tree | c21502a9be5c0e500f4224565a054efbfa3d0254 /drivers/s390 | |
parent | d9742b42b5c76e2a3a39de0d187fac4f6852134e (diff) |
[SCSI] zfcp: Implement module unloading
With the reference counting for zfcp data structures, it is now
possible to implement module unloading again. Module unloading
requires to free all data structures in the module exit function. This
is done by unregistering zfcp from s390 cio and the SCSI midlayer
first in the module exit function.
Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 15 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ccw.c | 11 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 1 |
3 files changed, 14 insertions, 13 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index baef2ec7482f..12de1ce9a92d 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -189,7 +189,7 @@ static int __init zfcp_module_init(void) | |||
189 | goto out_misc; | 189 | goto out_misc; |
190 | } | 190 | } |
191 | 191 | ||
192 | retval = zfcp_ccw_register(); | 192 | retval = ccw_driver_register(&zfcp_ccw_driver); |
193 | if (retval) { | 193 | if (retval) { |
194 | pr_err("The zfcp device driver could not register with " | 194 | pr_err("The zfcp device driver could not register with " |
195 | "the common I/O layer\n"); | 195 | "the common I/O layer\n"); |
@@ -218,6 +218,19 @@ out: | |||
218 | 218 | ||
219 | module_init(zfcp_module_init); | 219 | module_init(zfcp_module_init); |
220 | 220 | ||
221 | static void __exit zfcp_module_exit(void) | ||
222 | { | ||
223 | ccw_driver_unregister(&zfcp_ccw_driver); | ||
224 | misc_deregister(&zfcp_cfdc_misc); | ||
225 | fc_release_transport(zfcp_data.scsi_transport_template); | ||
226 | kmem_cache_destroy(zfcp_data.gid_pn_cache); | ||
227 | kmem_cache_destroy(zfcp_data.sr_buffer_cache); | ||
228 | kmem_cache_destroy(zfcp_data.qtcb_cache); | ||
229 | kmem_cache_destroy(zfcp_data.gpn_ft_cache); | ||
230 | } | ||
231 | |||
232 | module_exit(zfcp_module_exit); | ||
233 | |||
221 | /** | 234 | /** |
222 | * zfcp_get_unit_by_lun - find unit in unit list of port by FCP LUN | 235 | * zfcp_get_unit_by_lun - find unit in unit list of port by FCP LUN |
223 | * @port: pointer to port to search for unit | 236 | * @port: pointer to port to search for unit |
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index ca8dffcd1e02..4d35902a0cc5 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c | |||
@@ -279,14 +279,3 @@ struct ccw_driver zfcp_ccw_driver = { | |||
279 | .thaw = zfcp_ccw_activate, | 279 | .thaw = zfcp_ccw_activate, |
280 | .restore = zfcp_ccw_activate, | 280 | .restore = zfcp_ccw_activate, |
281 | }; | 281 | }; |
282 | |||
283 | /** | ||
284 | * zfcp_ccw_register - ccw register function | ||
285 | * | ||
286 | * Registers the driver at the common i/o layer. This function will be called | ||
287 | * at module load time/system start. | ||
288 | */ | ||
289 | int __init zfcp_ccw_register(void) | ||
290 | { | ||
291 | return ccw_driver_register(&zfcp_ccw_driver); | ||
292 | } | ||
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 1e3ec708505b..5f205f85e6f9 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -27,7 +27,6 @@ extern void zfcp_adapter_release(struct kref *); | |||
27 | extern void zfcp_adapter_unregister(struct zfcp_adapter *); | 27 | extern void zfcp_adapter_unregister(struct zfcp_adapter *); |
28 | 28 | ||
29 | /* zfcp_ccw.c */ | 29 | /* zfcp_ccw.c */ |
30 | extern int zfcp_ccw_register(void); | ||
31 | extern int zfcp_ccw_priv_sch(struct zfcp_adapter *); | 30 | extern int zfcp_ccw_priv_sch(struct zfcp_adapter *); |
32 | extern struct ccw_driver zfcp_ccw_driver; | 31 | extern struct ccw_driver zfcp_ccw_driver; |
33 | extern struct zfcp_adapter *zfcp_ccw_adapter_by_cdev(struct ccw_device *); | 32 | extern struct zfcp_adapter *zfcp_ccw_adapter_by_cdev(struct ccw_device *); |