diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2009-09-24 04:23:22 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-10-02 10:49:47 -0400 |
commit | c5afd81e5d7ebacc9dd23954e169ac79a34fe399 (patch) | |
tree | 91de28df6297b9823d6eb10533b7728a4b48e6ba /drivers/s390/scsi | |
parent | b1a58985853574346f1518531bdd82069501b317 (diff) |
[SCSI] zfcp: Fix initial device and cfdc for delayed adapter allocation
With the change for delaying the allocation of zfcp_adapter, the
initial device parameter function has to first call
ccw_device_set_online which allocates the zfcp_adapter structure.
Change this and adapt the cfdc part accordingly.
Reviewed-by: Felix Beck <felix.beck@de.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/scsi')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 31 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ccw.c | 19 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_cfdc.c | 17 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 2 |
4 files changed, 38 insertions, 31 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 1be6bf7e8ce..351d2e711ec 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -80,28 +80,35 @@ int zfcp_reqlist_isempty(struct zfcp_adapter *adapter) | |||
80 | 80 | ||
81 | static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun) | 81 | static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun) |
82 | { | 82 | { |
83 | struct ccw_device *ccwdev; | ||
83 | struct zfcp_adapter *adapter; | 84 | struct zfcp_adapter *adapter; |
84 | struct zfcp_port *port; | 85 | struct zfcp_port *port; |
85 | struct zfcp_unit *unit; | 86 | struct zfcp_unit *unit; |
86 | 87 | ||
87 | mutex_lock(&zfcp_data.config_mutex); | 88 | ccwdev = get_ccwdev_by_busid(&zfcp_ccw_driver, busid); |
88 | read_lock_irq(&zfcp_data.config_lock); | 89 | if (!ccwdev) |
89 | adapter = zfcp_get_adapter_by_busid(busid); | 90 | return; |
90 | if (adapter) | 91 | |
91 | zfcp_adapter_get(adapter); | 92 | if (ccw_device_set_online(ccwdev)) |
92 | read_unlock_irq(&zfcp_data.config_lock); | 93 | goto out_ccwdev; |
93 | 94 | ||
95 | mutex_lock(&zfcp_data.config_mutex); | ||
96 | adapter = dev_get_drvdata(&ccwdev->dev); | ||
94 | if (!adapter) | 97 | if (!adapter) |
95 | goto out_adapter; | 98 | goto out_unlock; |
96 | port = zfcp_port_enqueue(adapter, wwpn, 0, 0); | 99 | zfcp_adapter_get(adapter); |
97 | if (IS_ERR(port)) | 100 | |
101 | port = zfcp_get_port_by_wwpn(adapter, wwpn); | ||
102 | if (!port) | ||
98 | goto out_port; | 103 | goto out_port; |
104 | |||
105 | zfcp_port_get(port); | ||
99 | unit = zfcp_unit_enqueue(port, lun); | 106 | unit = zfcp_unit_enqueue(port, lun); |
100 | if (IS_ERR(unit)) | 107 | if (IS_ERR(unit)) |
101 | goto out_unit; | 108 | goto out_unit; |
102 | mutex_unlock(&zfcp_data.config_mutex); | 109 | mutex_unlock(&zfcp_data.config_mutex); |
103 | ccw_device_set_online(adapter->ccw_device); | ||
104 | 110 | ||
111 | zfcp_erp_unit_reopen(unit, 0, "auidc_1", NULL); | ||
105 | zfcp_erp_wait(adapter); | 112 | zfcp_erp_wait(adapter); |
106 | flush_work(&unit->scsi_work); | 113 | flush_work(&unit->scsi_work); |
107 | 114 | ||
@@ -111,8 +118,10 @@ out_unit: | |||
111 | zfcp_port_put(port); | 118 | zfcp_port_put(port); |
112 | out_port: | 119 | out_port: |
113 | zfcp_adapter_put(adapter); | 120 | zfcp_adapter_put(adapter); |
114 | out_adapter: | 121 | out_unlock: |
115 | mutex_unlock(&zfcp_data.config_mutex); | 122 | mutex_unlock(&zfcp_data.config_mutex); |
123 | out_ccwdev: | ||
124 | put_device(&ccwdev->dev); | ||
116 | return; | 125 | return; |
117 | } | 126 | } |
118 | 127 | ||
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index 0c90f8e7160..ef5282dcdbb 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c | |||
@@ -259,7 +259,7 @@ static void zfcp_ccw_shutdown(struct ccw_device *cdev) | |||
259 | mutex_unlock(&zfcp_data.config_mutex); | 259 | mutex_unlock(&zfcp_data.config_mutex); |
260 | } | 260 | } |
261 | 261 | ||
262 | static struct ccw_driver zfcp_ccw_driver = { | 262 | struct ccw_driver zfcp_ccw_driver = { |
263 | .owner = THIS_MODULE, | 263 | .owner = THIS_MODULE, |
264 | .name = "zfcp", | 264 | .name = "zfcp", |
265 | .ids = zfcp_ccw_device_id, | 265 | .ids = zfcp_ccw_device_id, |
@@ -284,20 +284,3 @@ int __init zfcp_ccw_register(void) | |||
284 | { | 284 | { |
285 | return ccw_driver_register(&zfcp_ccw_driver); | 285 | return ccw_driver_register(&zfcp_ccw_driver); |
286 | } | 286 | } |
287 | |||
288 | /** | ||
289 | * zfcp_get_adapter_by_busid - find zfcp_adapter struct | ||
290 | * @busid: bus id string of zfcp adapter to find | ||
291 | */ | ||
292 | struct zfcp_adapter *zfcp_get_adapter_by_busid(char *busid) | ||
293 | { | ||
294 | struct ccw_device *ccw_device; | ||
295 | struct zfcp_adapter *adapter = NULL; | ||
296 | |||
297 | ccw_device = get_ccwdev_by_busid(&zfcp_ccw_driver, busid); | ||
298 | if (ccw_device) { | ||
299 | adapter = dev_get_drvdata(&ccw_device->dev); | ||
300 | put_device(&ccw_device->dev); | ||
301 | } | ||
302 | return adapter; | ||
303 | } | ||
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c index 8305c874e86..ef681dfed0c 100644 --- a/drivers/s390/scsi/zfcp_cfdc.c +++ b/drivers/s390/scsi/zfcp_cfdc.c | |||
@@ -86,8 +86,23 @@ static int zfcp_cfdc_copy_to_user(void __user *user_buffer, | |||
86 | static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno) | 86 | static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno) |
87 | { | 87 | { |
88 | char busid[9]; | 88 | char busid[9]; |
89 | struct ccw_device *ccwdev; | ||
90 | struct zfcp_adapter *adapter = NULL; | ||
91 | |||
89 | snprintf(busid, sizeof(busid), "0.0.%04x", devno); | 92 | snprintf(busid, sizeof(busid), "0.0.%04x", devno); |
90 | return zfcp_get_adapter_by_busid(busid); | 93 | ccwdev = get_ccwdev_by_busid(&zfcp_ccw_driver, busid); |
94 | if (!ccwdev) | ||
95 | goto out; | ||
96 | |||
97 | adapter = dev_get_drvdata(&ccwdev->dev); | ||
98 | if (!adapter) | ||
99 | goto out_put; | ||
100 | |||
101 | zfcp_adapter_get(adapter); | ||
102 | out_put: | ||
103 | put_device(&ccwdev->dev); | ||
104 | out: | ||
105 | return adapter; | ||
91 | } | 106 | } |
92 | 107 | ||
93 | static int zfcp_cfdc_set_fsf(struct zfcp_fsf_cfdc *fsf_cfdc, int command) | 108 | static int zfcp_cfdc_set_fsf(struct zfcp_fsf_cfdc *fsf_cfdc, int command) |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 36935bc0818..629edec7040 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -28,7 +28,7 @@ extern int zfcp_sg_setup_table(struct scatterlist *, int); | |||
28 | /* zfcp_ccw.c */ | 28 | /* zfcp_ccw.c */ |
29 | extern int zfcp_ccw_register(void); | 29 | extern int zfcp_ccw_register(void); |
30 | extern int zfcp_ccw_priv_sch(struct zfcp_adapter *); | 30 | extern int zfcp_ccw_priv_sch(struct zfcp_adapter *); |
31 | extern struct zfcp_adapter *zfcp_get_adapter_by_busid(char *); | 31 | extern struct ccw_driver zfcp_ccw_driver; |
32 | 32 | ||
33 | /* zfcp_cfdc.c */ | 33 | /* zfcp_cfdc.c */ |
34 | extern struct miscdevice zfcp_cfdc_misc; | 34 | extern struct miscdevice zfcp_cfdc_misc; |