aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2011-02-22 13:54:46 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-02-25 12:02:17 -0500
commit1947c72a122a8c367fdfc650c39a98ba76cc573a (patch)
treed01a396ba55a8b2eaad60bc1df86ed44d1d63378
parent2443c8b23aea83d529868030e28f45a6fa6553b2 (diff)
[SCSI] zfcp: Move SCSI host and transport templates out of struct zfcp_data
The SCSI host and transport templates are the only members left in the global zfcp_data struct. Move them out of zfcp_data and remove the now unused zfcp_data struct. Also update the names of the register and unregister functions to use the zfcp_scsi prefix. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/s390/scsi/zfcp_aux.c14
-rw-r--r--drivers/s390/scsi/zfcp_def.h6
-rw-r--r--drivers/s390/scsi/zfcp_ext.h6
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c70
4 files changed, 48 insertions, 48 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index c94b666057cf..88691adc1283 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -132,11 +132,11 @@ static int __init zfcp_module_init(void)
132 if (!zfcp_fc_req_cache) 132 if (!zfcp_fc_req_cache)
133 goto out_fc_cache; 133 goto out_fc_cache;
134 134
135 zfcp_data.scsi_transport_template = 135 zfcp_scsi_transport_template =
136 fc_attach_transport(&zfcp_transport_functions); 136 fc_attach_transport(&zfcp_transport_functions);
137 if (!zfcp_data.scsi_transport_template) 137 if (!zfcp_scsi_transport_template)
138 goto out_transport; 138 goto out_transport;
139 scsi_transport_reserve_device(zfcp_data.scsi_transport_template, 139 scsi_transport_reserve_device(zfcp_scsi_transport_template,
140 sizeof(struct zfcp_scsi_dev)); 140 sizeof(struct zfcp_scsi_dev));
141 141
142 142
@@ -160,7 +160,7 @@ static int __init zfcp_module_init(void)
160out_ccw_register: 160out_ccw_register:
161 misc_deregister(&zfcp_cfdc_misc); 161 misc_deregister(&zfcp_cfdc_misc);
162out_misc: 162out_misc:
163 fc_release_transport(zfcp_data.scsi_transport_template); 163 fc_release_transport(zfcp_scsi_transport_template);
164out_transport: 164out_transport:
165 kmem_cache_destroy(zfcp_fc_req_cache); 165 kmem_cache_destroy(zfcp_fc_req_cache);
166out_fc_cache: 166out_fc_cache:
@@ -175,7 +175,7 @@ static void __exit zfcp_module_exit(void)
175{ 175{
176 ccw_driver_unregister(&zfcp_ccw_driver); 176 ccw_driver_unregister(&zfcp_ccw_driver);
177 misc_deregister(&zfcp_cfdc_misc); 177 misc_deregister(&zfcp_cfdc_misc);
178 fc_release_transport(zfcp_data.scsi_transport_template); 178 fc_release_transport(zfcp_scsi_transport_template);
179 kmem_cache_destroy(zfcp_fc_req_cache); 179 kmem_cache_destroy(zfcp_fc_req_cache);
180 kmem_cache_destroy(zfcp_fsf_qtcb_cache); 180 kmem_cache_destroy(zfcp_fsf_qtcb_cache);
181} 181}
@@ -413,7 +413,7 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
413 adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN; 413 adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
414 adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; 414 adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
415 415
416 if (!zfcp_adapter_scsi_register(adapter)) 416 if (!zfcp_scsi_adapter_register(adapter))
417 return adapter; 417 return adapter;
418 418
419failed: 419failed:
@@ -430,7 +430,7 @@ void zfcp_adapter_unregister(struct zfcp_adapter *adapter)
430 zfcp_destroy_adapter_work_queue(adapter); 430 zfcp_destroy_adapter_work_queue(adapter);
431 431
432 zfcp_fc_wka_ports_force_offline(adapter->gs); 432 zfcp_fc_wka_ports_force_offline(adapter->gs);
433 zfcp_adapter_scsi_unregister(adapter); 433 zfcp_scsi_adapter_unregister(adapter);
434 sysfs_remove_group(&cdev->dev.kobj, &zfcp_sysfs_adapter_attrs); 434 sysfs_remove_group(&cdev->dev.kobj, &zfcp_sysfs_adapter_attrs);
435 435
436 zfcp_erp_thread_kill(adapter); 436 zfcp_erp_thread_kill(adapter);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 6a764337f06e..1566208997b6 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -313,10 +313,4 @@ struct zfcp_fsf_req {
313 void (*handler)(struct zfcp_fsf_req *); 313 void (*handler)(struct zfcp_fsf_req *);
314}; 314};
315 315
316/* driver data */
317struct zfcp_data {
318 struct scsi_host_template scsi_host_template;
319 struct scsi_transport_template *scsi_transport_template;
320};
321
322#endif /* ZFCP_DEF_H */ 316#endif /* ZFCP_DEF_H */
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 58c7e57ed615..410d9ddc175a 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -141,9 +141,9 @@ extern struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *,
141 struct qdio_buffer *); 141 struct qdio_buffer *);
142 142
143/* zfcp_scsi.c */ 143/* zfcp_scsi.c */
144extern struct zfcp_data zfcp_data; 144extern struct scsi_transport_template *zfcp_scsi_transport_template;
145extern int zfcp_adapter_scsi_register(struct zfcp_adapter *); 145extern int zfcp_scsi_adapter_register(struct zfcp_adapter *);
146extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *); 146extern void zfcp_scsi_adapter_unregister(struct zfcp_adapter *);
147extern struct fc_function_template zfcp_transport_functions; 147extern struct fc_function_template zfcp_transport_functions;
148extern void zfcp_scsi_rport_work(struct work_struct *); 148extern void zfcp_scsi_rport_work(struct work_struct *);
149extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *); 149extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *);
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index ddb5800823a9..dbba0827127f 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -292,7 +292,37 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
292 return SUCCESS; 292 return SUCCESS;
293} 293}
294 294
295int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) 295struct scsi_transport_template *zfcp_scsi_transport_template;
296
297static struct scsi_host_template zfcp_scsi_host_template = {
298 .module = THIS_MODULE,
299 .name = "zfcp",
300 .queuecommand = zfcp_scsi_queuecommand,
301 .eh_abort_handler = zfcp_scsi_eh_abort_handler,
302 .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
303 .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler,
304 .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler,
305 .slave_alloc = zfcp_scsi_slave_alloc,
306 .slave_configure = zfcp_scsi_slave_configure,
307 .slave_destroy = zfcp_scsi_slave_destroy,
308 .change_queue_depth = zfcp_scsi_change_queue_depth,
309 .proc_name = "zfcp",
310 .can_queue = 4096,
311 .this_id = -1,
312 .sg_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ,
313 .max_sectors = (ZFCP_QDIO_MAX_SBALES_PER_REQ * 8),
314 .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1,
315 .cmd_per_lun = 1,
316 .use_clustering = 1,
317 .shost_attrs = zfcp_sysfs_shost_attrs,
318 .sdev_attrs = zfcp_sysfs_sdev_attrs,
319};
320
321/**
322 * zfcp_scsi_adapter_register - Register SCSI and FC host with SCSI midlayer
323 * @adapter: The zfcp adapter to register with the SCSI midlayer
324 */
325int zfcp_scsi_adapter_register(struct zfcp_adapter *adapter)
296{ 326{
297 struct ccw_dev_id dev_id; 327 struct ccw_dev_id dev_id;
298 328
@@ -301,7 +331,7 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
301 331
302 ccw_device_get_id(adapter->ccw_device, &dev_id); 332 ccw_device_get_id(adapter->ccw_device, &dev_id);
303 /* register adapter as SCSI host with mid layer of SCSI stack */ 333 /* register adapter as SCSI host with mid layer of SCSI stack */
304 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, 334 adapter->scsi_host = scsi_host_alloc(&zfcp_scsi_host_template,
305 sizeof (struct zfcp_adapter *)); 335 sizeof (struct zfcp_adapter *));
306 if (!adapter->scsi_host) { 336 if (!adapter->scsi_host) {
307 dev_err(&adapter->ccw_device->dev, 337 dev_err(&adapter->ccw_device->dev,
@@ -316,7 +346,7 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
316 adapter->scsi_host->max_channel = 0; 346 adapter->scsi_host->max_channel = 0;
317 adapter->scsi_host->unique_id = dev_id.devno; 347 adapter->scsi_host->unique_id = dev_id.devno;
318 adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */ 348 adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */
319 adapter->scsi_host->transportt = zfcp_data.scsi_transport_template; 349 adapter->scsi_host->transportt = zfcp_scsi_transport_template;
320 350
321 adapter->scsi_host->hostdata[0] = (unsigned long) adapter; 351 adapter->scsi_host->hostdata[0] = (unsigned long) adapter;
322 352
@@ -328,7 +358,11 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
328 return 0; 358 return 0;
329} 359}
330 360
331void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter) 361/**
362 * zfcp_scsi_adapter_unregister - Unregister SCSI and FC host from SCSI midlayer
363 * @adapter: The zfcp adapter to unregister.
364 */
365void zfcp_scsi_adapter_unregister(struct zfcp_adapter *adapter)
332{ 366{
333 struct Scsi_Host *shost; 367 struct Scsi_Host *shost;
334 struct zfcp_port *port; 368 struct zfcp_port *port;
@@ -346,8 +380,6 @@ void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
346 scsi_remove_host(shost); 380 scsi_remove_host(shost);
347 scsi_host_put(shost); 381 scsi_host_put(shost);
348 adapter->scsi_host = NULL; 382 adapter->scsi_host = NULL;
349
350 return;
351} 383}
352 384
353static struct fc_host_statistics* 385static struct fc_host_statistics*
@@ -692,29 +724,3 @@ struct fc_function_template zfcp_transport_functions = {
692 .show_host_port_id = 1, 724 .show_host_port_id = 1,
693 .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els), 725 .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els),
694}; 726};
695
696struct zfcp_data zfcp_data = {
697 .scsi_host_template = {
698 .name = "zfcp",
699 .module = THIS_MODULE,
700 .proc_name = "zfcp",
701 .change_queue_depth = zfcp_scsi_change_queue_depth,
702 .slave_alloc = zfcp_scsi_slave_alloc,
703 .slave_configure = zfcp_scsi_slave_configure,
704 .slave_destroy = zfcp_scsi_slave_destroy,
705 .queuecommand = zfcp_scsi_queuecommand,
706 .eh_abort_handler = zfcp_scsi_eh_abort_handler,
707 .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
708 .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler,
709 .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler,
710 .can_queue = 4096,
711 .this_id = -1,
712 .sg_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ,
713 .cmd_per_lun = 1,
714 .use_clustering = 1,
715 .sdev_attrs = zfcp_sysfs_sdev_attrs,
716 .max_sectors = (ZFCP_QDIO_MAX_SBALES_PER_REQ * 8),
717 .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1,
718 .shost_attrs = zfcp_sysfs_shost_attrs,
719 },
720};