diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2008-06-10 12:20:56 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-12 09:22:25 -0400 |
commit | fa04c2816883a49ec518514f6c19767d54be20b5 (patch) | |
tree | e64882a036edda01ea65b0d0b1195271dddf3a47 /drivers/s390/scsi/zfcp_ccw.c | |
parent | 45633fdc9615f9fd2a0ae18e301562298b15abf3 (diff) |
[SCSI] zfcp: Cleanup code in zfcp_ccw
Overall cleanup in file zfcp_ccw.c. Fix coding style issues, remove
useless macros and messages and convert remaining messages to standard
macros.
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_ccw.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_ccw.c | 150 |
1 files changed, 50 insertions, 100 deletions
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index 66d3b88844b0..da472e865e58 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c | |||
@@ -1,64 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * This file is part of the zfcp device driver for | 2 | * zfcp device driver |
3 | * FCP adapters for IBM System z9 and zSeries. | ||
4 | * | 3 | * |
5 | * (C) Copyright IBM Corp. 2002, 2006 | 4 | * Registration and callback for the s390 common I/O layer. |
6 | * | 5 | * |
7 | * This program is free software; you can redistribute it and/or modify | 6 | * Copyright IBM Corporation 2002, 2008 |
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2, or (at your option) | ||
10 | * any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | 7 | */ |
21 | 8 | ||
22 | #include "zfcp_ext.h" | 9 | #include "zfcp_ext.h" |
23 | 10 | ||
24 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG | ||
25 | |||
26 | static int zfcp_ccw_probe(struct ccw_device *); | ||
27 | static void zfcp_ccw_remove(struct ccw_device *); | ||
28 | static int zfcp_ccw_set_online(struct ccw_device *); | ||
29 | static int zfcp_ccw_set_offline(struct ccw_device *); | ||
30 | static int zfcp_ccw_notify(struct ccw_device *, int); | ||
31 | static void zfcp_ccw_shutdown(struct ccw_device *); | ||
32 | |||
33 | static struct ccw_device_id zfcp_ccw_device_id[] = { | ||
34 | {CCW_DEVICE_DEVTYPE(ZFCP_CONTROL_UNIT_TYPE, | ||
35 | ZFCP_CONTROL_UNIT_MODEL, | ||
36 | ZFCP_DEVICE_TYPE, | ||
37 | ZFCP_DEVICE_MODEL)}, | ||
38 | {CCW_DEVICE_DEVTYPE(ZFCP_CONTROL_UNIT_TYPE, | ||
39 | ZFCP_CONTROL_UNIT_MODEL, | ||
40 | ZFCP_DEVICE_TYPE, | ||
41 | ZFCP_DEVICE_MODEL_PRIV)}, | ||
42 | {}, | ||
43 | }; | ||
44 | |||
45 | static struct ccw_driver zfcp_ccw_driver = { | ||
46 | .owner = THIS_MODULE, | ||
47 | .name = ZFCP_NAME, | ||
48 | .ids = zfcp_ccw_device_id, | ||
49 | .probe = zfcp_ccw_probe, | ||
50 | .remove = zfcp_ccw_remove, | ||
51 | .set_online = zfcp_ccw_set_online, | ||
52 | .set_offline = zfcp_ccw_set_offline, | ||
53 | .notify = zfcp_ccw_notify, | ||
54 | .shutdown = zfcp_ccw_shutdown, | ||
55 | .driver = { | ||
56 | .groups = zfcp_driver_attr_groups, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | MODULE_DEVICE_TABLE(ccw, zfcp_ccw_device_id); | ||
61 | |||
62 | /** | 11 | /** |
63 | * zfcp_ccw_probe - probe function of zfcp driver | 12 | * zfcp_ccw_probe - probe function of zfcp driver |
64 | * @ccw_device: pointer to belonging ccw device | 13 | * @ccw_device: pointer to belonging ccw device |
@@ -69,19 +18,18 @@ MODULE_DEVICE_TABLE(ccw, zfcp_ccw_device_id); | |||
69 | * In addition the nameserver port will be added to the ports of the adapter | 18 | * In addition the nameserver port will be added to the ports of the adapter |
70 | * and its sysfs representation will be created too. | 19 | * and its sysfs representation will be created too. |
71 | */ | 20 | */ |
72 | static int | 21 | static int zfcp_ccw_probe(struct ccw_device *ccw_device) |
73 | zfcp_ccw_probe(struct ccw_device *ccw_device) | ||
74 | { | 22 | { |
75 | struct zfcp_adapter *adapter; | 23 | struct zfcp_adapter *adapter; |
76 | int retval = 0; | 24 | int retval = 0; |
77 | 25 | ||
78 | down(&zfcp_data.config_sema); | 26 | down(&zfcp_data.config_sema); |
79 | adapter = zfcp_adapter_enqueue(ccw_device); | 27 | adapter = zfcp_adapter_enqueue(ccw_device); |
80 | if (!adapter) | 28 | if (!adapter) { |
29 | dev_err(&ccw_device->dev, | ||
30 | "Setup of data structures failed.\n"); | ||
81 | retval = -EINVAL; | 31 | retval = -EINVAL; |
82 | else | 32 | } |
83 | ZFCP_LOG_DEBUG("Probed adapter %s\n", | ||
84 | zfcp_get_busid_by_adapter(adapter)); | ||
85 | up(&zfcp_data.config_sema); | 33 | up(&zfcp_data.config_sema); |
86 | return retval; | 34 | return retval; |
87 | } | 35 | } |
@@ -95,8 +43,7 @@ zfcp_ccw_probe(struct ccw_device *ccw_device) | |||
95 | * ports that belong to this adapter. And in addition all resources of this | 43 | * ports that belong to this adapter. And in addition all resources of this |
96 | * adapter will be freed too. | 44 | * adapter will be freed too. |
97 | */ | 45 | */ |
98 | static void | 46 | static void zfcp_ccw_remove(struct ccw_device *ccw_device) |
99 | zfcp_ccw_remove(struct ccw_device *ccw_device) | ||
100 | { | 47 | { |
101 | struct zfcp_adapter *adapter; | 48 | struct zfcp_adapter *adapter; |
102 | struct zfcp_port *port, *p; | 49 | struct zfcp_port *port, *p; |
@@ -106,8 +53,6 @@ zfcp_ccw_remove(struct ccw_device *ccw_device) | |||
106 | down(&zfcp_data.config_sema); | 53 | down(&zfcp_data.config_sema); |
107 | adapter = dev_get_drvdata(&ccw_device->dev); | 54 | adapter = dev_get_drvdata(&ccw_device->dev); |
108 | 55 | ||
109 | ZFCP_LOG_DEBUG("Removing adapter %s\n", | ||
110 | zfcp_get_busid_by_adapter(adapter)); | ||
111 | write_lock_irq(&zfcp_data.config_lock); | 56 | write_lock_irq(&zfcp_data.config_lock); |
112 | list_for_each_entry_safe(port, p, &adapter->port_list_head, list) { | 57 | list_for_each_entry_safe(port, p, &adapter->port_list_head, list) { |
113 | list_for_each_entry_safe(unit, u, &port->unit_list_head, list) { | 58 | list_for_each_entry_safe(unit, u, &port->unit_list_head, list) { |
@@ -145,8 +90,7 @@ zfcp_ccw_remove(struct ccw_device *ccw_device) | |||
145 | * registered with the SCSI stack, that the QDIO queues will be set up | 90 | * registered with the SCSI stack, that the QDIO queues will be set up |
146 | * and that the adapter will be opened (asynchronously). | 91 | * and that the adapter will be opened (asynchronously). |
147 | */ | 92 | */ |
148 | static int | 93 | static int zfcp_ccw_set_online(struct ccw_device *ccw_device) |
149 | zfcp_ccw_set_online(struct ccw_device *ccw_device) | ||
150 | { | 94 | { |
151 | struct zfcp_adapter *adapter; | 95 | struct zfcp_adapter *adapter; |
152 | int retval; | 96 | int retval; |
@@ -155,12 +99,8 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device) | |||
155 | adapter = dev_get_drvdata(&ccw_device->dev); | 99 | adapter = dev_get_drvdata(&ccw_device->dev); |
156 | 100 | ||
157 | retval = zfcp_erp_thread_setup(adapter); | 101 | retval = zfcp_erp_thread_setup(adapter); |
158 | if (retval) { | 102 | if (retval) |
159 | ZFCP_LOG_INFO("error: start of error recovery thread for " | ||
160 | "adapter %s failed\n", | ||
161 | zfcp_get_busid_by_adapter(adapter)); | ||
162 | goto out; | 103 | goto out; |
163 | } | ||
164 | 104 | ||
165 | retval = zfcp_adapter_scsi_register(adapter); | 105 | retval = zfcp_adapter_scsi_register(adapter); |
166 | if (retval) | 106 | if (retval) |
@@ -191,8 +131,7 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device) | |||
191 | * This function gets called by the common i/o layer and sets an adapter | 131 | * This function gets called by the common i/o layer and sets an adapter |
192 | * into state offline. | 132 | * into state offline. |
193 | */ | 133 | */ |
194 | static int | 134 | static int zfcp_ccw_set_offline(struct ccw_device *ccw_device) |
195 | zfcp_ccw_set_offline(struct ccw_device *ccw_device) | ||
196 | { | 135 | { |
197 | struct zfcp_adapter *adapter; | 136 | struct zfcp_adapter *adapter; |
198 | 137 | ||
@@ -206,15 +145,14 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device) | |||
206 | } | 145 | } |
207 | 146 | ||
208 | /** | 147 | /** |
209 | * zfcp_ccw_notify | 148 | * zfcp_ccw_notify - ccw notify function |
210 | * @ccw_device: pointer to belonging ccw device | 149 | * @ccw_device: pointer to belonging ccw device |
211 | * @event: indicates if adapter was detached or attached | 150 | * @event: indicates if adapter was detached or attached |
212 | * | 151 | * |
213 | * This function gets called by the common i/o layer if an adapter has gone | 152 | * This function gets called by the common i/o layer if an adapter has gone |
214 | * or reappeared. | 153 | * or reappeared. |
215 | */ | 154 | */ |
216 | static int | 155 | static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) |
217 | zfcp_ccw_notify(struct ccw_device *ccw_device, int event) | ||
218 | { | 156 | { |
219 | struct zfcp_adapter *adapter; | 157 | struct zfcp_adapter *adapter; |
220 | 158 | ||
@@ -222,18 +160,15 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event) | |||
222 | adapter = dev_get_drvdata(&ccw_device->dev); | 160 | adapter = dev_get_drvdata(&ccw_device->dev); |
223 | switch (event) { | 161 | switch (event) { |
224 | case CIO_GONE: | 162 | case CIO_GONE: |
225 | ZFCP_LOG_NORMAL("adapter %s: device gone\n", | 163 | dev_warn(&adapter->ccw_device->dev, "device gone\n"); |
226 | zfcp_get_busid_by_adapter(adapter)); | ||
227 | zfcp_erp_adapter_shutdown(adapter, 0, 87, NULL); | 164 | zfcp_erp_adapter_shutdown(adapter, 0, 87, NULL); |
228 | break; | 165 | break; |
229 | case CIO_NO_PATH: | 166 | case CIO_NO_PATH: |
230 | ZFCP_LOG_NORMAL("adapter %s: no path\n", | 167 | dev_warn(&adapter->ccw_device->dev, "no path\n"); |
231 | zfcp_get_busid_by_adapter(adapter)); | ||
232 | zfcp_erp_adapter_shutdown(adapter, 0, 88, NULL); | 168 | zfcp_erp_adapter_shutdown(adapter, 0, 88, NULL); |
233 | break; | 169 | break; |
234 | case CIO_OPER: | 170 | case CIO_OPER: |
235 | ZFCP_LOG_NORMAL("adapter %s: operational again\n", | 171 | dev_info(&adapter->ccw_device->dev, "operational again\n"); |
236 | zfcp_get_busid_by_adapter(adapter)); | ||
237 | zfcp_erp_modify_adapter_status(adapter, 11, NULL, | 172 | zfcp_erp_modify_adapter_status(adapter, 11, NULL, |
238 | ZFCP_STATUS_COMMON_RUNNING, | 173 | ZFCP_STATUS_COMMON_RUNNING, |
239 | ZFCP_SET); | 174 | ZFCP_SET); |
@@ -247,24 +182,10 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event) | |||
247 | } | 182 | } |
248 | 183 | ||
249 | /** | 184 | /** |
250 | * zfcp_ccw_register - ccw register function | 185 | * zfcp_ccw_shutdown - handle shutdown from cio |
251 | * | 186 | * @cdev: device for adapter to shutdown. |
252 | * Registers the driver at the common i/o layer. This function will be called | ||
253 | * at module load time/system start. | ||
254 | */ | 187 | */ |
255 | int __init | 188 | static void zfcp_ccw_shutdown(struct ccw_device *cdev) |
256 | zfcp_ccw_register(void) | ||
257 | { | ||
258 | return ccw_driver_register(&zfcp_ccw_driver); | ||
259 | } | ||
260 | |||
261 | /** | ||
262 | * zfcp_ccw_shutdown - gets called on reboot/shutdown | ||
263 | * | ||
264 | * Makes sure that QDIO queues are down when the system gets stopped. | ||
265 | */ | ||
266 | static void | ||
267 | zfcp_ccw_shutdown(struct ccw_device *cdev) | ||
268 | { | 189 | { |
269 | struct zfcp_adapter *adapter; | 190 | struct zfcp_adapter *adapter; |
270 | 191 | ||
@@ -275,4 +196,33 @@ zfcp_ccw_shutdown(struct ccw_device *cdev) | |||
275 | up(&zfcp_data.config_sema); | 196 | up(&zfcp_data.config_sema); |
276 | } | 197 | } |
277 | 198 | ||
278 | #undef ZFCP_LOG_AREA | 199 | static struct ccw_device_id zfcp_ccw_device_id[] = { |
200 | { CCW_DEVICE_DEVTYPE(0x1731, 0x3, 0x1732, 0x3) }, | ||
201 | { CCW_DEVICE_DEVTYPE(0x1731, 0x3, 0x1732, 0x4) }, /* priv. */ | ||
202 | {}, | ||
203 | }; | ||
204 | |||
205 | MODULE_DEVICE_TABLE(ccw, zfcp_ccw_device_id); | ||
206 | |||
207 | static struct ccw_driver zfcp_ccw_driver = { | ||
208 | .owner = THIS_MODULE, | ||
209 | .name = "zfcp", | ||
210 | .ids = zfcp_ccw_device_id, | ||
211 | .probe = zfcp_ccw_probe, | ||
212 | .remove = zfcp_ccw_remove, | ||
213 | .set_online = zfcp_ccw_set_online, | ||
214 | .set_offline = zfcp_ccw_set_offline, | ||
215 | .notify = zfcp_ccw_notify, | ||
216 | .shutdown = zfcp_ccw_shutdown, | ||
217 | }; | ||
218 | |||
219 | /** | ||
220 | * zfcp_ccw_register - ccw register function | ||
221 | * | ||
222 | * Registers the driver at the common i/o layer. This function will be called | ||
223 | * at module load time/system start. | ||
224 | */ | ||
225 | int __init zfcp_ccw_register(void) | ||
226 | { | ||
227 | return ccw_driver_register(&zfcp_ccw_driver); | ||
228 | } | ||