static int __init zfcp_module_init(void) { int retval = -ENOMEM; zfcp_data.fsf_req_qtcb_cache = zfcp_cache_create( sizeof(struct zfcp_fsf_req_qtcb), "zfcp_fsf"); if (!zfcp_data.fsf_req_qtcb_cache) goto out; zfcp_data.sr_buffer_cache = zfcp_cache_create( sizeof(struct fsf_status_read_buffer), "zfcp_sr"); if (!zfcp_data.sr_buffer_cache) goto out_sr_cache; zfcp_data.gid_pn_cache = zfcp_cache_create( sizeof(struct zfcp_gid_pn_data), "zfcp_gid"); if (!zfcp_data.gid_pn_cache) goto out_gid_cache; zfcp_data.work_queue = create_singlethread_workqueue("zfcp_wq"); sema_init(&zfcp_data.config_sema, 1); rwlock_init(&zfcp_data.config_lock); zfcp_data.scsi_transport_template = fc_attach_transport(&zfcp_transport_functions); if (!zfcp_data.scsi_transport_template) goto out_transport; retval = misc_register(&zfcp_cfdc_misc); if (retval) { pr_err("Registering the misc device zfcp_cfdc failed\n"); goto out_misc; } retval = zfcp_ccw_register(); if (retval) { pr_err("The zfcp device driver could not register with " "the common I/O layer\n"); goto out_ccw_register; } if (init_device) zfcp_init_device_setup(init_device); return 0; out_ccw_register: misc_deregister(&zfcp_cfdc_misc); out_misc: fc_release_transport(zfcp_data.scsi_transport_template); out_transport: kmem_cache_destroy(zfcp_data.gid_pn_cache); out_gid_cache: kmem_cache_destroy(zfcp_data.sr_buffer_cache); out_sr_cache: kmem_cache_destroy(zfcp_data.fsf_req_qtcb_cache); out: return retval; }
static int __init zfcp_module_init(void) { int retval = -ENOMEM; zfcp_fsf_qtcb_cache = zfcp_cache_hw_align("zfcp_fsf_qtcb", sizeof(struct fsf_qtcb)); if (!zfcp_fsf_qtcb_cache) goto out_qtcb_cache; zfcp_fc_req_cache = zfcp_cache_hw_align("zfcp_fc_req", sizeof(struct zfcp_fc_req)); if (!zfcp_fc_req_cache) goto out_fc_cache; zfcp_scsi_transport_template = fc_attach_transport(&zfcp_transport_functions); if (!zfcp_scsi_transport_template) goto out_transport; scsi_transport_reserve_device(zfcp_scsi_transport_template, sizeof(struct zfcp_scsi_dev)); retval = misc_register(&zfcp_cfdc_misc); if (retval) { pr_err("Registering the misc device zfcp_cfdc failed\n"); goto out_misc; } retval = ccw_driver_register(&zfcp_ccw_driver); if (retval) { pr_err("The zfcp device driver could not register with " "the common I/O layer\n"); goto out_ccw_register; } if (init_device) zfcp_init_device_setup(init_device); return 0; out_ccw_register: misc_deregister(&zfcp_cfdc_misc); out_misc: fc_release_transport(zfcp_scsi_transport_template); out_transport: kmem_cache_destroy(zfcp_fc_req_cache); out_fc_cache: kmem_cache_destroy(zfcp_fsf_qtcb_cache); out_qtcb_cache: return retval; }
static int __init zfcp_module_init(void) { int retval = -ENOMEM; zfcp_data.gpn_ft_cache = zfcp_cache_hw_align("zfcp_gpn", sizeof(struct ct_iu_gpn_ft_req)); if (!zfcp_data.gpn_ft_cache) goto out; zfcp_data.qtcb_cache = zfcp_cache_hw_align("zfcp_qtcb", sizeof(struct fsf_qtcb)); if (!zfcp_data.qtcb_cache) goto out_qtcb_cache; zfcp_data.sr_buffer_cache = zfcp_cache_hw_align("zfcp_sr", sizeof(struct fsf_status_read_buffer)); if (!zfcp_data.sr_buffer_cache) goto out_sr_cache; zfcp_data.gid_pn_cache = zfcp_cache_hw_align("zfcp_gid", sizeof(struct zfcp_gid_pn_data)); if (!zfcp_data.gid_pn_cache) goto out_gid_cache; mutex_init(&zfcp_data.config_mutex); rwlock_init(&zfcp_data.config_lock); zfcp_data.scsi_transport_template = fc_attach_transport(&zfcp_transport_functions); if (!zfcp_data.scsi_transport_template) goto out_transport; retval = misc_register(&zfcp_cfdc_misc); if (retval) { pr_err("Registering the misc device zfcp_cfdc failed\n"); goto out_misc; } retval = zfcp_ccw_register(); if (retval) { pr_err("The zfcp device driver could not register with " "the common I/O layer\n"); goto out_ccw_register; } if (init_device) zfcp_init_device_setup(init_device); return 0; out_ccw_register: misc_deregister(&zfcp_cfdc_misc); out_misc: fc_release_transport(zfcp_data.scsi_transport_template); out_transport: kmem_cache_destroy(zfcp_data.gid_pn_cache); out_gid_cache: kmem_cache_destroy(zfcp_data.sr_buffer_cache); out_sr_cache: kmem_cache_destroy(zfcp_data.qtcb_cache); out_qtcb_cache: kmem_cache_destroy(zfcp_data.gpn_ft_cache); out: return retval; }