]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[SCSI] zfcp: Move SCSI host and transport templates out of struct zfcp_data
authorChristof Schmitt <christof.schmitt@de.ibm.com>
Tue, 22 Feb 2011 18:54:46 +0000 (19:54 +0100)
committerJames Bottomley <James.Bottomley@suse.de>
Fri, 25 Feb 2011 17:02:17 +0000 (12:02 -0500)
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>
drivers/s390/scsi/zfcp_aux.c
drivers/s390/scsi/zfcp_def.h
drivers/s390/scsi/zfcp_ext.h
drivers/s390/scsi/zfcp_scsi.c

index c94b666057cff6340be655f6486bafcb36c9dabd..88691adc12833eff35c6923537a0088572ee82bb 100644 (file)
@@ -132,11 +132,11 @@ static int __init zfcp_module_init(void)
        if (!zfcp_fc_req_cache)
                goto out_fc_cache;
 
-       zfcp_data.scsi_transport_template =
+       zfcp_scsi_transport_template =
                fc_attach_transport(&zfcp_transport_functions);
-       if (!zfcp_data.scsi_transport_template)
+       if (!zfcp_scsi_transport_template)
                goto out_transport;
-       scsi_transport_reserve_device(zfcp_data.scsi_transport_template,
+       scsi_transport_reserve_device(zfcp_scsi_transport_template,
                                      sizeof(struct zfcp_scsi_dev));
 
 
@@ -160,7 +160,7 @@ static int __init zfcp_module_init(void)
 out_ccw_register:
        misc_deregister(&zfcp_cfdc_misc);
 out_misc:
-       fc_release_transport(zfcp_data.scsi_transport_template);
+       fc_release_transport(zfcp_scsi_transport_template);
 out_transport:
        kmem_cache_destroy(zfcp_fc_req_cache);
 out_fc_cache:
@@ -175,7 +175,7 @@ static void __exit zfcp_module_exit(void)
 {
        ccw_driver_unregister(&zfcp_ccw_driver);
        misc_deregister(&zfcp_cfdc_misc);
-       fc_release_transport(zfcp_data.scsi_transport_template);
+       fc_release_transport(zfcp_scsi_transport_template);
        kmem_cache_destroy(zfcp_fc_req_cache);
        kmem_cache_destroy(zfcp_fsf_qtcb_cache);
 }
@@ -413,7 +413,7 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
        adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
        adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
 
-       if (!zfcp_adapter_scsi_register(adapter))
+       if (!zfcp_scsi_adapter_register(adapter))
                return adapter;
 
 failed:
@@ -430,7 +430,7 @@ void zfcp_adapter_unregister(struct zfcp_adapter *adapter)
        zfcp_destroy_adapter_work_queue(adapter);
 
        zfcp_fc_wka_ports_force_offline(adapter->gs);
-       zfcp_adapter_scsi_unregister(adapter);
+       zfcp_scsi_adapter_unregister(adapter);
        sysfs_remove_group(&cdev->dev.kobj, &zfcp_sysfs_adapter_attrs);
 
        zfcp_erp_thread_kill(adapter);
index 6a764337f06e98bcfb400184b6c18f82ab53df5e..1566208997b6d2a932e75249d1f044a69809a198 100644 (file)
@@ -313,10 +313,4 @@ struct zfcp_fsf_req {
        void                    (*handler)(struct zfcp_fsf_req *);
 };
 
-/* driver data */
-struct zfcp_data {
-       struct scsi_host_template scsi_host_template;
-       struct scsi_transport_template *scsi_transport_template;
-};
-
 #endif /* ZFCP_DEF_H */
index 58c7e57ed615b829d34b706a55caf6cb70de2053..410d9ddc175a786d269c309f1513a0c28ff2e7df 100644 (file)
@@ -141,9 +141,9 @@ extern struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *,
                                             struct qdio_buffer *);
 
 /* zfcp_scsi.c */
-extern struct zfcp_data zfcp_data;
-extern int zfcp_adapter_scsi_register(struct zfcp_adapter *);
-extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *);
+extern struct scsi_transport_template *zfcp_scsi_transport_template;
+extern int zfcp_scsi_adapter_register(struct zfcp_adapter *);
+extern void zfcp_scsi_adapter_unregister(struct zfcp_adapter *);
 extern struct fc_function_template zfcp_transport_functions;
 extern void zfcp_scsi_rport_work(struct work_struct *);
 extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *);
index ddb5800823a92895e63b4a6a4ee7942a5239317e..dbba0827127fc9e82cb3c168253fd5c15c73fccf 100644 (file)
@@ -292,7 +292,37 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
        return SUCCESS;
 }
 
-int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
+struct scsi_transport_template *zfcp_scsi_transport_template;
+
+static struct scsi_host_template zfcp_scsi_host_template = {
+       .module                  = THIS_MODULE,
+       .name                    = "zfcp",
+       .queuecommand            = zfcp_scsi_queuecommand,
+       .eh_abort_handler        = zfcp_scsi_eh_abort_handler,
+       .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
+       .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler,
+       .eh_host_reset_handler   = zfcp_scsi_eh_host_reset_handler,
+       .slave_alloc             = zfcp_scsi_slave_alloc,
+       .slave_configure         = zfcp_scsi_slave_configure,
+       .slave_destroy           = zfcp_scsi_slave_destroy,
+       .change_queue_depth      = zfcp_scsi_change_queue_depth,
+       .proc_name               = "zfcp",
+       .can_queue               = 4096,
+       .this_id                 = -1,
+       .sg_tablesize            = ZFCP_QDIO_MAX_SBALES_PER_REQ,
+       .max_sectors             = (ZFCP_QDIO_MAX_SBALES_PER_REQ * 8),
+       .dma_boundary            = ZFCP_QDIO_SBALE_LEN - 1,
+       .cmd_per_lun             = 1,
+       .use_clustering          = 1,
+       .shost_attrs             = zfcp_sysfs_shost_attrs,
+       .sdev_attrs              = zfcp_sysfs_sdev_attrs,
+};
+
+/**
+ * zfcp_scsi_adapter_register - Register SCSI and FC host with SCSI midlayer
+ * @adapter: The zfcp adapter to register with the SCSI midlayer
+ */
+int zfcp_scsi_adapter_register(struct zfcp_adapter *adapter)
 {
        struct ccw_dev_id dev_id;
 
@@ -301,7 +331,7 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
 
        ccw_device_get_id(adapter->ccw_device, &dev_id);
        /* register adapter as SCSI host with mid layer of SCSI stack */
-       adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
+       adapter->scsi_host = scsi_host_alloc(&zfcp_scsi_host_template,
                                             sizeof (struct zfcp_adapter *));
        if (!adapter->scsi_host) {
                dev_err(&adapter->ccw_device->dev,
@@ -316,7 +346,7 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
        adapter->scsi_host->max_channel = 0;
        adapter->scsi_host->unique_id = dev_id.devno;
        adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */
-       adapter->scsi_host->transportt = zfcp_data.scsi_transport_template;
+       adapter->scsi_host->transportt = zfcp_scsi_transport_template;
 
        adapter->scsi_host->hostdata[0] = (unsigned long) adapter;
 
@@ -328,7 +358,11 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
        return 0;
 }
 
-void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
+/**
+ * zfcp_scsi_adapter_unregister - Unregister SCSI and FC host from SCSI midlayer
+ * @adapter: The zfcp adapter to unregister.
+ */
+void zfcp_scsi_adapter_unregister(struct zfcp_adapter *adapter)
 {
        struct Scsi_Host *shost;
        struct zfcp_port *port;
@@ -346,8 +380,6 @@ void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
        scsi_remove_host(shost);
        scsi_host_put(shost);
        adapter->scsi_host = NULL;
-
-       return;
 }
 
 static struct fc_host_statistics*
@@ -692,29 +724,3 @@ struct fc_function_template zfcp_transport_functions = {
        .show_host_port_id = 1,
        .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els),
 };
-
-struct zfcp_data zfcp_data = {
-       .scsi_host_template = {
-               .name                    = "zfcp",
-               .module                  = THIS_MODULE,
-               .proc_name               = "zfcp",
-               .change_queue_depth      = zfcp_scsi_change_queue_depth,
-               .slave_alloc             = zfcp_scsi_slave_alloc,
-               .slave_configure         = zfcp_scsi_slave_configure,
-               .slave_destroy           = zfcp_scsi_slave_destroy,
-               .queuecommand            = zfcp_scsi_queuecommand,
-               .eh_abort_handler        = zfcp_scsi_eh_abort_handler,
-               .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
-               .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler,
-               .eh_host_reset_handler   = zfcp_scsi_eh_host_reset_handler,
-               .can_queue               = 4096,
-               .this_id                 = -1,
-               .sg_tablesize            = ZFCP_QDIO_MAX_SBALES_PER_REQ,
-               .cmd_per_lun             = 1,
-               .use_clustering          = 1,
-               .sdev_attrs              = zfcp_sysfs_sdev_attrs,
-               .max_sectors             = (ZFCP_QDIO_MAX_SBALES_PER_REQ * 8),
-               .dma_boundary            = ZFCP_QDIO_SBALE_LEN - 1,
-               .shost_attrs             = zfcp_sysfs_shost_attrs,
-       },
-};