~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/s390/scsi/zfcp_aux.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
{
123
123
        int retval = -ENOMEM;
124
124
 
125
 
        zfcp_data.gpn_ft_cache = zfcp_cache_hw_align("zfcp_gpn",
126
 
                                        sizeof(struct zfcp_fc_gpn_ft_req));
127
 
        if (!zfcp_data.gpn_ft_cache)
128
 
                goto out;
129
 
 
130
 
        zfcp_data.qtcb_cache = zfcp_cache_hw_align("zfcp_qtcb",
131
 
                                        sizeof(struct fsf_qtcb));
132
 
        if (!zfcp_data.qtcb_cache)
 
125
        zfcp_fsf_qtcb_cache = zfcp_cache_hw_align("zfcp_fsf_qtcb",
 
126
                                                  sizeof(struct fsf_qtcb));
 
127
        if (!zfcp_fsf_qtcb_cache)
133
128
                goto out_qtcb_cache;
134
129
 
135
 
        zfcp_data.sr_buffer_cache = zfcp_cache_hw_align("zfcp_sr",
136
 
                                        sizeof(struct fsf_status_read_buffer));
137
 
        if (!zfcp_data.sr_buffer_cache)
138
 
                goto out_sr_cache;
139
 
 
140
 
        zfcp_data.gid_pn_cache = zfcp_cache_hw_align("zfcp_gid",
141
 
                                        sizeof(struct zfcp_fc_gid_pn));
142
 
        if (!zfcp_data.gid_pn_cache)
143
 
                goto out_gid_cache;
144
 
 
145
 
        zfcp_data.adisc_cache = zfcp_cache_hw_align("zfcp_adisc",
146
 
                                        sizeof(struct zfcp_fc_els_adisc));
147
 
        if (!zfcp_data.adisc_cache)
148
 
                goto out_adisc_cache;
149
 
 
150
 
        zfcp_data.scsi_transport_template =
 
130
        zfcp_fc_req_cache = zfcp_cache_hw_align("zfcp_fc_req",
 
131
                                                sizeof(struct zfcp_fc_req));
 
132
        if (!zfcp_fc_req_cache)
 
133
                goto out_fc_cache;
 
134
 
 
135
        zfcp_scsi_transport_template =
151
136
                fc_attach_transport(&zfcp_transport_functions);
152
 
        if (!zfcp_data.scsi_transport_template)
 
137
        if (!zfcp_scsi_transport_template)
153
138
                goto out_transport;
154
 
        scsi_transport_reserve_device(zfcp_data.scsi_transport_template,
 
139
        scsi_transport_reserve_device(zfcp_scsi_transport_template,
155
140
                                      sizeof(struct zfcp_scsi_dev));
156
141
 
157
142
 
175
160
out_ccw_register:
176
161
        misc_deregister(&zfcp_cfdc_misc);
177
162
out_misc:
178
 
        fc_release_transport(zfcp_data.scsi_transport_template);
 
163
        fc_release_transport(zfcp_scsi_transport_template);
179
164
out_transport:
180
 
        kmem_cache_destroy(zfcp_data.adisc_cache);
181
 
out_adisc_cache:
182
 
        kmem_cache_destroy(zfcp_data.gid_pn_cache);
183
 
out_gid_cache:
184
 
        kmem_cache_destroy(zfcp_data.sr_buffer_cache);
185
 
out_sr_cache:
186
 
        kmem_cache_destroy(zfcp_data.qtcb_cache);
 
165
        kmem_cache_destroy(zfcp_fc_req_cache);
 
166
out_fc_cache:
 
167
        kmem_cache_destroy(zfcp_fsf_qtcb_cache);
187
168
out_qtcb_cache:
188
 
        kmem_cache_destroy(zfcp_data.gpn_ft_cache);
189
 
out:
190
169
        return retval;
191
170
}
192
171
 
196
175
{
197
176
        ccw_driver_unregister(&zfcp_ccw_driver);
198
177
        misc_deregister(&zfcp_cfdc_misc);
199
 
        fc_release_transport(zfcp_data.scsi_transport_template);
200
 
        kmem_cache_destroy(zfcp_data.adisc_cache);
201
 
        kmem_cache_destroy(zfcp_data.gid_pn_cache);
202
 
        kmem_cache_destroy(zfcp_data.sr_buffer_cache);
203
 
        kmem_cache_destroy(zfcp_data.qtcb_cache);
204
 
        kmem_cache_destroy(zfcp_data.gpn_ft_cache);
 
178
        fc_release_transport(zfcp_scsi_transport_template);
 
179
        kmem_cache_destroy(zfcp_fc_req_cache);
 
180
        kmem_cache_destroy(zfcp_fsf_qtcb_cache);
205
181
}
206
182
 
207
183
module_exit(zfcp_module_exit);
260
236
                return -ENOMEM;
261
237
 
262
238
        adapter->pool.qtcb_pool =
263
 
                mempool_create_slab_pool(4, zfcp_data.qtcb_cache);
 
239
                mempool_create_slab_pool(4, zfcp_fsf_qtcb_cache);
264
240
        if (!adapter->pool.qtcb_pool)
265
241
                return -ENOMEM;
266
242
 
267
 
        adapter->pool.status_read_data =
268
 
                mempool_create_slab_pool(FSF_STATUS_READS_RECOM,
269
 
                                         zfcp_data.sr_buffer_cache);
270
 
        if (!adapter->pool.status_read_data)
 
243
        BUILD_BUG_ON(sizeof(struct fsf_status_read_buffer) > PAGE_SIZE);
 
244
        adapter->pool.sr_data =
 
245
                mempool_create_page_pool(FSF_STATUS_READS_RECOM, 0);
 
246
        if (!adapter->pool.sr_data)
271
247
                return -ENOMEM;
272
248
 
273
249
        adapter->pool.gid_pn =
274
 
                mempool_create_slab_pool(1, zfcp_data.gid_pn_cache);
 
250
                mempool_create_slab_pool(1, zfcp_fc_req_cache);
275
251
        if (!adapter->pool.gid_pn)
276
252
                return -ENOMEM;
277
253
 
290
266
                mempool_destroy(adapter->pool.qtcb_pool);
291
267
        if (adapter->pool.status_read_req)
292
268
                mempool_destroy(adapter->pool.status_read_req);
293
 
        if (adapter->pool.status_read_data)
294
 
                mempool_destroy(adapter->pool.status_read_data);
 
269
        if (adapter->pool.sr_data)
 
270
                mempool_destroy(adapter->pool.sr_data);
295
271
        if (adapter->pool.gid_pn)
296
272
                mempool_destroy(adapter->pool.gid_pn);
297
273
}
386
362
 
387
363
        INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler);
388
364
        INIT_WORK(&adapter->scan_work, zfcp_fc_scan_ports);
 
365
        INIT_WORK(&adapter->ns_up_work, zfcp_fc_sym_name_update);
389
366
 
390
367
        if (zfcp_qdio_setup(adapter))
391
368
                goto failed;
437
414
        adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
438
415
        adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
439
416
 
440
 
        if (!zfcp_adapter_scsi_register(adapter))
 
417
        if (!zfcp_scsi_adapter_register(adapter))
441
418
                return adapter;
442
419
 
443
420
failed:
451
428
 
452
429
        cancel_work_sync(&adapter->scan_work);
453
430
        cancel_work_sync(&adapter->stat_work);
 
431
        cancel_work_sync(&adapter->ns_up_work);
454
432
        zfcp_destroy_adapter_work_queue(adapter);
455
433
 
456
434
        zfcp_fc_wka_ports_force_offline(adapter->gs);
457
 
        zfcp_adapter_scsi_unregister(adapter);
 
435
        zfcp_scsi_adapter_unregister(adapter);
458
436
        sysfs_remove_group(&cdev->dev.kobj, &zfcp_sysfs_adapter_attrs);
459
437
 
460
438
        zfcp_erp_thread_kill(adapter);