]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.drivers/mpt-fusion-4.16.00.00-update
Add a patch to fix Intel E100 wake-on-lan problems.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / mpt-fusion-4.16.00.00-update
1 Subject: MPT fusion driver update to 4.16.00.00
2 From: Satya Prakash <sathya.prakash@lsi.com>
3 Date: Thu Nov 20 14:13:01 2008 +0100:
4 References: bnc#425660
5
6 Update the mpt fusion driver to internal version 4.16.00.00.
7
8 Signed-off-by: Satya Prakash <sathya.prakash@lsi.com>
9 Acked-by: Hannes Reinecke <hare@suse.de>
10
11 ---
12 drivers/message/fusion/csmi/csmisas.c | 1392 +++++++++----------
13 drivers/message/fusion/csmi/csmisas.h | 551 ++-----
14 drivers/message/fusion/lsi/mpi_cnfg.h | 3
15 drivers/message/fusion/lsi/mpi_log_sas.h | 12
16 drivers/message/fusion/lsi/mpi_type.h | 14
17 drivers/message/fusion/mptbase.c | 689 +++++----
18 drivers/message/fusion/mptbase.h | 67
19 drivers/message/fusion/mptctl.c | 240 +--
20 drivers/message/fusion/mptfc.c | 41
21 drivers/message/fusion/mptlan.c | 26
22 drivers/message/fusion/mptsas.c | 479 ++++--
23 drivers/message/fusion/mptsas.h | 9
24 drivers/message/fusion/mptscsih.c | 223 +--
25 drivers/message/fusion/mptscsih.h | 6
26 drivers/message/fusion/mptspi.c | 27
27 drivers/message/fusion/rejected_ioctls/diag_buffer.c | 170 +-
28 drivers/message/fusion/rejected_ioctls/diag_buffer.h | 18
29 17 files changed, 2052 insertions(+), 1915 deletions(-)
30
31 --- a/drivers/message/fusion/csmi/csmisas.c
32 +++ b/drivers/message/fusion/csmi/csmisas.c
33 @@ -43,16 +43,13 @@
34 */
35 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
36
37 -#define MPT_CSMI_DESCRIPTION "LSI Corporation: Fusion MPT Driver "MPT_LINUX_VERSION_COMMON
38 +#define MPT_CSMI_DESCRIPTION \
39 + "LSI Corporation: Fusion MPT Driver "MPT_LINUX_VERSION_COMMON
40 #define csmisas_is_this_sas_cntr(ioc) (ioc->bus_type == SAS) ? 1 : 0
41
42 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
43 -#define __user
44 -#include <asm/div64.h>
45 -#endif
46
47 -static int csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum, u8 VolumeBus,
48 - u8 VolumeId, pMpiRaidActionReply_t reply);
49 +static int csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum,
50 + u8 VolumeBus, u8 VolumeId, pMpiRaidActionReply_t reply);
51 static u8 map_sas_status_to_csmi(u8 mpi_sas_status);
52
53 /**
54 @@ -66,7 +63,7 @@ reverse_byte_order64(u64 data64)
55 {
56 int i;
57 u64 rc;
58 - u8 *inWord = (u8*)&data64, *outWord = (u8*)&rc;
59 + u8 *inWord = (u8 *)&data64, *outWord = (u8 *)&rc;
60
61 for (i = 0 ; i < 8 ; i++)
62 outWord[i] = inWord[7-i];
63 @@ -98,7 +95,7 @@ csmisas_is_sata(RaidPhysDiskPage0_t *phy
64 *
65 **/
66 static inline int
67 -csmisas_is_end_device(struct mptsas_devinfo * attached)
68 +csmisas_is_end_device(struct mptsas_devinfo *attached)
69 {
70 if ((attached->sas_address) &&
71 (attached->device_info &
72 @@ -130,7 +127,8 @@ csmisas_is_phys_disk(MPT_ADAPTER *ioc, i
73 goto out;
74 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) {
75 if ((id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) &&
76 - (channel == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
77 + (channel ==
78 + ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
79 rc = 1;
80 goto out;
81 }
82 @@ -142,14 +140,14 @@ csmisas_is_phys_disk(MPT_ADAPTER *ioc, i
83 if (list_empty(&ioc->raid_data.inactive_list))
84 goto out;
85
86 - down(&ioc->raid_data.inactive_list_mutex);
87 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
88 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
89 list) {
90 if ((component_info->d.PhysDiskID == id) &&
91 (component_info->d.PhysDiskBus == channel))
92 rc = 1;
93 }
94 - up(&ioc->raid_data.inactive_list_mutex);
95 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
96
97 out:
98 return rc;
99 @@ -161,7 +159,8 @@ csmisas_is_phys_disk(MPT_ADAPTER *ioc, i
100 * Obtains the phys disk num for given H:C:T nexus
101 *
102 * input (channel/id)
103 - * output (phys disk number - used by SCSI_IO_PASSTHRU to access hidden component)
104 + * output (phys disk number - used by SCSI_IO_PASSTHRU to access hidden
105 + * component)
106 *
107 * returns - signed return means failure
108 **/
109 @@ -176,7 +175,8 @@ csmisas_raid_id_to_num(MPT_ADAPTER *ioc,
110 goto out;
111 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) {
112 if ((id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) &&
113 - (channel == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
114 + (channel ==
115 + ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) {
116 rc = ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum;
117 goto out;
118 }
119 @@ -188,14 +188,14 @@ csmisas_raid_id_to_num(MPT_ADAPTER *ioc,
120 if (list_empty(&ioc->raid_data.inactive_list))
121 goto out;
122
123 - down(&ioc->raid_data.inactive_list_mutex);
124 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
125 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
126 list) {
127 if ((component_info->d.PhysDiskID == id) &&
128 (component_info->d.PhysDiskBus == channel))
129 rc = component_info->d.PhysDiskNum;
130 }
131 - up(&ioc->raid_data.inactive_list_mutex);
132 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
133
134 out:
135 return rc;
136 @@ -218,7 +218,7 @@ csmisas_get_device_component_by_os(MPT_A
137
138 sas_info = NULL;
139
140 - down(&ioc->sas_device_info_mutex);
141 + mutex_lock(&ioc->sas_device_info_mutex);
142 list_for_each_entry(p, &ioc->sas_device_info_list, list) {
143 if (p->os.channel == channel && p->os.id == id) {
144 sas_info = p;
145 @@ -227,7 +227,7 @@ csmisas_get_device_component_by_os(MPT_A
146 }
147
148 out:
149 - up(&ioc->sas_device_info_mutex);
150 + mutex_unlock(&ioc->sas_device_info_mutex);
151 return sas_info;
152 }
153
154 @@ -248,7 +248,7 @@ csmisas_get_device_component_by_fw(MPT_A
155
156 sas_info = NULL;
157
158 - down(&ioc->sas_device_info_mutex);
159 + mutex_lock(&ioc->sas_device_info_mutex);
160 list_for_each_entry(p, &ioc->sas_device_info_list, list) {
161 if (p->fw.channel == channel && p->fw.id == id) {
162 sas_info = p;
163 @@ -257,7 +257,7 @@ csmisas_get_device_component_by_fw(MPT_A
164 }
165
166 out:
167 - up(&ioc->sas_device_info_mutex);
168 + mutex_unlock(&ioc->sas_device_info_mutex);
169 return sas_info;
170 }
171
172 @@ -279,7 +279,7 @@ csmisas_get_device_component_by_sas_addr
173
174 sas_info = NULL;
175
176 - down(&ioc->sas_device_info_mutex);
177 + mutex_lock(&ioc->sas_device_info_mutex);
178 list_for_each_entry(p, &ioc->sas_device_info_list, list) {
179 if (p->sas_address == sas_address) {
180 sas_info = p;
181 @@ -288,7 +288,7 @@ csmisas_get_device_component_by_sas_addr
182 }
183
184 out:
185 - up(&ioc->sas_device_info_mutex);
186 + mutex_unlock(&ioc->sas_device_info_mutex);
187 return sas_info;
188 }
189
190 @@ -305,7 +305,8 @@ csmisas_get_device_component_by_sas_addr
191 * non-zero, failure
192 **/
193 static int
194 -csmisas_send_command_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, unsigned long timeout)
195 +csmisas_send_command_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf,
196 + unsigned long timeout)
197 {
198 int rc;
199 unsigned long timeleft;
200 @@ -314,40 +315,15 @@ csmisas_send_command_wait(MPT_ADAPTER *i
201 rc = 0;
202 timeleft = 0;
203
204 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
205 -
206 - INITIALIZE_IOCTL_STATUS(ioc->ioctl_cmds.status)
207 - ioc->ioctl_cmds.wait_done = 0;
208 - ioc->ioctl_cmds.timer.expires = jiffies + (MPT_JIFFY * timeout);
209 - ioc->ioctl_cmds.status |= MPT_MGMT_STATUS_TIMER_ACTIVE;
210 - ADD_TIMER(&ioc->ioctl_cmds.timer);
211 - mpt_put_msg_frame(mptctl_id, ioc, mf);
212 - WAIT_EVENT(mptctl_wait, ioc->ioctl_cmds.wait_done);
213 -
214 -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
215 -
216 - INITIALIZE_IOCTL_STATUS(ioc->ioctl_cmds.status)
217 - ioc->ioctl_cmds.wait_done = 0;
218 - mpt_put_msg_frame(mptctl_id, ioc, mf);
219 -
220 - if ((wait_event_timeout(mptctl_wait,
221 - ioc->ioctl_cmds.wait_done == 1, HZ * timeout) <=0) &&
222 - ioc->ioctl_cmds.wait_done != 1 ) {
223 - mptctl_timeout_expired(ioc,mf);
224 - mpt_free_msg_frame(ioc, mf);
225 - rc = -1;
226 - }
227 -
228 -#else
229 -
230 SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context,
231 mf->u.hdr.MsgContext);
232 INITIALIZE_MGMT_STATUS(ioc->ioctl_cmds.status)
233 mpt_put_msg_frame(mptctl_id, ioc, mf);
234 - timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, timeout*HZ);
235 + timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done,
236 + timeout*HZ);
237 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
238 rc = -1;
239 - printk("%s: failed\n", __FUNCTION__);
240 + printk(KERN_WARNING "%s: failed\n", __func__);
241 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
242 mpt_free_msg_frame(ioc, mf);
243 CLEAR_MGMT_STATUS(ioc->ioctl_cmds.status)
244 @@ -357,7 +333,6 @@ csmisas_send_command_wait(MPT_ADAPTER *i
245 mptctl_timeout_expired(ioc, mf);
246 }
247 SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, 0);
248 -#endif
249 return rc;
250 }
251
252 @@ -375,7 +350,8 @@ csmisas_send_command_wait(MPT_ADAPTER *i
253 * non-zero, failure
254 **/
255 static int
256 -csmisas_send_handshake_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, unsigned long timeout)
257 +csmisas_send_handshake_wait(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf,
258 + unsigned long timeout)
259 {
260 int rc;
261 unsigned long timeleft;
262 @@ -384,42 +360,13 @@ csmisas_send_handshake_wait(MPT_ADAPTER
263 rc = 0;
264 timeleft = 0;
265
266 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
267 -
268 - INITIALIZE_IOCTL_STATUS(ioc->taskmgmt_cmds.status)
269 - ioc->taskmgmt_cmds.timer.expires = jiffies + (MPT_JIFFY*timeout);
270 - ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_TIMER_ACTIVE;
271 - ioc->taskmgmt_cmds.wait_done = 0;
272 - ADD_TIMER(&ioc->taskmgmt_cmds.timer);
273 - rc = mpt_send_special_message(mptctl_taskmgmt_id, ioc,
274 - sizeof(SCSITaskMgmt_t), (u32*)mf, timeout, CAN_SLEEP);
275 - if (rc != 0)
276 - return rc;
277 - WAIT_EVENT(mptctl_taskmgmt_wait, ioc->taskmgmt_cmds.wait_done);
278 -
279 -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
280 -
281 - INITIALIZE_IOCTL_STATUS(ioc->taskmgmt_cmds.status)
282 - ioc->taskmgmt_cmds.wait_done = 0;
283 - rc = mpt_send_special_message(mptctl_taskmgmt_id, ioc,
284 - sizeof(SCSITaskMgmt_t), (u32*)mf, timeout, CAN_SLEEP);
285 - if (rc != 0)
286 - return rc;
287 - if ((wait_event_timeout(mptctl_taskmgmt_wait,
288 - ioc->taskmgmt_cmds.wait_done == 1, HZ * timeout) <=0) &&
289 - ioc->taskmgmt_cmds.wait_done != 1 ) {
290 - mptctl_timeout_expired(ioc, mf);
291 - mpt_free_msg_frame(ioc, mf);
292 - rc = -1;
293 - }
294 -
295 -#else
296 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
297 mpt_put_msg_frame_hi_pri(mptctl_taskmgmt_id, ioc, mf);
298 - timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, timeout*HZ);
299 + timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done,
300 + timeout*HZ);
301 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
302 rc = -1;
303 - printk("%s: failed\n", __FUNCTION__);
304 + printk(KERN_WARNING "%s: failed\n", __func__);
305 mpt_clear_taskmgmt_in_progress_flag(ioc);
306 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
307 mpt_free_msg_frame(ioc, mf);
308 @@ -429,7 +376,6 @@ csmisas_send_handshake_wait(MPT_ADAPTER
309 if (!timeleft)
310 mptctl_timeout_expired(ioc, mf);
311 }
312 -#endif
313 return rc;
314 }
315
316 @@ -527,7 +473,8 @@ csmisas_get_ioc_pg5(MPT_ADAPTER *ioc, IO
317 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
318 cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;
319
320 - if ((rc = mpt_config(ioc, &cfg)) != 0)
321 + rc = mpt_config(ioc, &cfg);
322 + if (rc != 0)
323 goto get_ioc_pg5;
324
325 if (hdr.PageLength == 0) {
326 @@ -547,7 +494,8 @@ csmisas_get_ioc_pg5(MPT_ADAPTER *ioc, IO
327 cfg.physAddr = dma_handle;
328 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
329
330 - if ((rc = mpt_config(ioc, &cfg)) != 0)
331 + rc = mpt_config(ioc, &cfg);
332 + if (rc != 0)
333 goto get_ioc_pg5;
334
335 memcpy(iocPage5, buffer, data_size);
336 @@ -565,7 +513,8 @@ csmisas_get_ioc_pg5(MPT_ADAPTER *ioc, IO
337 * csmisas_sas_device_pg0 - sas device page 0
338 * @ioc: Pointer to MPT_ADAPTER structure
339 * @mptsas_devinfo: structure found in mptsas.h
340 - * @form, @form_specific - defines the Page Address field in the config page
341 + * @form, @form_specific - defines the Page Address field in
342 + * the config page
343 * (pls refer to chapter 5.1 in the mpi spec)
344 *
345 * Return: 0 for success
346 @@ -602,7 +551,8 @@ csmisas_sas_device_pg0(MPT_ADAPTER *ioc,
347 cfg.timeout = 10;
348
349 memset(device_info, 0, sizeof(struct mptsas_devinfo));
350 - if ((rc = mpt_config(ioc, &cfg)) != 0)
351 + rc = mpt_config(ioc, &cfg);
352 + if (rc != 0)
353 goto out;
354
355 if (!hdr.ExtPageLength) {
356 @@ -620,7 +570,8 @@ csmisas_sas_device_pg0(MPT_ADAPTER *ioc,
357 cfg.physAddr = dma_handle;
358 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
359
360 - if ((rc = mpt_config(ioc, &cfg)) != 0)
361 + rc = mpt_config(ioc, &cfg);
362 + if (rc != 0)
363 goto out_free_consistent;
364
365 device_info->handle = le16_to_cpu(buffer->DevHandle);
366 @@ -664,31 +615,31 @@ csmisas_get_driver_info(unsigned long ar
367 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_DRIVER_INFO_BUFFER))) {
368 printk(KERN_ERR "%s@%d::%s - "
369 "Unable to read in csmi_sas_get_driver_info_buffer struct @ %p\n",
370 - __FILE__, __LINE__, __FUNCTION__, uarg);
371 + __FILE__, __LINE__, __func__, uarg);
372 return -EFAULT;
373 }
374
375 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
376 &ioc)) < 0) || (ioc == NULL)) {
377 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
378 - __FILE__, __FUNCTION__, __LINE__, iocnum);
379 + __FILE__, __func__, __LINE__, iocnum);
380 return -ENODEV;
381 }
382
383 if (!csmisas_is_this_sas_cntr(ioc)) {
384 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
385 - __FILE__, __FUNCTION__, __LINE__, iocnum);
386 + __FILE__, __func__, __LINE__, iocnum);
387 return -ENODEV;
388 }
389
390 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
391 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
392
393 /* Fill in the data and return the structure to the calling
394 * program
395 */
396 - memcpy( karg.Information.szName, MPT_MISCDEV_BASENAME,
397 + memcpy(karg.Information.szName, MPT_MISCDEV_BASENAME,
398 sizeof(MPT_MISCDEV_BASENAME));
399 - memcpy( karg.Information.szDescription, MPT_CSMI_DESCRIPTION,
400 + memcpy(karg.Information.szDescription, MPT_CSMI_DESCRIPTION,
401 sizeof(MPT_CSMI_DESCRIPTION));
402
403 karg.Information.usMajorRevision = MPT_LINUX_MAJOR_VERSION;
404 @@ -707,11 +658,11 @@ csmisas_get_driver_info(unsigned long ar
405 sizeof(CSMI_SAS_DRIVER_INFO_BUFFER))) {
406 printk(KERN_ERR "%s@%d::%s - "
407 "Unable to write out csmi_sas_get_driver_info_buffer @ %p\n",
408 - __FILE__, __LINE__, __FUNCTION__, uarg);
409 + __FILE__, __LINE__, __func__, uarg);
410 return -EFAULT;
411 }
412
413 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
414 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
415 return 0;
416 }
417
418 @@ -736,28 +687,28 @@ csmisas_get_cntlr_config(unsigned long a
419 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_CNTLR_CONFIG_BUFFER))) {
420 printk(KERN_ERR "%s@%d::%s - "
421 "Unable to read in csmi_sas_get_cntlr_config_buffer struct @ %p\n",
422 - __FILE__, __LINE__, __FUNCTION__, uarg);
423 + __FILE__, __LINE__, __func__, uarg);
424 return -EFAULT;
425 }
426
427 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
428 &ioc)) < 0) || (ioc == NULL)) {
429 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
430 - __FILE__, __FUNCTION__, __LINE__, iocnum);
431 + __FILE__, __func__, __LINE__, iocnum);
432 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
433 return -ENODEV;
434 }
435
436 if (!csmisas_is_this_sas_cntr(ioc)) {
437 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
438 - __FILE__, __FUNCTION__, __LINE__, iocnum);
439 + __FILE__, __func__, __LINE__, iocnum);
440 return -ENODEV;
441 }
442
443 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
444 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
445
446 /* Clear the struct before filling in data. */
447 - memset( &karg.Configuration, 0, sizeof(CSMI_SAS_CNTLR_CONFIG));
448 + memset(&karg.Configuration, 0, sizeof(CSMI_SAS_CNTLR_CONFIG));
449
450 /* Fill in the data and return the structure to the calling
451 * program
452 @@ -786,7 +737,7 @@ csmisas_get_cntlr_config(unsigned long a
453 karg.Configuration.BusAddress.PciAddress.bFunctionNumber =
454 PCI_FUNC(ioc->pcidev->devfn);
455 karg.Configuration.BusAddress.PciAddress.bReserved = 0;
456 - memcpy( &karg.Configuration.szSerialNumber, ioc->board_tracer, 16 );
457 + memcpy(&karg.Configuration.szSerialNumber, ioc->board_tracer, 16);
458 karg.Configuration.usMajorRevision = ioc->facts.FWVersion.Struct.Major;
459 karg.Configuration.usMinorRevision = ioc->facts.FWVersion.Struct.Minor;
460 karg.Configuration.usBuildRevision = ioc->facts.FWVersion.Struct.Unit;
461 @@ -819,11 +770,11 @@ csmisas_get_cntlr_config(unsigned long a
462 sizeof(CSMI_SAS_DRIVER_INFO_BUFFER))) {
463 printk(KERN_ERR "%s@%d::%s - "
464 "Unable to write out csmi_sas_get_driver_info_buffer @ %p\n",
465 - __FILE__, __LINE__, __FUNCTION__, uarg);
466 + __FILE__, __LINE__, __func__, uarg);
467 return -EFAULT;
468 }
469
470 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
471 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
472 return 0;
473 }
474
475 @@ -848,24 +799,24 @@ csmisas_get_cntlr_status(unsigned long a
476 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_CNTLR_STATUS_BUFFER))) {
477 printk(KERN_ERR "%s@%d::%s - "
478 "Unable to read in csmi_sas_get_cntlr_status_buffer struct @ %p\n",
479 - __FILE__, __LINE__, __FUNCTION__, uarg);
480 + __FILE__, __LINE__, __func__, uarg);
481 return -EFAULT;
482 }
483
484 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
485 &ioc)) < 0) || (ioc == NULL)) {
486 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
487 - __FILE__, __FUNCTION__, __LINE__, iocnum);
488 + __FILE__, __func__, __LINE__, iocnum);
489 return -ENODEV;
490 }
491
492 if (!csmisas_is_this_sas_cntr(ioc)) {
493 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
494 - __FILE__, __FUNCTION__, __LINE__, iocnum);
495 + __FILE__, __func__, __LINE__, iocnum);
496 return -ENODEV;
497 }
498
499 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
500 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
501
502 /* Fill in the data and return the structure to the calling
503 * program
504 @@ -902,11 +853,11 @@ csmisas_get_cntlr_status(unsigned long a
505 sizeof(CSMI_SAS_CNTLR_STATUS_BUFFER))) {
506 printk(KERN_ERR "%s@%d::%s - "
507 "Unable to write out csmi_sas_get_cntlr_status @ %p\n",
508 - __FILE__, __LINE__, __FUNCTION__, uarg);
509 + __FILE__, __LINE__, __func__, uarg);
510 return -EFAULT;
511 }
512
513 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
514 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
515 return 0;
516 }
517
518 @@ -940,19 +891,19 @@ csmisas_get_phy_info(unsigned long arg)
519 struct mptsas_devinfo device_info;
520 int memory_pages;
521
522 - sasIoUnitPg0=NULL;
523 - sasPhyPg0=NULL;
524 - sasIoUnitPg0_data_sz=0;
525 - sasPhyPg0_data_sz=0;
526 + sasIoUnitPg0 = NULL;
527 + sasPhyPg0 = NULL;
528 + sasIoUnitPg0_data_sz = 0;
529 + sasPhyPg0_data_sz = 0;
530
531 memory_pages = get_order(sizeof(CSMI_SAS_PHY_INFO_BUFFER));
532 karg = (CSMI_SAS_PHY_INFO_BUFFER *)__get_free_pages(
533 GFP_KERNEL, memory_pages);
534 - if (!karg){
535 + if (!karg) {
536 printk(KERN_ERR "%s@%d::%s() - "
537 "Unable to malloc CSMI_SAS_PHY_INFO_BUFFER "
538 "malloc_data_sz=%d memory_pages=%d\n",
539 - __FILE__, __LINE__, __FUNCTION__,
540 + __FILE__, __LINE__, __func__,
541 (int)sizeof(CSMI_SAS_PHY_INFO_BUFFER), memory_pages);
542 return -ENOMEM;
543 }
544 @@ -962,7 +913,7 @@ csmisas_get_phy_info(unsigned long arg)
545 if (copy_from_user(karg, uarg, sizeof(CSMI_SAS_PHY_INFO_BUFFER))) {
546 printk(KERN_ERR "%s@%d::%s - "
547 "Unable to read in csmisas_get_phy_info_buffer struct @ %p\n",
548 - __FILE__, __LINE__, __FUNCTION__, uarg);
549 + __FILE__, __LINE__, __func__, uarg);
550 free_pages((unsigned long)karg, memory_pages);
551 return -EFAULT;
552 }
553 @@ -970,19 +921,19 @@ csmisas_get_phy_info(unsigned long arg)
554 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
555 &ioc)) < 0) || (ioc == NULL)) {
556 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
557 - __FILE__, __FUNCTION__, __LINE__, iocnum);
558 + __FILE__, __func__, __LINE__, iocnum);
559 free_pages((unsigned long)karg, memory_pages);
560 return -ENODEV;
561 }
562
563 if (!csmisas_is_this_sas_cntr(ioc)) {
564 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
565 - __FILE__, __FUNCTION__, __LINE__, iocnum);
566 + __FILE__, __func__, __LINE__, iocnum);
567 free_pages((unsigned long)karg, memory_pages);
568 return -ENODEV;
569 }
570
571 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
572 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
573
574 /* Fill in the data and return the structure to the calling
575 * program
576 @@ -1011,7 +962,7 @@ csmisas_get_phy_info(unsigned long arg)
577 */
578 dcsmisasprintk(ioc, printk(KERN_ERR
579 ": FAILED: MPI_SASIOUNITPAGE0_PAGEVERSION: HEADER\n"));
580 - dcsmisasprintk(ioc, printk(": rc=%x\n",rc));
581 + dcsmisasprintk(ioc, printk(": rc=%x\n", rc));
582 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
583 goto sas_get_phy_info_exit;
584 }
585 @@ -1020,7 +971,8 @@ csmisas_get_phy_info(unsigned long arg)
586 /* Don't check if this failed. Already in a
587 * failure case.
588 */
589 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
590 + dcsmisasprintk(ioc, printk(KERN_ERR
591 + ": hdr.ExtPageLength == 0\n"));
592 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
593 goto sas_get_phy_info_exit;
594 }
595 @@ -1032,7 +984,8 @@ csmisas_get_phy_info(unsigned long arg)
596 sasIoUnitPg0_data_sz, &sasIoUnitPg0_dma);
597
598 if (!sasIoUnitPg0) {
599 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
600 + dcsmisasprintk(ioc, printk(KERN_ERR
601 + ": pci_alloc_consistent: FAILED\n"));
602 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
603 goto sas_get_phy_info_exit;
604 }
605 @@ -1048,7 +1001,7 @@ csmisas_get_phy_info(unsigned long arg)
606 */
607 dcsmisasprintk(ioc, printk(KERN_ERR
608 ": FAILED: MPI_SASIOUNITPAGE0_PAGEVERSION: PAGE\n"));
609 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
610 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
611 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
612 goto sas_get_phy_info_exit;
613 }
614 @@ -1058,27 +1011,30 @@ csmisas_get_phy_info(unsigned long arg)
615
616 /* Fill in information for each phy. */
617 for (ii = 0; ii < karg->Information.bNumberOfPhys; ii++) {
618 -
619 -/* EDM : dump IO Unit Page 0 data*/
620 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- IO UNIT PAGE 0 ------------\n"));
621 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n",
622 + dcsmisasprintk(ioc, printk(KERN_DEBUG
623 + "---- IO UNIT PAGE 0 ------------\n"));
624 + dcsmisasprintk(ioc, printk(KERN_DEBUG
625 + "Handle=0x%X\n",
626 le16_to_cpu(sasIoUnitPg0->PhyData[ii].AttachedDeviceHandle)));
627 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Controller Handle=0x%X\n",
628 + dcsmisasprintk(ioc, printk(KERN_DEBUG
629 + "Controller Handle=0x%X\n",
630 le16_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerDevHandle)));
631 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Port=0x%X\n",
632 + dcsmisasprintk(ioc, printk(KERN_DEBUG
633 + "Port=0x%X\n",
634 sasIoUnitPg0->PhyData[ii].Port));
635 dcsmisasprintk(ioc, printk(KERN_DEBUG "Port Flags=0x%X\n",
636 sasIoUnitPg0->PhyData[ii].PortFlags));
637 dcsmisasprintk(ioc, printk(KERN_DEBUG "PHY Flags=0x%X\n",
638 sasIoUnitPg0->PhyData[ii].PhyFlags));
639 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Negotiated Link Rate=0x%X\n",
640 + dcsmisasprintk(ioc, printk(KERN_DEBUG
641 + "Negotiated Link Rate=0x%X\n",
642 sasIoUnitPg0->PhyData[ii].NegotiatedLinkRate));
643 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Controller PHY Device Info=0x%X\n",
644 + dcsmisasprintk(ioc, printk(KERN_DEBUG
645 + "Controller PHY Device Info=0x%X\n",
646 le32_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo)));
647 dcsmisasprintk(ioc, printk(KERN_DEBUG "DiscoveryStatus=0x%X\n",
648 le32_to_cpu(sasIoUnitPg0->PhyData[ii].DiscoveryStatus)));
649 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
650 -/* EDM : debug data */
651
652 /* PHY stuff. */
653 karg->Information.Phy[ii].bPortIdentifier =
654 @@ -1147,13 +1103,14 @@ csmisas_get_phy_info(unsigned long arg)
655 if ((rc = mpt_config(ioc, &cfg)) != 0) {
656 dcsmisasprintk(ioc, printk(KERN_ERR
657 ": FAILED: MPI_SASPHY0_PAGEVERSION: HEADER\n"));
658 - dcsmisasprintk(ioc, printk(": rc=%x\n",rc));
659 + dcsmisasprintk(ioc, printk(": rc=%x\n", rc));
660 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
661 goto sas_get_phy_info_exit;
662 }
663
664 if (hdr.ExtPageLength == 0) {
665 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
666 + dcsmisasprintk(ioc, printk(KERN_ERR
667 + ": pci_alloc_consistent: FAILED\n"));
668 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
669 goto sas_get_phy_info_exit;
670 }
671 @@ -1164,8 +1121,9 @@ csmisas_get_phy_info(unsigned long arg)
672 sasPhyPg0 = (SasPhyPage0_t *) pci_alloc_consistent(
673 ioc->pcidev, sasPhyPg0_data_sz, &sasPhyPg0_dma);
674
675 - if (! sasPhyPg0) {
676 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
677 + if (!sasPhyPg0) {
678 + dcsmisasprintk(ioc, printk(KERN_ERR
679 + ": pci_alloc_consistent: FAILED\n"));
680 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
681 goto sas_get_phy_info_exit;
682 }
683 @@ -1177,34 +1135,37 @@ csmisas_get_phy_info(unsigned long arg)
684 if ((rc = mpt_config(ioc, &cfg)) != 0) {
685 dcsmisasprintk(ioc, printk(KERN_ERR
686 ": FAILED: MPI_SASPHY0_PAGEVERSION: PAGE\n"));
687 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
688 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
689 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
690 pci_free_consistent(ioc->pcidev, sasPhyPg0_data_sz,
691 (u8 *) sasPhyPg0, sasPhyPg0_dma);
692 goto sas_get_phy_info_exit;
693 }
694
695 -/* EDM : dump PHY Page 0 data*/
696 memcpy(&sas_address, &sasPhyPg0->SASAddress, sizeof(u64));
697 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 0 ------------\n"));
698 + dcsmisasprintk(ioc, printk(KERN_DEBUG
699 + "---- SAS PHY PAGE 0 ------------\n"));
700 dcsmisasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n",
701 le16_to_cpu(sasPhyPg0->AttachedDevHandle)));
702 dcsmisasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n",
703 (unsigned long long)sas_address));
704 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Attached PHY Identifier=0x%X\n",
705 + dcsmisasprintk(ioc, printk(KERN_DEBUG
706 + "Attached PHY Identifier=0x%X\n",
707 sasPhyPg0->AttachedPhyIdentifier));
708 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Attached Device Info=0x%X\n",
709 + dcsmisasprintk(ioc, printk(KERN_DEBUG
710 + "Attached Device Info=0x%X\n",
711 le32_to_cpu(sasPhyPg0->AttachedDeviceInfo)));
712 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Programmed Link Rate=0x%X\n",
713 + dcsmisasprintk(ioc, printk(KERN_DEBUG
714 + "Programmed Link Rate=0x%X\n",
715 sasPhyPg0->ProgrammedLinkRate));
716 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Hardware Link Rate=0x%X\n",
717 + dcsmisasprintk(ioc, printk(KERN_DEBUG
718 + "Hardware Link Rate=0x%X\n",
719 sasPhyPg0->HwLinkRate));
720 dcsmisasprintk(ioc, printk(KERN_DEBUG "Change Count=0x%X\n",
721 sasPhyPg0->ChangeCount));
722 dcsmisasprintk(ioc, printk(KERN_DEBUG "PHY Info=0x%X\n",
723 le32_to_cpu(sasPhyPg0->PhyInfo)));
724 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
725 -/* EDM : debug data */
726
727 /* save the data */
728
729 @@ -1284,8 +1245,9 @@ csmisas_get_phy_info(unsigned long arg)
730 }
731
732 karg->Information.Phy[ii].bPhyChangeCount = sasPhyPg0->ChangeCount;
733 - if( sasPhyPg0->PhyInfo & MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY )
734 - karg->Information.Phy[ii].bPhyFeatures = CSMI_SAS_PHY_VIRTUAL_SMP;
735 + if (sasPhyPg0->PhyInfo & MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY)
736 + karg->Information.Phy[ii].bPhyFeatures
737 + = CSMI_SAS_PHY_VIRTUAL_SMP;
738
739 /* Fill in Attached Device
740 * Initiator Port Protocol.
741 @@ -1295,17 +1257,17 @@ csmisas_get_phy_info(unsigned long arg)
742 protocol = le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) & 0x78;
743 karg->Information.Phy[ii].Attached.bInitiatorPortProtocol = 0;
744 if (protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR)
745 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol =
746 - CSMI_SAS_PROTOCOL_SSP;
747 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
748 + = CSMI_SAS_PROTOCOL_SSP;
749 if (protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR)
750 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol |=
751 - CSMI_SAS_PROTOCOL_STP;
752 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
753 + |= CSMI_SAS_PROTOCOL_STP;
754 if (protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR)
755 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol |=
756 - CSMI_SAS_PROTOCOL_SMP;
757 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
758 + |= CSMI_SAS_PROTOCOL_SMP;
759 if (protocol & MPI_SAS_DEVICE_INFO_SATA_HOST)
760 - karg->Information.Phy[ii].Attached.bInitiatorPortProtocol |=
761 - CSMI_SAS_PROTOCOL_SATA;
762 + karg->Information.Phy[ii].Attached.bInitiatorPortProtocol
763 + |= CSMI_SAS_PROTOCOL_SATA;
764
765 /* Fill in Phy Target Port
766 * Protocol. Bits 10:7
767 @@ -1314,17 +1276,17 @@ csmisas_get_phy_info(unsigned long arg)
768 protocol = le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) & 0x780;
769 karg->Information.Phy[ii].Attached.bTargetPortProtocol = 0;
770 if (protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET)
771 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
772 - CSMI_SAS_PROTOCOL_SSP;
773 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
774 + |= CSMI_SAS_PROTOCOL_SSP;
775 if (protocol & MPI_SAS_DEVICE_INFO_STP_TARGET)
776 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
777 - CSMI_SAS_PROTOCOL_STP;
778 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
779 + |= CSMI_SAS_PROTOCOL_STP;
780 if (protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET)
781 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
782 - CSMI_SAS_PROTOCOL_SMP;
783 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
784 + |= CSMI_SAS_PROTOCOL_SMP;
785 if (protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
786 - karg->Information.Phy[ii].Attached.bTargetPortProtocol |=
787 - CSMI_SAS_PROTOCOL_SATA;
788 + karg->Information.Phy[ii].Attached.bTargetPortProtocol
789 + |= CSMI_SAS_PROTOCOL_SATA;
790
791
792 /* Fill in Attached device type */
793 @@ -1353,7 +1315,8 @@ csmisas_get_phy_info(unsigned long arg)
794 }
795
796 /* Identify Info. */
797 - switch (le32_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) &
798 + switch (le32_to_cpu
799 + (sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) &
800 MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE) {
801
802 case MPI_SAS_DEVICE_INFO_NO_DEVICE:
803 @@ -1383,18 +1346,18 @@ csmisas_get_phy_info(unsigned long arg)
804 protocol = le32_to_cpu(
805 sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) & 0x78;
806 karg->Information.Phy[ii].Identify.bInitiatorPortProtocol = 0;
807 - if( protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR )
808 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
809 - CSMI_SAS_PROTOCOL_SSP;
810 - if( protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR )
811 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
812 - CSMI_SAS_PROTOCOL_STP;
813 - if( protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR )
814 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
815 - CSMI_SAS_PROTOCOL_SMP;
816 - if( protocol & MPI_SAS_DEVICE_INFO_SATA_HOST )
817 - karg->Information.Phy[ii].Identify.bInitiatorPortProtocol |=
818 - CSMI_SAS_PROTOCOL_SATA;
819 + if (protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR)
820 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
821 + |= CSMI_SAS_PROTOCOL_SSP;
822 + if (protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR)
823 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
824 + |= CSMI_SAS_PROTOCOL_STP;
825 + if (protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR)
826 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
827 + |= CSMI_SAS_PROTOCOL_SMP;
828 + if (protocol & MPI_SAS_DEVICE_INFO_SATA_HOST)
829 + karg->Information.Phy[ii].Identify.bInitiatorPortProtocol
830 + |= CSMI_SAS_PROTOCOL_SATA;
831
832 /* Fill in Phy Target Port Protocol. Bits 10:7
833 * More than one bit can be set, fall through cases.
834 @@ -1402,18 +1365,18 @@ csmisas_get_phy_info(unsigned long arg)
835 protocol = le32_to_cpu(
836 sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) & 0x780;
837 karg->Information.Phy[ii].Identify.bTargetPortProtocol = 0;
838 - if( protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET )
839 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
840 - CSMI_SAS_PROTOCOL_SSP;
841 - if( protocol & MPI_SAS_DEVICE_INFO_STP_TARGET )
842 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
843 - CSMI_SAS_PROTOCOL_STP;
844 - if( protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET )
845 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
846 - CSMI_SAS_PROTOCOL_SMP;
847 - if( protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE )
848 - karg->Information.Phy[ii].Identify.bTargetPortProtocol |=
849 - CSMI_SAS_PROTOCOL_SATA;
850 + if (protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET)
851 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
852 + |= CSMI_SAS_PROTOCOL_SSP;
853 + if (protocol & MPI_SAS_DEVICE_INFO_STP_TARGET)
854 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
855 + |= CSMI_SAS_PROTOCOL_STP;
856 + if (protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET)
857 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
858 + |= CSMI_SAS_PROTOCOL_SMP;
859 + if (protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE)
860 + karg->Information.Phy[ii].Identify.bTargetPortProtocol
861 + |= CSMI_SAS_PROTOCOL_SATA;
862
863 /* Setup SAS Address for the attached device */
864 if (sasPhyPg0->AttachedDevHandle) {
865 @@ -1450,13 +1413,13 @@ sas_get_phy_info_exit:
866 sizeof(CSMI_SAS_PHY_INFO_BUFFER))) {
867 printk(KERN_ERR "%s@%d::%s - "
868 "Unable to write out csmisas_get_phy_info_buffer @ %p\n",
869 - __FILE__, __LINE__, __FUNCTION__, uarg);
870 + __FILE__, __LINE__, __func__, uarg);
871 free_pages((unsigned long)karg, memory_pages);
872 return -EFAULT;
873 }
874
875 free_pages((unsigned long)karg, memory_pages);
876 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
877 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
878 return 0;
879 }
880
881 @@ -1479,30 +1442,28 @@ csmisas_set_phy_info(unsigned long arg)
882 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_SET_PHY_INFO_BUFFER))) {
883 printk(KERN_ERR "%s@%d::%s() - "
884 "Unable to read in csmi_sas_set_phy_info struct @ %p\n",
885 - __FILE__, __LINE__, __FUNCTION__, uarg);
886 + __FILE__, __LINE__, __func__, uarg);
887 return -EFAULT;
888 }
889
890 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
891 &ioc)) < 0) || (ioc == NULL)) {
892 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
893 - __FILE__, __FUNCTION__, __LINE__, iocnum);
894 + __FILE__, __func__, __LINE__, iocnum);
895 return -ENODEV;
896 }
897
898 if (!csmisas_is_this_sas_cntr(ioc)) {
899 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
900 - __FILE__, __FUNCTION__, __LINE__, iocnum);
901 + __FILE__, __func__, __LINE__, iocnum);
902 return -ENODEV;
903 }
904
905 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
906 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
907
908 -/* TODO - implement IOCTL here */
909 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;
910 dcsmisasprintk(ioc, printk(KERN_DEBUG ": not implemented\n"));
911
912 -// cim_set_phy_info_exit:
913
914 /* Copy the data from kernel memory to user memory
915 */
916 @@ -1510,11 +1471,11 @@ csmisas_set_phy_info(unsigned long arg)
917 sizeof(CSMI_SAS_SET_PHY_INFO_BUFFER))) {
918 printk(KERN_ERR "%s@%d::%s() - "
919 "Unable to write out csmi_sas_set_phy_info @ %p\n",
920 - __FILE__, __LINE__, __FUNCTION__, uarg);
921 + __FILE__, __LINE__, __func__, uarg);
922 return -EFAULT;
923 }
924
925 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
926 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
927 return 0;
928
929 }
930 @@ -1541,24 +1502,24 @@ csmisas_get_scsi_address(unsigned long a
931 sizeof(CSMI_SAS_GET_SCSI_ADDRESS_BUFFER))) {
932 printk(KERN_ERR "%s@%d::%s() - "
933 "Unable to read in csmi_sas_get_scsi_address struct @ %p\n",
934 - __FILE__, __LINE__, __FUNCTION__, uarg);
935 + __FILE__, __LINE__, __func__, uarg);
936 return -EFAULT;
937 }
938
939 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
940 &ioc)) < 0) || (ioc == NULL)) {
941 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
942 - __FILE__, __FUNCTION__, __LINE__, iocnum);
943 + __FILE__, __func__, __LINE__, iocnum);
944 return -ENODEV;
945 }
946
947 if (!csmisas_is_this_sas_cntr(ioc)) {
948 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
949 - __FILE__, __FUNCTION__, __LINE__, iocnum);
950 + __FILE__, __func__, __LINE__, iocnum);
951 return -ENODEV;
952 }
953
954 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
955 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
956
957 /* reverse byte order the sas address */
958 memcpy(&sas_address, karg.bSASAddress, sizeof(u64));
959 @@ -1586,11 +1547,11 @@ csmisas_get_scsi_address(unsigned long a
960 sizeof(CSMI_SAS_GET_SCSI_ADDRESS_BUFFER))) {
961 printk(KERN_ERR "%s@%d::%s() - "
962 "Unable to write out csmi_sas_get_scsi_address @ %p\n",
963 - __FILE__, __LINE__, __FUNCTION__, uarg);
964 + __FILE__, __LINE__, __func__, uarg);
965 return -EFAULT;
966 }
967
968 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
969 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
970 return 0;
971 }
972
973 @@ -1621,37 +1582,38 @@ csmisas_get_sata_signature(unsigned long
974 u8 phyId;
975 u64 sas_address;
976
977 - sasPhyPg0=NULL;
978 - sasPhyPg0_data_sz=0;
979 - sasDevicePg1=NULL;
980 - sasDevicePg1_data_sz=0;
981 + sasPhyPg0 = NULL;
982 + sasPhyPg0_data_sz = 0;
983 + sasDevicePg1 = NULL;
984 + sasDevicePg1_data_sz = 0;
985
986 if (copy_from_user(&karg, uarg,
987 sizeof(CSMI_SAS_SATA_SIGNATURE_BUFFER))) {
988 printk(KERN_ERR "%s@%d::%s() - "
989 "Unable to read in csmi_sas_sata_signature struct @ %p\n",
990 - __FILE__, __LINE__, __FUNCTION__, uarg);
991 + __FILE__, __LINE__, __func__, uarg);
992 return -EFAULT;
993 }
994
995 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
996 &ioc)) < 0) || (ioc == NULL)) {
997 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
998 - __FILE__, __FUNCTION__, __LINE__, iocnum);
999 + __FILE__, __func__, __LINE__, iocnum);
1000 return -ENODEV;
1001 }
1002
1003 if (!csmisas_is_this_sas_cntr(ioc)) {
1004 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1005 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1006 + __FILE__, __func__, __LINE__, iocnum);
1007 return -ENODEV;
1008 }
1009
1010 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1011 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1012 phyId = karg.Signature.bPhyIdentifier;
1013 if (phyId >= ioc->num_ports) {
1014 karg.IoctlHeader.ReturnCode = CSMI_SAS_PHY_DOES_NOT_EXIST;
1015 - dcsmisasprintk(ioc, printk(KERN_WARNING ": phyId >= ioc->num_ports\n"));
1016 + dcsmisasprintk(ioc,
1017 + printk(KERN_WARNING ": phyId >= ioc->num_ports\n"));
1018 goto cim_sata_signature_exit;
1019 }
1020
1021 @@ -1683,7 +1645,7 @@ csmisas_get_sata_signature(unsigned long
1022 */
1023 dcsmisasprintk(ioc, printk(KERN_ERR
1024 ": FAILED: MPI_SASPHY0_PAGEVERSION: HEADER\n"));
1025 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1026 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1027 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1028 goto cim_sata_signature_exit;
1029 }
1030 @@ -1692,7 +1654,8 @@ csmisas_get_sata_signature(unsigned long
1031 /* Don't check if this failed. Already in a
1032 * failure case.
1033 */
1034 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1035 + dcsmisasprintk(ioc,
1036 + printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1037 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1038 goto cim_sata_signature_exit;
1039 }
1040 @@ -1704,8 +1667,9 @@ csmisas_get_sata_signature(unsigned long
1041 sasPhyPg0 = (SasPhyPage0_t *) pci_alloc_consistent(ioc->pcidev,
1042 sasPhyPg0_data_sz, &sasPhyPg0_dma);
1043
1044 - if (! sasPhyPg0) {
1045 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1046 + if (!sasPhyPg0) {
1047 + dcsmisasprintk(ioc,
1048 + printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1049 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1050 goto cim_sata_signature_exit;
1051 }
1052 @@ -1720,7 +1684,7 @@ csmisas_get_sata_signature(unsigned long
1053 */
1054 dcsmisasprintk(ioc, printk(KERN_ERR
1055 ": FAILED: MPI_SASPHY0_PAGEVERSION: PAGE\n"));
1056 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1057 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1058 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1059 goto cim_sata_signature_exit;
1060 }
1061 @@ -1728,7 +1692,8 @@ csmisas_get_sata_signature(unsigned long
1062 /* Make sure a SATA device is attached. */
1063 if ((le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) &
1064 MPI_SAS_DEVICE_INFO_SATA_DEVICE) == 0) {
1065 - dcsmisasprintk(ioc, printk(KERN_WARNING ": NOT A SATA DEVICE\n"));
1066 + dcsmisasprintk(ioc,
1067 + printk(KERN_WARNING ": NOT A SATA DEVICE\n"));
1068 karg.IoctlHeader.ReturnCode = CSMI_SAS_NO_SATA_DEVICE;
1069 goto cim_sata_signature_exit;
1070 }
1071 @@ -1755,13 +1720,14 @@ csmisas_get_sata_signature(unsigned long
1072 if ((rc = mpt_config(ioc, &cfg)) != 0) {
1073 dcsmisasprintk(ioc, printk(KERN_ERR
1074 ": FAILED: MPI_SASDEVICE1_PAGEVERSION: HEADER\n"));
1075 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1076 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1077 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1078 goto cim_sata_signature_exit;
1079 }
1080
1081 if (hdr.ExtPageLength == 0) {
1082 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1083 + dcsmisasprintk(ioc, printk(KERN_ERR
1084 + ": hdr.ExtPageLength == 0\n"));
1085 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1086 goto cim_sata_signature_exit;
1087 }
1088 @@ -1772,8 +1738,9 @@ csmisas_get_sata_signature(unsigned long
1089 sasDevicePg1 = (SasDevicePage1_t *) pci_alloc_consistent
1090 (ioc->pcidev, sasDevicePg1_data_sz, &sasDevicePg1_dma);
1091
1092 - if (! sasDevicePg1) {
1093 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1094 + if (!sasDevicePg1) {
1095 + dcsmisasprintk(ioc, printk(KERN_ERR
1096 + ": pci_alloc_consistent: FAILED\n"));
1097 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1098 goto cim_sata_signature_exit;
1099 }
1100 @@ -1785,29 +1752,31 @@ csmisas_get_sata_signature(unsigned long
1101 if ((rc = mpt_config(ioc, &cfg)) != 0) {
1102 dcsmisasprintk(ioc, printk(KERN_ERR
1103 ": FAILED: MPI_SASDEVICE1_PAGEVERSION: PAGE\n"));
1104 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1105 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1106 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1107 goto cim_sata_signature_exit;
1108 }
1109
1110 -/* EDM : dump Device Page 1 data*/
1111 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- SAS DEVICE PAGE 1 ---------\n"));
1112 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Handle=0x%x\n",sasDevicePg1->DevHandle));
1113 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1114 + "---- SAS DEVICE PAGE 1 ---------\n"));
1115 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1116 + "Handle=0x%x\n", sasDevicePg1->DevHandle));
1117 memcpy(&sas_address, &sasDevicePg1->SASAddress, sizeof(u64));
1118 dcsmisasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n",
1119 (unsigned long long)sas_address));
1120 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
1121 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Target ID=0x%x\n",sasDevicePg1->TargetID));
1122 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Bus=0x%x\n",sasDevicePg1->Bus));
1123 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1124 + "Target ID=0x%x\n", sasDevicePg1->TargetID));
1125 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1126 + "Bus=0x%x\n", sasDevicePg1->Bus));
1127 dcsmisasprintk(ioc, printk(KERN_DEBUG "Initial Reg Device FIS="));
1128 - for(jj=0;jj<20;jj++)
1129 + for (jj = 0; jj < 20; jj++)
1130 dcsmisasprintk(ioc, printk("%02x ",
1131 ((u8 *)&sasDevicePg1->InitialRegDeviceFIS)[jj]));
1132 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n\n"));
1133 -/* EDM : debug data */
1134
1135 memcpy(karg.Signature.bSignatureFIS,
1136 - sasDevicePg1->InitialRegDeviceFIS,20);
1137 + sasDevicePg1->InitialRegDeviceFIS, 20);
1138
1139 cim_sata_signature_exit:
1140
1141 @@ -1825,11 +1794,11 @@ csmisas_get_sata_signature(unsigned long
1142 sizeof(CSMI_SAS_SATA_SIGNATURE_BUFFER))) {
1143 printk(KERN_ERR "%s@%d::%s() - "
1144 "Unable to write out csmi_sas_sata_signature @ %p\n",
1145 - __FILE__, __LINE__, __FUNCTION__, uarg);
1146 + __FILE__, __LINE__, __func__, uarg);
1147 return -EFAULT;
1148 }
1149
1150 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1151 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1152 return 0;
1153 }
1154
1155 @@ -1855,24 +1824,24 @@ csmisas_get_device_address(unsigned long
1156 sizeof(CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER))) {
1157 printk(KERN_ERR "%s@%d::%s() - "
1158 "Unable to read in csmi_sas_get_device_address_buffer struct @ %p\n",
1159 - __FILE__, __LINE__, __FUNCTION__, uarg);
1160 + __FILE__, __LINE__, __func__, uarg);
1161 return -EFAULT;
1162 }
1163
1164 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
1165 &ioc)) < 0) || (ioc == NULL)) {
1166 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1167 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1168 + __FILE__, __func__, __LINE__, iocnum);
1169 return -ENODEV;
1170 }
1171
1172 if (!csmisas_is_this_sas_cntr(ioc)) {
1173 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1174 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1175 + __FILE__, __func__, __LINE__, iocnum);
1176 return -ENODEV;
1177 }
1178
1179 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1180 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1181
1182 karg.IoctlHeader.ReturnCode = CSMI_SAS_NO_DEVICE_ADDRESS;
1183 memset(karg.bSASAddress, 0, sizeof(u64));
1184 @@ -1896,11 +1865,11 @@ csmisas_get_device_address(unsigned long
1185 sizeof(CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER))) {
1186 printk(KERN_ERR "%s@%d::%s() - "
1187 "Unable to write out csmi_sas_get_device_address_buffer @ %p\n",
1188 - __FILE__, __LINE__, __FUNCTION__, uarg);
1189 + __FILE__, __LINE__, __func__, uarg);
1190 return -EFAULT;
1191 }
1192
1193 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1194 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1195 return 0;
1196 }
1197
1198 @@ -1933,35 +1902,36 @@ csmisas_get_link_errors(unsigned long ar
1199 u16 ioc_status;
1200 u32 MsgContext;
1201
1202 - sasPhyPage1=NULL;
1203 - sasPhyPage1_data_sz=0;
1204 + sasPhyPage1 = NULL;
1205 + sasPhyPage1_data_sz = 0;
1206
1207 if (copy_from_user(&karg, uarg,
1208 sizeof(CSMI_SAS_LINK_ERRORS_BUFFER))) {
1209 printk(KERN_ERR "%s@%d::%s() - "
1210 "Unable to read in csmisas_get_link_errors struct @ %p\n",
1211 - __FILE__, __LINE__, __FUNCTION__, uarg);
1212 + __FILE__, __LINE__, __func__, uarg);
1213 return -EFAULT;
1214 }
1215
1216 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
1217 &ioc)) < 0) || (ioc == NULL)) {
1218 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1219 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1220 + __FILE__, __func__, __LINE__, iocnum);
1221 return -ENODEV;
1222 }
1223
1224 if (!csmisas_is_this_sas_cntr(ioc)) {
1225 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1226 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1227 + __FILE__, __func__, __LINE__, iocnum);
1228 return -ENODEV;
1229 }
1230
1231 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1232 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1233 phyId = karg.Information.bPhyIdentifier;
1234 if (phyId >= ioc->num_ports) {
1235 karg.IoctlHeader.ReturnCode = CSMI_SAS_PHY_DOES_NOT_EXIST;
1236 - dcsmisasprintk(ioc, printk(KERN_WARNING ": phyId >= ioc->num_ports\n"));
1237 + dcsmisasprintk(ioc, printk(KERN_WARNING
1238 + ": phyId >= ioc->num_ports\n"));
1239 goto cim_get_link_errors_exit;
1240 }
1241
1242 @@ -1993,7 +1963,7 @@ csmisas_get_link_errors(unsigned long ar
1243 */
1244 dcsmisasprintk(ioc, printk(KERN_ERR
1245 ": FAILED: MPI_SASPHY1_PAGEVERSION: HEADER\n"));
1246 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1247 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1248 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1249 goto cim_get_link_errors_exit;
1250 }
1251 @@ -2002,7 +1972,8 @@ csmisas_get_link_errors(unsigned long ar
1252 /* Don't check if this failed. Already in a
1253 * failure case.
1254 */
1255 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
1256 + dcsmisasprintk(ioc, printk(KERN_ERR
1257 + ": hdr.ExtPageLength == 0\n"));
1258 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1259 goto cim_get_link_errors_exit;
1260 }
1261 @@ -2014,8 +1985,9 @@ csmisas_get_link_errors(unsigned long ar
1262 sasPhyPage1 = (SasPhyPage1_t *) pci_alloc_consistent(ioc->pcidev,
1263 sasPhyPage1_data_sz, &sasPhyPage1_dma);
1264
1265 - if (! sasPhyPage1) {
1266 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1267 + if (!sasPhyPage1) {
1268 + dcsmisasprintk(ioc, printk(KERN_ERR
1269 + ": pci_alloc_consistent: FAILED\n"));
1270 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1271 goto cim_get_link_errors_exit;
1272 }
1273 @@ -2028,24 +2000,25 @@ csmisas_get_link_errors(unsigned long ar
1274 /* Don't check if this failed. Already in a
1275 * failure case.
1276 */
1277 - dcsmisasprintk(ioc, printk(KERN_ERR ": FAILED: MPI_SASPHY1_PAGEVERSION: PAGE\n"));
1278 - dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n",rc));
1279 + dcsmisasprintk(ioc, printk(KERN_ERR
1280 + ": FAILED: MPI_SASPHY1_PAGEVERSION: PAGE\n"));
1281 + dcsmisasprintk(ioc, printk(KERN_ERR ": rc=%x\n", rc));
1282 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1283 goto cim_get_link_errors_exit;
1284 }
1285
1286 -/* EDM : dump PHY Page 1 data*/
1287 - dcsmisasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 1 ------------\n"));
1288 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1289 + "---- SAS PHY PAGE 1 ------------\n"));
1290 dcsmisasprintk(ioc, printk(KERN_DEBUG "Invalid Dword Count=0x%x\n",
1291 sasPhyPage1->InvalidDwordCount));
1292 - dcsmisasprintk(ioc, printk(KERN_DEBUG "Running Disparity Error Count=0x%x\n",
1293 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1294 + "Running Disparity Error Count=0x%x\n",
1295 sasPhyPage1->RunningDisparityErrorCount));
1296 dcsmisasprintk(ioc, printk(KERN_DEBUG "Loss Dword Synch Count=0x%x\n",
1297 sasPhyPage1->LossDwordSynchCount));
1298 dcsmisasprintk(ioc, printk(KERN_DEBUG "PHY Reset Problem Count=0x%x\n",
1299 sasPhyPage1->PhyResetProblemCount));
1300 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n\n"));
1301 -/* EDM : debug data */
1302
1303 karg.Information.uInvalidDwordCount =
1304 le32_to_cpu(sasPhyPage1->InvalidDwordCount);
1305 @@ -2057,7 +2030,7 @@ csmisas_get_link_errors(unsigned long ar
1306 le32_to_cpu(sasPhyPage1->PhyResetProblemCount);
1307
1308 if (karg.Information.bResetCounts ==
1309 - CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS ) {
1310 + CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS) {
1311 goto cim_get_link_errors_exit;
1312 }
1313
1314 @@ -2072,12 +2045,12 @@ csmisas_get_link_errors(unsigned long ar
1315 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
1316 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1317 goto cim_get_link_errors_exit;
1318 - }
1319 + }
1320
1321 mpi_hdr = (MPIHeader_t *) mf;
1322 MsgContext = mpi_hdr->MsgContext;
1323 sasIoUnitCntrReq = (SasIoUnitControlRequest_t *)mf;
1324 - memset(sasIoUnitCntrReq,0,sizeof(SasIoUnitControlRequest_t));
1325 + memset(sasIoUnitCntrReq, 0, sizeof(SasIoUnitControlRequest_t));
1326 sasIoUnitCntrReq->Function = MPI_FUNCTION_SAS_IO_UNIT_CONTROL;
1327 sasIoUnitCntrReq->MsgContext = MsgContext;
1328 sasIoUnitCntrReq->PhyNum = phyId;
1329 @@ -2097,8 +2070,10 @@ csmisas_get_link_errors(unsigned long ar
1330 & MPI_IOCSTATUS_MASK;
1331
1332 if (ioc_status != MPI_IOCSTATUS_SUCCESS) {
1333 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": SAS IO Unit Control: "));
1334 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X\n",
1335 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1336 + ": SAS IO Unit Control: "));
1337 + dcsmisasprintk(ioc, printk(
1338 + "IOCStatus=0x%X IOCLogInfo=0x%X\n",
1339 sasIoUnitCntrReply->IOCStatus,
1340 sasIoUnitCntrReply->IOCLogInfo));
1341 }
1342 @@ -2116,11 +2091,11 @@ csmisas_get_link_errors(unsigned long ar
1343 sizeof(CSMI_SAS_LINK_ERRORS_BUFFER))) {
1344 printk(KERN_ERR "%s@%d::%s() - "
1345 "Unable to write out csmisas_get_link_errors @ %p\n",
1346 - __FILE__, __LINE__, __FUNCTION__, uarg);
1347 + __FILE__, __LINE__, __func__, uarg);
1348 return -EFAULT;
1349 }
1350
1351 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1352 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1353 return 0;
1354
1355 }
1356 @@ -2145,10 +2120,10 @@ csmisas_smp_passthru(unsigned long arg)
1357 MPIHeader_t *mpi_hdr;
1358 char *psge;
1359 int iocnum, flagsLength;
1360 - void * request_data;
1361 + void *request_data;
1362 dma_addr_t request_data_dma;
1363 u32 request_data_sz;
1364 - void * response_data;
1365 + void *response_data;
1366 dma_addr_t response_data_dma;
1367 u32 response_data_sz;
1368 u16 ioc_status;
1369 @@ -2161,11 +2136,11 @@ csmisas_smp_passthru(unsigned long arg)
1370 memory_pages = get_order(malloc_data_sz);
1371 karg = (CSMI_SAS_SMP_PASSTHRU_BUFFER *)__get_free_pages(
1372 GFP_KERNEL, memory_pages);
1373 - if (!karg){
1374 + if (!karg) {
1375 printk(KERN_ERR "%s@%d::%s() - "
1376 "Unable to malloc CSMI_SAS_SMP_PASSTHRU_BUFFER "
1377 "malloc_data_sz=%d memory_pages=%d\n",
1378 - __FILE__, __LINE__, __FUNCTION__,
1379 + __FILE__, __LINE__, __func__,
1380 malloc_data_sz, memory_pages);
1381 return -ENOMEM;
1382 }
1383 @@ -2173,7 +2148,7 @@ csmisas_smp_passthru(unsigned long arg)
1384 if (copy_from_user(karg, uarg, sizeof(CSMI_SAS_SMP_PASSTHRU_BUFFER))) {
1385 printk(KERN_ERR "%s@%d::%s() - "
1386 "Unable to read in csmi_sas_smp_passthru struct @ %p\n",
1387 - __FILE__, __LINE__, __FUNCTION__, uarg);
1388 + __FILE__, __LINE__, __func__, uarg);
1389 free_pages((unsigned long)karg, memory_pages);
1390 return -EFAULT;
1391 }
1392 @@ -2186,7 +2161,7 @@ csmisas_smp_passthru(unsigned long arg)
1393 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
1394 &ioc)) < 0) || (ioc == NULL)) {
1395 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1396 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1397 + __FILE__, __func__, __LINE__, iocnum);
1398 free_pages((unsigned long)karg, memory_pages);
1399 return -ENODEV;
1400 }
1401 @@ -2194,19 +2169,19 @@ csmisas_smp_passthru(unsigned long arg)
1402 if (ioc->ioc_reset_in_progress) {
1403 printk(KERN_ERR "%s@%d::%s - "
1404 "Busy with IOC Reset \n",
1405 - __FILE__, __LINE__,__FUNCTION__);
1406 + __FILE__, __LINE__, __func__);
1407 free_pages((unsigned long)karg, memory_pages);
1408 return -EBUSY;
1409 }
1410
1411 if (!csmisas_is_this_sas_cntr(ioc)) {
1412 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1413 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1414 + __FILE__, __func__, __LINE__, iocnum);
1415 free_pages((unsigned long)karg, memory_pages);
1416 return -ENODEV;
1417 }
1418
1419 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1420 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1421
1422 /* Default to success.*/
1423 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
1424 @@ -2228,13 +2203,13 @@ csmisas_smp_passthru(unsigned long arg)
1425 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
1426 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1427 goto cim_smp_passthru_exit;
1428 - }
1429 + }
1430
1431 mpi_hdr = (MPIHeader_t *) mf;
1432 MsgContext = mpi_hdr->MsgContext;
1433 - smpReq = (pSmpPassthroughRequest_t ) mf;
1434 + smpReq = (pSmpPassthroughRequest_t) mf;
1435
1436 - memset(smpReq,0,ioc->req_sz);
1437 + memset(smpReq, 0, ioc->req_sz);
1438
1439 memcpy(&sas_address, karg->Parameters.bDestinationSASAddress,
1440 sizeof(u64));
1441 @@ -2270,7 +2245,8 @@ csmisas_smp_passthru(unsigned long arg)
1442 ioc->pcidev, request_data_sz, &request_data_dma);
1443
1444 if (!request_data) {
1445 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1446 + dcsmisasprintk(ioc, printk(KERN_ERR
1447 + ": pci_alloc_consistent: FAILED\n"));
1448 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1449 mpt_free_msg_frame(ioc, mf);
1450 goto cim_smp_passthru_exit;
1451 @@ -2286,7 +2262,8 @@ csmisas_smp_passthru(unsigned long arg)
1452 ioc->pcidev, response_data_sz, &response_data_dma);
1453
1454 if (!response_data) {
1455 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
1456 + dcsmisasprintk(ioc, printk(KERN_ERR
1457 + ": pci_alloc_consistent: FAILED\n"));
1458 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1459 mpt_free_msg_frame(ioc, mf);
1460 goto cim_smp_passthru_exit;
1461 @@ -2302,26 +2279,29 @@ csmisas_smp_passthru(unsigned long arg)
1462
1463 ioc->add_sge(psge, flagsLength, response_data_dma);
1464
1465 - if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout) != 0) {
1466 + if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout)
1467 + != 0) {
1468 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1469 goto cim_smp_passthru_exit;
1470 }
1471
1472 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
1473 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": SMP Passthru: oh no, there is no reply!!"));
1474 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1475 + ": SMP Passthru: oh no, there is no reply!!"));
1476 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1477 goto cim_smp_passthru_exit;
1478 }
1479
1480 /* process the completed Reply Message Frame */
1481 - smpReply = (pSmpPassthroughReply_t )ioc->ioctl_cmds.reply;
1482 + smpReply = (pSmpPassthroughReply_t)ioc->ioctl_cmds.reply;
1483 ioc_status = le16_to_cpu(smpReply->IOCStatus) & MPI_IOCSTATUS_MASK;
1484
1485 if ((ioc_status != MPI_IOCSTATUS_SUCCESS) &&
1486 (ioc_status != MPI_IOCSTATUS_SCSI_DATA_UNDERRUN)) {
1487 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1488 dcsmisasprintk(ioc, printk(KERN_DEBUG ": SMP Passthru: "));
1489 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
1490 + dcsmisasprintk(ioc, printk(
1491 + "IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
1492 le16_to_cpu(smpReply->IOCStatus),
1493 le32_to_cpu(smpReply->IOCLogInfo),
1494 smpReply->SASStatus));
1495 @@ -2333,7 +2313,8 @@ csmisas_smp_passthru(unsigned long arg)
1496
1497
1498 if (le16_to_cpu(smpReply->ResponseDataLength)) {
1499 - karg->Parameters.uResponseBytes = le16_to_cpu(smpReply->ResponseDataLength);
1500 + karg->Parameters.uResponseBytes
1501 + = le16_to_cpu(smpReply->ResponseDataLength);
1502 memcpy(&karg->Parameters.Response,
1503 response_data, le16_to_cpu(smpReply->ResponseDataLength));
1504 }
1505 @@ -2355,13 +2336,13 @@ csmisas_smp_passthru(unsigned long arg)
1506 sizeof(CSMI_SAS_SMP_PASSTHRU_BUFFER))) {
1507 printk(KERN_ERR "%s@%d::%s() - "
1508 "Unable to write out csmi_sas_smp_passthru @ %p\n",
1509 - __FILE__, __LINE__, __FUNCTION__, uarg);
1510 + __FILE__, __LINE__, __func__, uarg);
1511 free_pages((unsigned long)karg, memory_pages);
1512 return -EFAULT;
1513 }
1514
1515 free_pages((unsigned long)karg, memory_pages);
1516 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n",__FUNCTION__));
1517 + dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n", __func__));
1518 return 0;
1519 }
1520
1521 @@ -2376,18 +2357,18 @@ csmisas_smp_passthru(unsigned long arg)
1522 static int csmisas_ssp_passthru(unsigned long arg)
1523 {
1524 CSMI_SAS_SSP_PASSTHRU_BUFFER __user *uarg = (void __user *) arg;
1525 - CSMI_SAS_SSP_PASSTHRU_BUFFER karg_hdr, * karg;
1526 + CSMI_SAS_SSP_PASSTHRU_BUFFER karg_hdr, *karg;
1527 MPT_ADAPTER *ioc = NULL;
1528 pSCSIIORequest_t pScsiRequest;
1529 pSCSIIOReply_t pScsiReply;
1530 MPT_FRAME_HDR *mf = NULL;
1531 MPIHeader_t *mpi_hdr;
1532 - int iocnum,ii;
1533 + int iocnum, ii;
1534 u64 sas_address;
1535 u16 req_idx;
1536 char *psge;
1537 int flagsLength;
1538 - void * request_data;
1539 + void *request_data;
1540 dma_addr_t request_data_dma;
1541 u32 request_data_sz;
1542 int malloc_data_sz;
1543 @@ -2402,10 +2383,11 @@ static int csmisas_ssp_passthru(unsigned
1544 u8 skey, asc, ascq;
1545 u32 MsgContext;
1546
1547 - if (copy_from_user(&karg_hdr, uarg, sizeof(CSMI_SAS_SSP_PASSTHRU_BUFFER))) {
1548 + if (copy_from_user(&karg_hdr, uarg,
1549 + sizeof(CSMI_SAS_SSP_PASSTHRU_BUFFER))) {
1550 printk(KERN_ERR "%s@%d::%s() - "
1551 "Unable to read in csmi_sas_ssp_passthru struct @ %p\n",
1552 - __FILE__, __LINE__, __FUNCTION__, uarg);
1553 + __FILE__, __LINE__, __func__, uarg);
1554 return -EFAULT;
1555 }
1556
1557 @@ -2422,11 +2404,11 @@ static int csmisas_ssp_passthru(unsigned
1558 memory_pages = get_order(malloc_data_sz);
1559 karg = (CSMI_SAS_SSP_PASSTHRU_BUFFER *)__get_free_pages(
1560 GFP_KERNEL, memory_pages);
1561 - if (!karg){
1562 + if (!karg) {
1563 printk(KERN_ERR "%s@%d::%s() - "
1564 "Unable to malloc SAS_SSP_PASSTHRU_BUFFER "
1565 "malloc_data_sz=%d memory_pages=%d\n",
1566 - __FILE__, __LINE__, __FUNCTION__,
1567 + __FILE__, __LINE__, __func__,
1568 malloc_data_sz, memory_pages);
1569 return -ENOMEM;
1570 }
1571 @@ -2434,10 +2416,10 @@ static int csmisas_ssp_passthru(unsigned
1572 memset(karg, 0, sizeof(*karg));
1573
1574 if (copy_from_user(karg, uarg, request_data_sz +
1575 - offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER,bDataBuffer))) {
1576 + offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER, bDataBuffer))) {
1577 printk(KERN_ERR "%s@%d::%s() - "
1578 "Unable to read in csmi_sas_ssp_passthru struct @ %p\n",
1579 - __FILE__, __LINE__, __FUNCTION__, uarg);
1580 + __FILE__, __LINE__, __func__, uarg);
1581 free_pages((unsigned long)karg, memory_pages);
1582 return -EFAULT;
1583 }
1584 @@ -2445,40 +2427,43 @@ static int csmisas_ssp_passthru(unsigned
1585 /*
1586 * some checks of the incoming frame
1587 */
1588 - if ( offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER,bDataBuffer) +
1589 + if (offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER, bDataBuffer) +
1590 request_data_sz - sizeof(IOCTL_HEADER) >
1591 - karg->IoctlHeader.Length ) {
1592 - karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
1593 + karg->IoctlHeader.Length) {
1594 + karg->IoctlHeader.ReturnCode
1595 + = CSMI_SAS_STATUS_INVALID_PARAMETER;
1596 dcsmisasprintk(ioc, printk(KERN_ERR
1597 "%s::%s()"
1598 " @%d - expected datalen incorrect!\n",
1599 - __FILE__, __FUNCTION__, __LINE__));
1600 + __FILE__, __func__, __LINE__));
1601 goto cim_ssp_passthru_exit;
1602 }
1603
1604 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
1605 &ioc)) < 0) || (ioc == NULL)) {
1606 - karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
1607 + karg->IoctlHeader.ReturnCode
1608 + = CSMI_SAS_STATUS_INVALID_PARAMETER;
1609 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
1610 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1611 + __FILE__, __func__, __LINE__, iocnum);
1612 goto cim_ssp_passthru_exit;
1613 }
1614
1615 if (ioc->ioc_reset_in_progress) {
1616 printk(KERN_ERR "%s@%d::%s - "
1617 "Busy with IOC Reset \n",
1618 - __FILE__, __LINE__,__FUNCTION__);
1619 + __FILE__, __LINE__, __func__);
1620 return -EBUSY;
1621 }
1622
1623 if (!csmisas_is_this_sas_cntr(ioc)) {
1624 - karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
1625 + karg->IoctlHeader.ReturnCode
1626 + = CSMI_SAS_STATUS_INVALID_PARAMETER;
1627 printk(KERN_ERR "%s::%s()@%d - ioc%d not SAS controller!\n",
1628 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1629 + __FILE__, __func__, __LINE__, iocnum);
1630 goto cim_ssp_passthru_exit;
1631 }
1632
1633 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1634 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1635
1636 /* Default to success.
1637 */
1638 @@ -2492,7 +2477,7 @@ static int csmisas_ssp_passthru(unsigned
1639 dcsmisasprintk(ioc, printk(KERN_ERR
1640 "%s::%s()"
1641 " @%d - incorrect bPhyIdentifier and bPortIdentifier!\n",
1642 - __FILE__, __FUNCTION__, __LINE__));
1643 + __FILE__, __func__, __LINE__));
1644 goto cim_ssp_passthru_exit;
1645 }
1646
1647 @@ -2502,7 +2487,8 @@ static int csmisas_ssp_passthru(unsigned
1648
1649 /* Is the phy in range? */
1650 if (karg->Parameters.bPhyIdentifier >= ioc->num_ports) {
1651 - dcsmisasprintk(ioc, printk(KERN_WARNING ": phyId >= ioc->num_ports (%d %d)\n",
1652 + dcsmisasprintk(ioc, printk(KERN_WARNING
1653 + ": phyId >= ioc->num_ports (%d %d)\n",
1654 karg->Parameters.bPhyIdentifier,
1655 ioc->num_ports));
1656 karg->IoctlHeader.ReturnCode =
1657 @@ -2511,10 +2497,9 @@ static int csmisas_ssp_passthru(unsigned
1658 }
1659 }
1660
1661 - if(karg->Parameters.bAdditionalCDBLength) {
1662 - /* TODO - SCSI IO (32) Request Message support
1663 - */
1664 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": greater than 16-byte cdb "
1665 + if (karg->Parameters.bAdditionalCDBLength) {
1666 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1667 + ": greater than 16-byte cdb "
1668 "is not supported!\n"));
1669 karg->IoctlHeader.ReturnCode =
1670 CSMI_SAS_STATUS_INVALID_PARAMETER;
1671 @@ -2538,7 +2523,7 @@ static int csmisas_ssp_passthru(unsigned
1672 CSMI_SAS_STATUS_INVALID_PARAMETER;
1673 dcsmisasprintk(ioc, printk(KERN_ERR
1674 "%s::%s() @%d - couldn't find associated "
1675 - "SASAddress=%llX!\n", __FILE__, __FUNCTION__, __LINE__,
1676 + "SASAddress=%llX!\n", __FILE__, __func__, __LINE__,
1677 (unsigned long long)sas_address));
1678 goto cim_ssp_passthru_exit;
1679 }
1680 @@ -2558,20 +2543,21 @@ static int csmisas_ssp_passthru(unsigned
1681 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
1682 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1683 goto cim_ssp_passthru_exit;
1684 - }
1685 + }
1686
1687 mpi_hdr = (MPIHeader_t *) mf;
1688 MsgContext = mpi_hdr->MsgContext;
1689 pScsiRequest = (pSCSIIORequest_t) mf;
1690 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
1691
1692 - memset(pScsiRequest,0,sizeof(SCSIIORequest_t));
1693 + memset(pScsiRequest, 0, sizeof(SCSIIORequest_t));
1694
1695 /* Fill in SCSI IO (16) request.
1696 */
1697
1698 pScsiRequest->Function = (is_hidden_raid_component == 1) ?
1699 - MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH : MPI_FUNCTION_SCSI_IO_REQUEST;
1700 + MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH
1701 + : MPI_FUNCTION_SCSI_IO_REQUEST;
1702 pScsiRequest->TargetID = id;
1703 pScsiRequest->Bus = channel;
1704 memcpy(pScsiRequest->LUN, &karg->Parameters.bLun, 8);
1705 @@ -2583,10 +2569,11 @@ static int csmisas_ssp_passthru(unsigned
1706
1707 dcsmisasprintk(ioc, printk(KERN_DEBUG "\tchannel = %d id = %d ",
1708 sas_info->fw.channel, sas_info->fw.id));
1709 - dcsmisasprintk(ioc, if(is_hidden_raid_component)
1710 + dcsmisasprintk(ioc, if (is_hidden_raid_component)
1711 printk(KERN_DEBUG "num_id = %d ", id));
1712 dcsmisasprintk(ioc, printk(KERN_DEBUG "\n"));
1713 - dcsmisasprintk(ioc, printk(KERN_DEBUG "\tcdb_len = %d request_len = %d\n",
1714 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1715 + "\tcdb_len = %d request_len = %d\n",
1716 pScsiRequest->CDBLength, request_data_sz));
1717 dcsmisasprintk(ioc, printk(KERN_DEBUG "\t"));
1718 dcsmisasprintk(ioc, for (ii = 0; ii < pScsiRequest->CDBLength; ++ii)
1719 @@ -2603,7 +2590,8 @@ static int csmisas_ssp_passthru(unsigned
1720 (!karg->Parameters.uDataLength)) {
1721 /* no data transfer
1722 */
1723 - pScsiRequest->Control = cpu_to_le32(MPI_SCSIIO_CONTROL_NODATATRANSFER);
1724 + pScsiRequest->Control
1725 + = cpu_to_le32(MPI_SCSIIO_CONTROL_NODATATRANSFER);
1726 } else {
1727 /* no direction specified
1728 */
1729 @@ -2618,19 +2606,23 @@ static int csmisas_ssp_passthru(unsigned
1730
1731 /* task attributes
1732 */
1733 - if((karg->Parameters.uFlags && 0xFF) == 0) {
1734 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_SIMPLEQ);
1735 + if ((karg->Parameters.uFlags && 0xFF) == 0) {
1736 + pScsiRequest->Control
1737 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_SIMPLEQ);
1738 } else if (karg->Parameters.uFlags &
1739 CSMI_SAS_SSP_TASK_ATTRIBUTE_HEAD_OF_QUEUE) {
1740 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_HEADOFQ);
1741 + pScsiRequest->Control
1742 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_HEADOFQ);
1743 } else if (karg->Parameters.uFlags &
1744 CSMI_SAS_SSP_TASK_ATTRIBUTE_ORDERED) {
1745 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_ORDEREDQ);
1746 + pScsiRequest->Control
1747 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_ORDEREDQ);
1748 } else if (karg->Parameters.uFlags &
1749 CSMI_SAS_SSP_TASK_ATTRIBUTE_ACA) {
1750 pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_ACAQ);
1751 } else {
1752 - pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_UNTAGGED);
1753 + pScsiRequest->Control
1754 + |= cpu_to_le32(MPI_SCSIIO_CONTROL_UNTAGGED);
1755 }
1756
1757 /* setup sense
1758 @@ -2647,19 +2639,20 @@ static int csmisas_ssp_passthru(unsigned
1759 flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE;
1760 } else if (karg->Parameters.uFlags & CSMI_SAS_SSP_READ) {
1761 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ;
1762 - }else {
1763 - flagsLength = ( MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1764 - MPI_SGE_FLAGS_DIRECTION )
1765 + } else {
1766 + flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1767 + MPI_SGE_FLAGS_DIRECTION)
1768 << MPI_SGE_FLAGS_SHIFT;
1769 }
1770 flagsLength |= request_data_sz;
1771
1772 - if ( request_data_sz > 0) {
1773 + if (request_data_sz > 0) {
1774 request_data = pci_alloc_consistent(
1775 ioc->pcidev, request_data_sz, &request_data_dma);
1776
1777 if (request_data == NULL) {
1778 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED "
1779 + dcsmisasprintk(ioc, printk(KERN_ERR
1780 + ": pci_alloc_consistent: FAILED "
1781 "request_data_sz=%d\n", request_data_sz));
1782 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1783 mpt_free_msg_frame(ioc, mf);
1784 @@ -2668,17 +2661,19 @@ static int csmisas_ssp_passthru(unsigned
1785
1786 ioc->add_sge(psge, flagsLength, request_data_dma);
1787 if (karg->Parameters.uFlags & CSMI_SAS_SSP_WRITE)
1788 - memcpy(request_data, karg->bDataBuffer, request_data_sz);
1789 + memcpy(request_data, karg->bDataBuffer,
1790 + request_data_sz);
1791 } else {
1792 ioc->add_sge(psge, flagsLength, (dma_addr_t) -1);
1793 }
1794
1795 - if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout) != 0) {
1796 + if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout)
1797 + != 0) {
1798 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1799 goto cim_ssp_passthru_exit;
1800 }
1801
1802 - memset(&karg->Status,0,sizeof(CSMI_SAS_SSP_PASSTHRU_STATUS));
1803 + memset(&karg->Status, 0, sizeof(CSMI_SAS_SSP_PASSTHRU_STATUS));
1804 karg->Status.bConnectionStatus = CSMI_SAS_OPEN_ACCEPT;
1805 karg->Status.bDataPresent = CSMI_SAS_SSP_NO_DATA_PRESENT;
1806 karg->Status.bStatus = GOOD;
1807 @@ -2689,11 +2684,13 @@ static int csmisas_ssp_passthru(unsigned
1808 /* process the completed Reply Message Frame */
1809 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) {
1810
1811 - pScsiReply = (pSCSIIOReply_t ) ioc->ioctl_cmds.reply;
1812 + pScsiReply = (pSCSIIOReply_t) ioc->ioctl_cmds.reply;
1813 karg->Status.bStatus = pScsiReply->SCSIStatus;
1814 - karg->Status.uDataBytes = min(le32_to_cpu(pScsiReply->TransferCount),
1815 + karg->Status.uDataBytes
1816 + = min(le32_to_cpu(pScsiReply->TransferCount),
1817 request_data_sz);
1818 - ioc_status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
1819 + ioc_status
1820 + = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
1821
1822 if (pScsiReply->SCSIState ==
1823 MPI_SCSI_STATE_AUTOSENSE_VALID) {
1824 @@ -2701,26 +2698,28 @@ static int csmisas_ssp_passthru(unsigned
1825 CSMI_SAS_SSP_SENSE_DATA_PRESENT;
1826 karg->Status.bResponseLength[0] =
1827 (u8)le32_to_cpu(pScsiReply->SenseCount) & 0xFF;
1828 - memcpy(karg->Status.bResponse,
1829 - ioc->ioctl_cmds.sense, le32_to_cpu(pScsiReply->SenseCount));
1830 + memcpy(karg->Status.bResponse, ioc->ioctl_cmds.sense,
1831 + le32_to_cpu(pScsiReply->SenseCount));
1832
1833 skey = ioc->ioctl_cmds.sense[2] & 0x0F;
1834 asc = ioc->ioctl_cmds.sense[12];
1835 ascq = ioc->ioctl_cmds.sense[13];
1836
1837 - dcsmisasprintk(ioc, printk(KERN_DEBUG "\t [sense_key,asc,ascq]: "
1838 - "[0x%02x,0x%02x,0x%02x]\n",
1839 - skey, asc, ascq));
1840 + dcsmisasprintk(ioc, printk(KERN_DEBUG
1841 + "\t [sense_key,asc,ascq]: "
1842 + "[0x%02x,0x%02x,0x%02x]\n",
1843 + skey, asc, ascq));
1844
1845 - } else if(pScsiReply->SCSIState ==
1846 + } else if (pScsiReply->SCSIState ==
1847 MPI_SCSI_STATE_RESPONSE_INFO_VALID) {
1848 karg->Status.bDataPresent =
1849 CSMI_SAS_SSP_RESPONSE_DATA_PRESENT;
1850 karg->Status.bResponseLength[0] =
1851 sizeof(pScsiReply->ResponseInfo);
1852 - for (ii=0;ii<sizeof(pScsiReply->ResponseInfo);ii++) {
1853 + for (ii = 0; ii < sizeof(pScsiReply->ResponseInfo);
1854 + ii++) {
1855 karg->Status.bResponse[ii] =
1856 - ((u8*)&pScsiReply->ResponseInfo)[
1857 + ((u8 *)&pScsiReply->ResponseInfo)[
1858 (sizeof(pScsiReply->ResponseInfo)-1)-ii];
1859 }
1860 } else if ((ioc_status != MPI_IOCSTATUS_SUCCESS) &&
1861 @@ -2728,7 +2727,8 @@ static int csmisas_ssp_passthru(unsigned
1862 (ioc_status != MPI_IOCSTATUS_SCSI_DATA_UNDERRUN)) {
1863 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1864 dcsmisasprintk(ioc, printk(KERN_DEBUG ": SCSI IO : "));
1865 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X\n",
1866 + dcsmisasprintk(ioc,
1867 + printk("IOCStatus=0x%X IOCLogInfo=0x%X\n",
1868 pScsiReply->IOCStatus,
1869 pScsiReply->IOCLogInfo));
1870 }
1871 @@ -2740,8 +2740,8 @@ static int csmisas_ssp_passthru(unsigned
1872 request_data, karg->Status.uDataBytes)) {
1873 printk(KERN_ERR "%s@%d::%s - "
1874 "Unable to write data to user %p\n",
1875 - __FILE__, __LINE__,__FUNCTION__,
1876 - (void*)karg->bDataBuffer);
1877 + __FILE__, __LINE__, __func__,
1878 + (void *)karg->bDataBuffer);
1879 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
1880 }
1881 }
1882 @@ -2759,12 +2759,12 @@ static int csmisas_ssp_passthru(unsigned
1883 offsetof(CSMI_SAS_SSP_PASSTHRU_BUFFER, bDataBuffer))) {
1884 printk(KERN_ERR "%s@%d::%s() - "
1885 "Unable to write out csmi_sas_ssp_passthru @ %p\n",
1886 - __FILE__, __LINE__, __FUNCTION__, uarg);
1887 + __FILE__, __LINE__, __func__, uarg);
1888 free_pages((unsigned long)karg, memory_pages);
1889 return -EFAULT;
1890 }
1891
1892 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
1893 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
1894 free_pages((unsigned long)karg, memory_pages);
1895 return 0;
1896 }
1897 @@ -2793,7 +2793,7 @@ csmisas_stp_passthru(unsigned long arg)
1898 u16 req_idx;
1899 char *psge;
1900 int flagsLength;
1901 - void * request_data;
1902 + void *request_data;
1903 dma_addr_t request_data_dma;
1904 u32 request_data_sz;
1905 int malloc_data_sz;
1906 @@ -2806,14 +2806,15 @@ csmisas_stp_passthru(unsigned long arg)
1907 u16 ioc_status;
1908 u32 MsgContext;
1909
1910 - if (copy_from_user(&karg_hdr, uarg, sizeof(CSMI_SAS_STP_PASSTHRU_BUFFER))) {
1911 + if (copy_from_user(&karg_hdr, uarg,
1912 + sizeof(CSMI_SAS_STP_PASSTHRU_BUFFER))) {
1913 printk(KERN_ERR "%s@%d::%s() - "
1914 "Unable to read struct @ %p\n",
1915 - __FILE__, __LINE__, __FUNCTION__, uarg);
1916 + __FILE__, __LINE__, __func__, uarg);
1917 return -EFAULT;
1918 }
1919
1920 - request_data=NULL;
1921 + request_data = NULL;
1922 request_data_sz = karg_hdr.Parameters.uDataLength;
1923 volume_id = 0;
1924 volume_bus = 0;
1925 @@ -2825,11 +2826,11 @@ csmisas_stp_passthru(unsigned long arg)
1926 memory_pages = get_order(malloc_data_sz);
1927 karg = (CSMI_SAS_STP_PASSTHRU_BUFFER *)__get_free_pages(
1928 GFP_KERNEL, memory_pages);
1929 - if (!karg){
1930 + if (!karg) {
1931 printk(KERN_ERR "%s@%d::%s() - "
1932 "Unable to malloc CSMI_SAS_STP_PASSTHRU_BUFFER "
1933 "malloc_data_sz=%d memory_pages=%d\n",
1934 - __FILE__, __LINE__, __FUNCTION__,
1935 + __FILE__, __LINE__, __func__,
1936 malloc_data_sz, memory_pages);
1937 return -ENOMEM;
1938 }
1939 @@ -2839,7 +2840,7 @@ csmisas_stp_passthru(unsigned long arg)
1940 if (copy_from_user(karg, uarg, malloc_data_sz)) {
1941 printk(KERN_ERR "%s@%d::%s() - "
1942 "Unable to read in csmi_sas_ssp_passthru struct @ %p\n",
1943 - __FILE__, __LINE__, __FUNCTION__, uarg);
1944 + __FILE__, __LINE__, __func__, uarg);
1945 free_pages((unsigned long)karg, memory_pages);
1946 return -EFAULT;
1947 }
1948 @@ -2847,7 +2848,7 @@ csmisas_stp_passthru(unsigned long arg)
1949 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
1950 &ioc)) < 0) || (ioc == NULL)) {
1951 printk(KERN_ERR "%s::%s @%d - ioc%d not found!\n",
1952 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1953 + __FILE__, __func__, __LINE__, iocnum);
1954 free_pages((unsigned long)karg, memory_pages);
1955 return -ENODEV;
1956 }
1957 @@ -2855,19 +2856,19 @@ csmisas_stp_passthru(unsigned long arg)
1958 if (ioc->ioc_reset_in_progress) {
1959 printk(KERN_ERR "%s@%d::%s - "
1960 "Busy with IOC Reset \n",
1961 - __FILE__, __LINE__,__FUNCTION__);
1962 + __FILE__, __LINE__, __func__);
1963 free_pages((unsigned long)karg, memory_pages);
1964 return -EBUSY;
1965 }
1966
1967 if (!csmisas_is_this_sas_cntr(ioc)) {
1968 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
1969 - __FILE__, __FUNCTION__, __LINE__, iocnum);
1970 + __FILE__, __func__, __LINE__, iocnum);
1971 free_pages((unsigned long)karg, memory_pages);
1972 return -ENODEV;
1973 }
1974
1975 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
1976 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
1977
1978 /* Default to success.
1979 */
1980 @@ -2879,8 +2880,9 @@ csmisas_stp_passthru(unsigned long arg)
1981 (karg->Parameters.bPortIdentifier == CSMI_SAS_IGNORE_PORT)) {
1982 karg->IoctlHeader.ReturnCode = CSMI_SAS_SELECT_PHY_OR_PORT;
1983 dcsmisasprintk(ioc, printk(KERN_ERR
1984 - "%s::%s() @%d - incorrect bPhyIdentifier and bPortIdentifier!\n",
1985 - __FILE__,__FUNCTION__, __LINE__));
1986 + "%s::%s() @%d -incorrect bPhyIdentifier"
1987 + " and bPortIdentifier!\n",
1988 + __FILE__, __func__, __LINE__));
1989 goto cim_stp_passthru_exit;
1990 }
1991
1992 @@ -2897,15 +2899,15 @@ csmisas_stp_passthru(unsigned long arg)
1993 }
1994
1995 data_sz = sizeof(CSMI_SAS_STP_PASSTHRU_BUFFER) -
1996 - sizeof(IOCTL_HEADER) - sizeof(u8*) +
1997 + sizeof(IOCTL_HEADER) - sizeof(u8 *) +
1998 request_data_sz;
1999
2000 - if ( data_sz > karg->IoctlHeader.Length ) {
2001 + if (data_sz > karg->IoctlHeader.Length) {
2002 karg->IoctlHeader.ReturnCode =
2003 CSMI_SAS_STATUS_INVALID_PARAMETER;
2004 dcsmisasprintk(ioc, printk(KERN_ERR
2005 "%s::%s() @%d - expected datalen incorrect!\n",
2006 - __FILE__, __FUNCTION__,__LINE__));
2007 + __FILE__, __func__, __LINE__));
2008 goto cim_stp_passthru_exit;
2009 }
2010
2011 @@ -2927,7 +2929,7 @@ csmisas_stp_passthru(unsigned long arg)
2012 CSMI_SAS_STATUS_INVALID_PARAMETER;
2013 dcsmisasprintk(ioc, printk(KERN_ERR
2014 "%s::%s() @%d - couldn't find associated "
2015 - "SASAddress=%llX!\n", __FILE__, __FUNCTION__, __LINE__,
2016 + "SASAddress=%llX!\n", __FILE__, __func__, __LINE__,
2017 (unsigned long long)sas_address));
2018 goto cim_stp_passthru_exit;
2019 }
2020 @@ -2937,8 +2939,8 @@ csmisas_stp_passthru(unsigned long arg)
2021
2022 /* check that this is an STP or SATA target device
2023 */
2024 - if ( !(sas_info->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET ) &&
2025 - !(sas_info->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE )) {
2026 + if (!(sas_info->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET) &&
2027 + !(sas_info->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE)) {
2028 karg->IoctlHeader.ReturnCode =
2029 CSMI_SAS_STATUS_INVALID_PARAMETER;
2030 goto cim_stp_passthru_exit;
2031 @@ -2950,14 +2952,14 @@ csmisas_stp_passthru(unsigned long arg)
2032 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
2033 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2034 goto cim_stp_passthru_exit;
2035 - }
2036 + }
2037
2038 mpi_hdr = (MPIHeader_t *) mf;
2039 MsgContext = mpi_hdr->MsgContext;
2040 pSataRequest = (pSataPassthroughRequest_t) mf;
2041 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
2042
2043 - memset(pSataRequest,0,sizeof(pSataPassthroughRequest_t));
2044 + memset(pSataRequest, 0, sizeof(pSataPassthroughRequest_t));
2045
2046 pSataRequest->TargetID = id;
2047 pSataRequest->Bus = channel;
2048 @@ -2967,16 +2969,16 @@ csmisas_stp_passthru(unsigned long arg)
2049 pSataRequest->MsgContext = MsgContext;
2050 pSataRequest->DataLength = cpu_to_le32(request_data_sz);
2051 pSataRequest->MsgFlags = 0;
2052 - memcpy( pSataRequest->CommandFIS,karg->Parameters.bCommandFIS, 20);
2053 + memcpy(pSataRequest->CommandFIS, karg->Parameters.bCommandFIS, 20);
2054
2055 psge = (char *)&pSataRequest->SGL;
2056 if (karg->Parameters.uFlags & CSMI_SAS_STP_WRITE) {
2057 flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE;
2058 } else if (karg->Parameters.uFlags & CSMI_SAS_STP_READ) {
2059 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ;
2060 - }else {
2061 - flagsLength = ( MPI_SGE_FLAGS_SIMPLE_ELEMENT |
2062 - MPI_SGE_FLAGS_DIRECTION )
2063 + } else {
2064 + flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
2065 + MPI_SGE_FLAGS_DIRECTION)
2066 << MPI_SGE_FLAGS_SHIFT;
2067 }
2068
2069 @@ -2986,7 +2988,8 @@ csmisas_stp_passthru(unsigned long arg)
2070 ioc->pcidev, request_data_sz, &request_data_dma);
2071
2072 if (request_data == NULL) {
2073 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
2074 + dcsmisasprintk(ioc, printk(KERN_ERR
2075 + ": pci_alloc_consistent: FAILED\n"));
2076 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2077 mpt_free_msg_frame(ioc, mf);
2078 goto cim_stp_passthru_exit;
2079 @@ -2994,33 +2997,37 @@ csmisas_stp_passthru(unsigned long arg)
2080
2081 ioc->add_sge(psge, flagsLength, request_data_dma);
2082 if (karg->Parameters.uFlags & CSMI_SAS_SSP_WRITE)
2083 - memcpy(request_data, karg->bDataBuffer, request_data_sz);
2084 + memcpy(request_data, karg->bDataBuffer,
2085 + request_data_sz);
2086 } else {
2087 ioc->add_sge(psge, flagsLength, (dma_addr_t) -1);
2088 }
2089
2090 - if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout) != 0) {
2091 + if (csmisas_send_command_wait(ioc, mf, karg->IoctlHeader.Timeout)
2092 + != 0) {
2093 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2094 goto cim_stp_passthru_exit;
2095 }
2096
2097 - memset(&karg->Status,0,sizeof(CSMI_SAS_STP_PASSTHRU_STATUS));
2098 + memset(&karg->Status, 0, sizeof(CSMI_SAS_STP_PASSTHRU_STATUS));
2099
2100 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
2101 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": STP Passthru: oh no, there is no reply!!"));
2102 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2103 + ": STP Passthru: oh no, there is no reply!!"));
2104 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2105 goto cim_stp_passthru_exit;
2106 }
2107
2108 /* process the completed Reply Message Frame */
2109 - pSataReply = (pSataPassthroughReply_t ) ioc->ioctl_cmds.reply;
2110 + pSataReply = (pSataPassthroughReply_t) ioc->ioctl_cmds.reply;
2111 ioc_status = le16_to_cpu(pSataReply->IOCStatus) & MPI_IOCSTATUS_MASK;
2112
2113 if (ioc_status != MPI_IOCSTATUS_SUCCESS &&
2114 ioc_status != MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) {
2115 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2116 dcsmisasprintk(ioc, printk(KERN_DEBUG ": STP Passthru: "));
2117 - dcsmisasprintk(ioc, printk("IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
2118 + dcsmisasprintk(ioc,
2119 + printk("IOCStatus=0x%X IOCLogInfo=0x%X SASStatus=0x%X\n",
2120 le16_to_cpu(pSataReply->IOCStatus),
2121 le32_to_cpu(pSataReply->IOCLogInfo),
2122 pSataReply->SASStatus));
2123 @@ -3029,26 +3036,27 @@ csmisas_stp_passthru(unsigned long arg)
2124 karg->Status.bConnectionStatus =
2125 map_sas_status_to_csmi(pSataReply->SASStatus);
2126
2127 - memcpy(karg->Status.bStatusFIS,pSataReply->StatusFIS, 20);
2128 + memcpy(karg->Status.bStatusFIS, pSataReply->StatusFIS, 20);
2129
2130 /*
2131 * for now, just zero out uSCR array,
2132 * then copy the one dword returned
2133 * in the reply frame into uSCR[0]
2134 */
2135 - memset( karg->Status.uSCR, 0, 64);
2136 + memset(karg->Status.uSCR, 0, 64);
2137 karg->Status.uSCR[0] = le32_to_cpu(pSataReply->StatusControlRegisters);
2138
2139 - if((le32_to_cpu(pSataReply->TransferCount)) && (request_data) &&
2140 + if ((le32_to_cpu(pSataReply->TransferCount)) && (request_data) &&
2141 (karg->Parameters.uFlags & CSMI_SAS_STP_READ)) {
2142 karg->Status.uDataBytes =
2143 - min(le32_to_cpu(pSataReply->TransferCount),request_data_sz);
2144 + min(le32_to_cpu(pSataReply->TransferCount),
2145 + request_data_sz);
2146 if (copy_to_user((void __user *)uarg->bDataBuffer,
2147 request_data, karg->Status.uDataBytes)) {
2148 printk(KERN_ERR "%s::%s() @%d - "
2149 "Unable to write data to user %p\n",
2150 - __FILE__, __FUNCTION__, __LINE__,
2151 - (void*)karg->bDataBuffer);
2152 + __FILE__, __func__, __LINE__,
2153 + (void *)karg->bDataBuffer);
2154 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2155 }
2156 }
2157 @@ -3065,13 +3073,13 @@ csmisas_stp_passthru(unsigned long arg)
2158 offsetof(CSMI_SAS_STP_PASSTHRU_BUFFER, bDataBuffer))) {
2159 printk(KERN_ERR "%s@%d::%s() - "
2160 "Unable to write out csmi_sas_ssp_passthru @ %p\n",
2161 - __FILE__, __LINE__, __FUNCTION__, uarg);
2162 + __FILE__, __LINE__, __func__, uarg);
2163 free_pages((unsigned long)karg, memory_pages);
2164 return -EFAULT;
2165 }
2166
2167 free_pages((unsigned long)karg, memory_pages);
2168 - dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n",__FUNCTION__));
2169 + dcsmisasprintk(ioc, printk(KERN_DEBUG ": %s exit.\n", __func__));
2170 return 0;
2171 }
2172
2173 @@ -3090,30 +3098,30 @@ csmisas_firmware_download(unsigned long
2174 CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER karg;
2175 MPT_ADAPTER *ioc = NULL;
2176 int iocnum;
2177 - pMpiFwHeader_t pFwHeader=NULL;
2178 + pMpiFwHeader_t pFwHeader = NULL;
2179
2180 if (copy_from_user(&karg, uarg,
2181 sizeof(CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER))) {
2182 printk(KERN_ERR "%s@%d::%s() - "
2183 - "Unable to read in csmi_sas_firmware_download struct @ %p\n",
2184 - __FILE__, __LINE__, __FUNCTION__, uarg);
2185 + "Unable to read in csmi_sas_firmware_download struct@ %p\n",
2186 + __FILE__, __LINE__, __func__, uarg);
2187 return -EFAULT;
2188 }
2189
2190 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
2191 &ioc)) < 0) || (ioc == NULL)) {
2192 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2193 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2194 + __FILE__, __func__, __LINE__, iocnum);
2195 return -ENODEV;
2196 }
2197
2198 if (!csmisas_is_this_sas_cntr(ioc)) {
2199 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2200 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2201 + __FILE__, __func__, __LINE__, iocnum);
2202 return -ENODEV;
2203 }
2204
2205 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2206 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2207
2208 /* Default to success.*/
2209 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
2210 @@ -3130,7 +3138,7 @@ csmisas_firmware_download(unsigned long
2211 goto cim_firmware_download_exit;
2212 }
2213
2214 - if ( karg.Information.uDownloadFlags &
2215 + if (karg.Information.uDownloadFlags &
2216 (CSMI_SAS_FWD_SOFT_RESET | CSMI_SAS_FWD_VALIDATE)) {
2217 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2218 karg.Information.usStatus = CSMI_SAS_FWD_REJECT;
2219 @@ -3142,7 +3150,7 @@ csmisas_firmware_download(unsigned long
2220 * fw image attached to end of incoming packet.
2221 */
2222 pFwHeader = kmalloc(karg.Information.uBufferLength, GFP_KERNEL);
2223 - if (!pFwHeader){
2224 + if (!pFwHeader) {
2225 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2226 karg.Information.usStatus = CSMI_SAS_FWD_REJECT;
2227 karg.Information.usSeverity = CSMI_SAS_FWD_ERROR;
2228 @@ -3154,21 +3162,21 @@ csmisas_firmware_download(unsigned long
2229 karg.Information.uBufferLength)) {
2230 printk(KERN_ERR "%s@%d::%s() - "
2231 "Unable to read in pFwHeader @ %p\n",
2232 - __FILE__, __LINE__, __FUNCTION__, uarg);
2233 + __FILE__, __LINE__, __func__, uarg);
2234 return -EFAULT;
2235 }
2236
2237 - if ( !((pFwHeader->Signature0 == MPI_FW_HEADER_SIGNATURE_0) &&
2238 + if (!((pFwHeader->Signature0 == MPI_FW_HEADER_SIGNATURE_0) &&
2239 (pFwHeader->Signature1 == MPI_FW_HEADER_SIGNATURE_1) &&
2240 (pFwHeader->Signature2 == MPI_FW_HEADER_SIGNATURE_2))) {
2241 - // the signature check failed
2242 + /* the signature check failed */
2243 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2244 karg.Information.usStatus = CSMI_SAS_FWD_REJECT;
2245 karg.Information.usSeverity = CSMI_SAS_FWD_ERROR;
2246 goto cim_firmware_download_exit;
2247 }
2248
2249 - if ( mptctl_do_fw_download(karg.IoctlHeader.IOControllerNumber,
2250 + if (mptctl_do_fw_download(karg.IoctlHeader.IOControllerNumber,
2251 uarg->bDataBuffer, karg.Information.uBufferLength)
2252 != 0) {
2253 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2254 @@ -3177,7 +3185,7 @@ csmisas_firmware_download(unsigned long
2255 goto cim_firmware_download_exit;
2256 }
2257
2258 - if((karg.Information.uDownloadFlags & CSMI_SAS_FWD_SOFT_RESET) ||
2259 + if ((karg.Information.uDownloadFlags & CSMI_SAS_FWD_SOFT_RESET) ||
2260 (karg.Information.uDownloadFlags & CSMI_SAS_FWD_HARD_RESET)) {
2261 if (mpt_HardResetHandler(ioc, CAN_SLEEP) != 0) {
2262 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2263 @@ -3188,7 +3196,7 @@ csmisas_firmware_download(unsigned long
2264
2265 cim_firmware_download_exit:
2266
2267 - if(pFwHeader)
2268 + if (pFwHeader)
2269 kfree(pFwHeader);
2270
2271 /* Copy the data from kernel memory to user memory
2272 @@ -3197,11 +3205,11 @@ csmisas_firmware_download(unsigned long
2273 sizeof(CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER))) {
2274 printk(KERN_ERR "%s@%d::%s() - "
2275 "Unable to write out csmi_sas_firmware_download @ %p\n",
2276 - __FILE__, __LINE__, __FUNCTION__, uarg);
2277 + __FILE__, __LINE__, __func__, uarg);
2278 return -EFAULT;
2279 }
2280
2281 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2282 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2283 return 0;
2284 }
2285
2286 @@ -3227,24 +3235,24 @@ csmisas_get_raid_info(unsigned long arg)
2287 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_RAID_INFO_BUFFER))) {
2288 printk(KERN_ERR "%s@%d::%s() - "
2289 "Unable to read in csmi_sas_get_raid_info struct @ %p\n",
2290 - __FILE__, __LINE__, __FUNCTION__, uarg);
2291 + __FILE__, __LINE__, __func__, uarg);
2292 return -EFAULT;
2293 }
2294
2295 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
2296 &ioc)) < 0) || (ioc == NULL)) {
2297 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2298 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2299 + __FILE__, __func__, __LINE__, iocnum);
2300 return -ENODEV;
2301 }
2302
2303 if (!csmisas_is_this_sas_cntr(ioc)) {
2304 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2305 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2306 + __FILE__, __func__, __LINE__, iocnum);
2307 return -ENODEV;
2308 }
2309
2310 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2311 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2312
2313 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2314 if (!ioc->raid_data.pIocPg2)
2315 @@ -3252,8 +3260,8 @@ csmisas_get_raid_info(unsigned long arg)
2316 karg.Information.uNumRaidSets =
2317 ioc->raid_data.pIocPg2->NumActiveVolumes;
2318 karg.Information.uMaxRaidSets = ioc->raid_data.pIocPg2->MaxVolumes;
2319 - if( ioc->raid_data.pIocPg6 ) {
2320 - // get absolute maximum for all RAID sets
2321 + if (ioc->raid_data.pIocPg6) {
2322 + /* get absolute maximum for all RAID sets */
2323 maxDrivesPerSet = ioc->raid_data.pIocPg6->MaxDrivesIS;
2324 maxDrivesPerSet = max(ioc->raid_data.pIocPg6->MaxDrivesIM,
2325 maxDrivesPerSet);
2326 @@ -3263,17 +3271,19 @@ csmisas_get_raid_info(unsigned long arg)
2327 }
2328 else
2329 karg.Information.uMaxDrivesPerSet = 8;
2330 - // For bMaxRaidSets, count bits set in bits 0-6 of CapabilitiesFlags
2331 + /* For bMaxRaidSets, count bits set in bits 0-6 of CapabilitiesFlags */
2332 raidFlags = ioc->raid_data.pIocPg2->CapabilitiesFlags & 0x0000007F;
2333 - for( maxRaidTypes=0; raidFlags; maxRaidTypes++ )
2334 + for (maxRaidTypes = 0; raidFlags; maxRaidTypes++)
2335 raidFlags &= raidFlags - 1;
2336 karg.Information.bMaxRaidTypes = maxRaidTypes;
2337 - // ulMinRaidSetBlocks hard coded to 1MB until available from config page
2338 + /* ulMinRaidSetBlocks hard coded to 1MB until available
2339 + * from config page
2340 + */
2341 karg.Information.ulMinRaidSetBlocks.uLowPart = 2048;
2342 karg.Information.ulMinRaidSetBlocks.uHighPart = 0;
2343 karg.Information.ulMaxRaidSetBlocks.uLowPart = 0xffffffff;
2344 - if( ioc->raid_data.pIocPg2->CapabilitiesFlags &
2345 - MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING )
2346 + if (ioc->raid_data.pIocPg2->CapabilitiesFlags &
2347 + MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING)
2348 karg.Information.ulMaxRaidSetBlocks.uHighPart = 0xffffffff;
2349 else
2350 karg.Information.ulMaxRaidSetBlocks.uHighPart = 0;
2351 @@ -3293,11 +3303,11 @@ csmisas_get_raid_info_out:
2352 sizeof(CSMI_SAS_RAID_INFO_BUFFER))) {
2353 printk(KERN_ERR "%s@%d::%s() - "
2354 "Unable to write out csmi_sas_get_raid_info @ %p\n",
2355 - __FILE__, __LINE__, __FUNCTION__, uarg);
2356 + __FILE__, __LINE__, __func__, uarg);
2357 return -EFAULT;
2358 }
2359
2360 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2361 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2362 return 0;
2363 }
2364
2365 @@ -3315,7 +3325,8 @@ csmisas_get_raid_info_out:
2366 * Remark: Wait to return until reply processed by the ISR.
2367 **/
2368 static int
2369 -csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum, u8 VolumeBus, u8 VolumeId, pMpiRaidActionReply_t reply)
2370 +csmisas_do_raid(MPT_ADAPTER *ioc, u8 action, u8 PhysDiskNum, u8 VolumeBus,
2371 + u8 VolumeId, pMpiRaidActionReply_t reply)
2372 {
2373 MpiRaidActionRequest_t *pReq;
2374 MpiRaidActionReply_t *pReply;
2375 @@ -3338,7 +3349,6 @@ csmisas_do_raid(MPT_ADAPTER *ioc, u8 act
2376 pReq->MsgFlags = 0;
2377 pReq->Reserved2 = 0;
2378 pReq->ActionDataWord = 0; /* Reserved for this action */
2379 - //pReq->ActionDataSGE = 0;
2380
2381 ioc->add_sge((char *)&pReq->ActionDataSGE,
2382 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
2383 @@ -3347,7 +3357,7 @@ csmisas_do_raid(MPT_ADAPTER *ioc, u8 act
2384 return -ENODATA;
2385
2386 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) &&
2387 - (reply != NULL)){
2388 + (reply != NULL)) {
2389 pReply = (MpiRaidActionReply_t *)&(ioc->ioctl_cmds.reply);
2390 memcpy(reply, pReply,
2391 min(ioc->reply_sz,
2392 @@ -3371,7 +3381,7 @@ csmisas_do_raid(MPT_ADAPTER *ioc, u8 act
2393 **/
2394 static int
2395 csmisas_raid_inq(MPT_ADAPTER *ioc, u8 opcode, u8 bus, u8 id, u8 inq_vpd_page,
2396 - u8 * inq_vpd, u32 inq_vpd_sz)
2397 + u8 *inq_vpd, u32 inq_vpd_sz)
2398 {
2399 MPT_FRAME_HDR *mf = NULL;
2400 MPIHeader_t *mpi_hdr;
2401 @@ -3379,7 +3389,7 @@ csmisas_raid_inq(MPT_ADAPTER *ioc, u8 op
2402 u16 req_idx;
2403 char *psge;
2404 u8 inq_vpd_cdb[6];
2405 - u8 *request_data=NULL;
2406 + u8 *request_data = NULL;
2407 dma_addr_t request_data_dma;
2408 u32 request_data_sz;
2409 int rc = 0;
2410 @@ -3409,14 +3419,14 @@ csmisas_raid_inq(MPT_ADAPTER *ioc, u8 op
2411 pScsiRequest = (pSCSIIORequest_t) mf;
2412 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
2413
2414 - memset(pScsiRequest,0,sizeof(SCSIIORequest_t));
2415 + memset(pScsiRequest, 0, sizeof(SCSIIORequest_t));
2416 pScsiRequest->Function = opcode;
2417 pScsiRequest->TargetID = id;
2418 pScsiRequest->Bus = bus;
2419 pScsiRequest->CDBLength = 6;
2420 pScsiRequest->DataLength = cpu_to_le32(request_data_sz);
2421 pScsiRequest->MsgContext = MsgContext;
2422 - memcpy(pScsiRequest->CDB,inq_vpd_cdb,pScsiRequest->CDBLength);
2423 + memcpy(pScsiRequest->CDB, inq_vpd_cdb, pScsiRequest->CDBLength);
2424 pScsiRequest->Control = cpu_to_le32(MPI_SCSIIO_CONTROL_READ);
2425 pScsiRequest->Control |= cpu_to_le32(MPI_SCSIIO_CONTROL_SIMPLEQ);
2426 pScsiRequest->MsgFlags &= ~MPI_SCSIIO_MSGFLGS_SENSE_WIDTH;
2427 @@ -3434,17 +3444,18 @@ csmisas_raid_inq(MPT_ADAPTER *ioc, u8 op
2428
2429 if (request_data == NULL) {
2430 mpt_free_msg_frame(ioc, mf);
2431 - rc=-1;
2432 + rc = -1;
2433 goto csmisas_raid_inq_exit;
2434 }
2435
2436 - memset(request_data,0,request_data_sz);
2437 + memset(request_data, 0, request_data_sz);
2438 psge = (char *)&pScsiRequest->SGL;
2439 ioc->add_sge(psge, (MPT_SGE_FLAGS_SSIMPLE_READ | 0xFC) ,
2440 request_data_dma);
2441
2442 - if (csmisas_send_command_wait(ioc, mf, MPT_IOCTL_DEFAULT_TIMEOUT) != 0) {
2443 - rc=-1;
2444 + if (csmisas_send_command_wait(ioc, mf, MPT_IOCTL_DEFAULT_TIMEOUT)
2445 + != 0) {
2446 + rc = -1;
2447 goto csmisas_raid_inq_exit;
2448 }
2449
2450 @@ -3472,7 +3483,7 @@ static int
2451 csmisas_get_raid_config(unsigned long arg)
2452 {
2453 CSMI_SAS_RAID_CONFIG_BUFFER __user *uarg = (void __user *) arg;
2454 - CSMI_SAS_RAID_CONFIG_BUFFER karg,*pKarg=NULL;
2455 + CSMI_SAS_RAID_CONFIG_BUFFER karg, *pKarg = NULL;
2456 CONFIGPARMS cfg;
2457 ConfigPageHeader_t header;
2458 MPT_ADAPTER *ioc = NULL;
2459 @@ -3498,7 +3509,7 @@ csmisas_get_raid_config(unsigned long ar
2460 if (copy_from_user(&karg, uarg, sizeof(IOCTL_HEADER))) {
2461 printk(KERN_ERR "%s@%d::%s() - "
2462 "Unable to read in csmisas_get_raid_config struct @ %p\n",
2463 - __FILE__, __LINE__, __FUNCTION__, uarg);
2464 + __FILE__, __LINE__, __func__, uarg);
2465 return -EFAULT;
2466 }
2467
2468 @@ -3506,11 +3517,11 @@ csmisas_get_raid_config(unsigned long ar
2469 memory_pages = get_order(csmi_sas_raid_config_buffer_sz);
2470 pKarg = (CSMI_SAS_RAID_CONFIG_BUFFER *)__get_free_pages(
2471 GFP_KERNEL, memory_pages);
2472 - if (!pKarg){
2473 + if (!pKarg) {
2474 printk(KERN_ERR "%s@%d::%s() - "
2475 "Unable to malloc RAID_CONFIG_BUFFER "
2476 "csmi_sas_raid_config_buffer_sz=%d memory_pages=%d\n",
2477 - __FILE__, __LINE__, __FUNCTION__,
2478 + __FILE__, __LINE__, __func__,
2479 csmi_sas_raid_config_buffer_sz, memory_pages);
2480 return -ENOMEM;
2481 }
2482 @@ -3519,7 +3530,7 @@ csmisas_get_raid_config(unsigned long ar
2483 if (copy_from_user(pKarg, uarg, csmi_sas_raid_config_buffer_sz)) {
2484 printk(KERN_ERR "%s@%d::%s() - "
2485 "Unable to read in csmisas_get_raid_config struct @ %p\n",
2486 - __FILE__, __LINE__, __FUNCTION__, uarg);
2487 + __FILE__, __LINE__, __func__, uarg);
2488 free_pages((unsigned long)pKarg, memory_pages);
2489 return -EFAULT;
2490 }
2491 @@ -3527,22 +3538,22 @@ csmisas_get_raid_config(unsigned long ar
2492 if (((iocnum = mpt_verify_adapter(pKarg->IoctlHeader.IOControllerNumber,
2493 &ioc)) < 0) || (ioc == NULL)) {
2494 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2495 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2496 + __FILE__, __func__, __LINE__, iocnum);
2497 free_pages((unsigned long)pKarg, memory_pages);
2498 return -ENODEV;
2499 }
2500
2501 if (!csmisas_is_this_sas_cntr(ioc)) {
2502 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2503 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2504 + __FILE__, __func__, __LINE__, iocnum);
2505 free_pages((unsigned long)pKarg, memory_pages);
2506 return -ENODEV;
2507 }
2508
2509 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2510 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2511
2512 if (pKarg->Configuration.uChangeCount != 0 &&
2513 - pKarg->Configuration.uChangeCount != ioc->csmi_change_count ) {
2514 + pKarg->Configuration.uChangeCount != ioc->csmi_change_count) {
2515 pKarg->IoctlHeader.ReturnCode =
2516 CSMI_SAS_STATUS_INVALID_PARAMETER;
2517 pKarg->Configuration.uFailureCode =
2518 @@ -3615,7 +3626,7 @@ csmisas_get_raid_config(unsigned long ar
2519 pKarg->Configuration.uStripeSize =
2520 le32_to_cpu(pVolume0->StripeSize)/2;
2521
2522 - switch(pVolume0->VolumeType) {
2523 + switch (pVolume0->VolumeType) {
2524 case MPI_RAID_VOL_TYPE_IS:
2525 pKarg->Configuration.bRaidType = CSMI_SAS_RAID_TYPE_0;
2526 break;
2527 @@ -3636,7 +3647,8 @@ csmisas_get_raid_config(unsigned long ar
2528 break;
2529 case MPI_RAIDVOL0_STATUS_STATE_DEGRADED:
2530 /* Volume is degraded, check if Resyncing or Inactive */
2531 - pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_DEGRADED;
2532 + pKarg->Configuration.bStatus
2533 + = CSMI_SAS_RAID_SET_STATUS_DEGRADED;
2534 break;
2535 case MPI_RAIDVOL0_STATUS_STATE_FAILED:
2536 pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_FAILED;
2537 @@ -3649,25 +3661,26 @@ csmisas_get_raid_config(unsigned long ar
2538 pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_OFFLINE;
2539 else if (pVolume0->VolumeStatus.Flags &
2540 MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS)
2541 - pKarg->Configuration.bStatus = CSMI_SAS_RAID_SET_STATUS_REBUILDING;
2542 + pKarg->Configuration.bStatus
2543 + = CSMI_SAS_RAID_SET_STATUS_REBUILDING;
2544
2545 pKarg->Configuration.bInformation = 0; /* default */
2546 - if(pVolume0->VolumeStatus.Flags &
2547 - MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS ) {
2548 + if (pVolume0->VolumeStatus.Flags &
2549 + MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) {
2550
2551 - uint64_t * ptrUint64;
2552 + uint64_t *ptrUint64;
2553 uint64_t totalBlocks64, blocksRemaining64;
2554 uint32_t totalBlocks32, blocksRemaining32;
2555
2556 /* get percentage complete */
2557 - pRaidActionReply = kmalloc( sizeof(MPI_RAID_VOL_INDICATOR) +
2558 - offsetof(MSG_RAID_ACTION_REPLY,ActionData),
2559 + pRaidActionReply = kmalloc(sizeof(MPI_RAID_VOL_INDICATOR) +
2560 + offsetof(MSG_RAID_ACTION_REPLY, ActionData),
2561 GFP_KERNEL);
2562
2563 - if (!pRaidActionReply){
2564 + if (!pRaidActionReply) {
2565 printk(KERN_ERR "%s@%d::%s() - "
2566 "Unable to malloc @ %p\n",
2567 - __FILE__, __LINE__, __FUNCTION__,pKarg);
2568 + __FILE__, __LINE__, __func__, pKarg);
2569 goto cim_get_raid_config_exit;
2570 }
2571 memset(pRaidActionReply, 0, sizeof(*pRaidActionReply));
2572 @@ -3680,14 +3693,14 @@ csmisas_get_raid_config(unsigned long ar
2573 totalBlocks64 = *ptrUint64;
2574 ptrUint64++;
2575 blocksRemaining64 = *ptrUint64;
2576 - while(totalBlocks64 > 0xFFFFFFFFUL){
2577 + while (totalBlocks64 > 0xFFFFFFFFUL) {
2578 totalBlocks64 = totalBlocks64 >> 1;
2579 blocksRemaining64 = blocksRemaining64 >> 1;
2580 }
2581 totalBlocks32 = (uint32_t)totalBlocks64;
2582 blocksRemaining32 = (uint32_t)blocksRemaining64;
2583
2584 - if(totalBlocks32)
2585 + if (totalBlocks32)
2586 pKarg->Configuration.bInformation =
2587 (totalBlocks32 - blocksRemaining32) /
2588 (totalBlocks32 / 100);
2589 @@ -3713,15 +3726,14 @@ csmisas_get_raid_config(unsigned long ar
2590 pKarg->Configuration.Data->ulRaidSetBlocks.uHighPart =
2591 le32_to_cpu(pVolume0->MaxLBAHigh);
2592 if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IS ||
2593 - pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME ) {
2594 + pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME) {
2595 pKarg->Configuration.Data->uStripeSizeInBlocks =
2596 le32_to_cpu(pVolume0->StripeSize);
2597 } else {
2598 pKarg->Configuration.Data->uStripeSizeInBlocks = 0;
2599 }
2600 pKarg->Configuration.Data->uSectorsPerTrack = 128;
2601 - for (i=0; i<16; i++) {
2602 - // unsupported
2603 + for (i = 0; i < 16; i++) {
2604 pKarg->Configuration.Data->bApplicationScratchPad[i] =
2605 0xFF;
2606 }
2607 @@ -3732,15 +3744,15 @@ csmisas_get_raid_config(unsigned long ar
2608 (pKarg->Configuration.Data->uNumberOfHeads *
2609 pKarg->Configuration.Data->uSectorsPerTrack));
2610 pKarg->Configuration.Data->uNumberOfTracks = tmpTotalMaxLBA;
2611 - } else if ( pKarg->Configuration.bDataType ==
2612 - CSMI_SAS_RAID_DATA_DEVICE_ID ) {
2613 + } else if (pKarg->Configuration.bDataType ==
2614 + CSMI_SAS_RAID_DATA_DEVICE_ID) {
2615 /* Send inquiry to get VPD Page 0x83 */
2616 u32 vpd_page_sz;
2617 vpd_page_sz = csmi_sas_raid_config_buffer_sz -
2618 - offsetof(CSMI_SAS_RAID_CONFIG,DeviceId);
2619 + offsetof(CSMI_SAS_RAID_CONFIG, DeviceId);
2620 if (csmisas_raid_inq(ioc, MPI_FUNCTION_SCSI_IO_REQUEST,
2621 VolumeBus, volumeID, 0x83,
2622 - (u8*)&pKarg->Configuration.DeviceId->bDeviceIdentificationVPDPage,
2623 + (u8 *)&pKarg->Configuration.DeviceId->bDeviceIdentificationVPDPage,
2624 vpd_page_sz) != 0) {
2625 pKarg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2626 goto cim_get_raid_config_exit;
2627 @@ -3773,7 +3785,7 @@ csmisas_get_raid_config(unsigned long ar
2628 pIocPage5 = pci_alloc_consistent(ioc->pcidev,
2629 ioc_page5_sz,
2630 &ioc_page5_dma);
2631 - memset(pIocPage5,0,ioc_page5_sz);
2632 + memset(pIocPage5, 0, ioc_page5_sz);
2633 if (ioc_page5_dma) {
2634 cfg.physAddr = ioc_page5_dma;
2635 cfg.action =
2636 @@ -3816,52 +3828,55 @@ csmisas_get_raid_config(unsigned long ar
2637 cfg.physAddr = physdisk0_dma;
2638
2639 physDiskNumMax = (csmi_sas_raid_config_buffer_sz -
2640 - offsetof(CSMI_SAS_RAID_CONFIG,Drives))
2641 + offsetof(CSMI_SAS_RAID_CONFIG, Drives))
2642 / sizeof(CSMI_SAS_RAID_DRIVES);
2643
2644 tmpTotalMaxLBA = totalMaxLBA;
2645 if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IS) {
2646 do_div(tmpTotalMaxLBA, pVolume0->NumPhysDisks);
2647 - dcsmisasprintk(ioc, printk(KERN_DEBUG "IS Volume tmpTotalMaxLBA=%llX\n",
2648 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2649 + "IS Volume tmpTotalMaxLBA=%llX\n",
2650 (unsigned long long)tmpTotalMaxLBA));
2651 - }
2652 - else if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME) {
2653 + } else if (pVolume0->VolumeType == MPI_RAID_VOL_TYPE_IME) {
2654 do_div(tmpTotalMaxLBA, pVolume0->NumPhysDisks * 2);
2655 - dcsmisasprintk(ioc, printk(KERN_DEBUG "IME Volume tmpTotalMaxLBA=%llX\n",
2656 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2657 + "IME Volume tmpTotalMaxLBA=%llX\n",
2658 (unsigned long long)tmpTotalMaxLBA));
2659 } else {
2660 - dcsmisasprintk(ioc, printk(KERN_DEBUG "IM Volume tmpTotalMaxLBA=%llX\n",
2661 + dcsmisasprintk(ioc, printk(KERN_DEBUG
2662 + "IM Volume tmpTotalMaxLBA=%llX\n",
2663 (unsigned long long)tmpTotalMaxLBA));
2664 }
2665
2666 - for (i=0; i< min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
2667 + for (i = 0; i < min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
2668
2669 physDiskNum = pVolume0->PhysDisk[i].PhysDiskNum;
2670 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
2671 cfg.pageAddr = physDiskNum;
2672 - if (mpt_config(ioc, &cfg) != 0){
2673 + if (mpt_config(ioc, &cfg) != 0) {
2674 pKarg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
2675 goto cim_get_raid_config_exit;
2676 }
2677
2678 - pKarg->Configuration.bDriveCount++;
2679 + pKarg->Configuration.bDriveCount++;
2680 if (pKarg->Configuration.bDataType != CSMI_SAS_RAID_DATA_DRIVES)
2681 continue;
2682
2683 /* Search the list for the matching SAS address. */
2684 - sas_info = csmisas_get_device_component_by_fw(ioc, pPhysDisk0->PhysDiskBus,
2685 - pPhysDisk0->PhysDiskID);
2686 + sas_info = csmisas_get_device_component_by_fw(ioc,
2687 + pPhysDisk0->PhysDiskBus, pPhysDisk0->PhysDiskID);
2688 if (sas_info) {
2689 - sas_address = reverse_byte_order64(sas_info->sas_address);
2690 + sas_address
2691 + = reverse_byte_order64(sas_info->sas_address);
2692 memcpy(pKarg->Configuration.Drives[i].bSASAddress,
2693 - &sas_address,sizeof(u64));
2694 + &sas_address, sizeof(u64));
2695 if (!device_info)
2696 device_info = sas_info->device_info;
2697 }
2698
2699 memcpy(pKarg->Configuration.Drives[i].bModel,
2700 pPhysDisk0->InquiryData.VendorID,
2701 - offsetof(RAID_PHYS_DISK0_INQUIRY_DATA,ProductRevLevel));
2702 + offsetof(RAID_PHYS_DISK0_INQUIRY_DATA, ProductRevLevel));
2703 memcpy(pKarg->Configuration.Drives[i].bFirmware,
2704 pPhysDisk0->InquiryData.ProductRevLevel,
2705 sizeof(pPhysDisk0->InquiryData.ProductRevLevel));
2706 @@ -3890,19 +3905,19 @@ csmisas_get_raid_config(unsigned long ar
2707 MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED) {
2708 pKarg->Configuration.Drives[i].bDriveStatus =
2709 CSMI_SAS_DRIVE_STATUS_OFFLINE;
2710 - } else if(pPhysDisk0->PhysDiskStatus.State) {
2711 + } else if (pPhysDisk0->PhysDiskStatus.State) {
2712 pKarg->Configuration.Drives[i].bDriveStatus =
2713 CSMI_SAS_DRIVE_STATUS_FAILED;
2714 - if(pKarg->Configuration.bStatus ==
2715 + if (pKarg->Configuration.bStatus ==
2716 CSMI_SAS_RAID_SET_STATUS_DEGRADED)
2717 pKarg->Configuration.bInformation = i;
2718 - } else if((pVolume0->VolumeStatus.Flags &
2719 + } else if ((pVolume0->VolumeStatus.Flags &
2720 MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) &&
2721 (pPhysDisk0->PhysDiskStatus.Flags &
2722 MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC))
2723 pKarg->Configuration.Drives[i].bDriveStatus =
2724 CSMI_SAS_DRIVE_STATUS_REBUILDING;
2725 - else if(pPhysDisk0->ErrorData.SmartCount ||
2726 + else if (pPhysDisk0->ErrorData.SmartCount ||
2727 (pPhysDisk0->PhysDiskStatus.Flags &
2728 MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC))
2729 pKarg->Configuration.Drives[i].bDriveStatus =
2730 @@ -3918,7 +3933,7 @@ csmisas_get_raid_config(unsigned long ar
2731 CSMI_SAS_DRIVE_TYPE_SINGLE_PORT_SAS;
2732 if (mpt_raid_phys_disk_get_num_paths(ioc,
2733 pVolume0->PhysDisk[i].PhysDiskNum) > 1)
2734 - pKarg->Configuration.Drives[i].bDriveType =
2735 + pKarg->Configuration.Drives[i].bDriveType =
2736 CSMI_SAS_DRIVE_TYPE_DUAL_PORT_SAS;
2737 }
2738
2739 @@ -3941,9 +3956,9 @@ csmisas_get_raid_config(unsigned long ar
2740 if ((pVolume0->VolumeSettings.HotSparePool &
2741 pIocPage5->HotSpare[idx].HotSparePool) == 0)
2742 continue;
2743 - if(pIocPage5->HotSpare[idx].Flags !=
2744 + if (pIocPage5->HotSpare[idx].Flags !=
2745 MPI_IOC_PAGE_5_HOT_SPARE_ACTIVE)
2746 - continue;
2747 + continue;
2748 physDiskNum = pIocPage5->HotSpare[idx].PhysDiskNum;
2749 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
2750 cfg.pageAddr = physDiskNum;
2751 @@ -3981,11 +3996,11 @@ csmisas_get_raid_config(unsigned long ar
2752 MPI_RAID_VOL_TYPE_IME) &&
2753 (((totalMaxLBA +
2754 pVolume0->NumPhysDisks) * 2) +
2755 - (64*2*1024 ) /*metadata = 64MB*/ >
2756 + (64*2*1024) /*metadata = 64MB*/ >
2757 le32_to_cpu(pPhysDisk0->MaxLBA)))
2758 continue;
2759
2760 - pKarg->Configuration.bDriveCount++;
2761 + pKarg->Configuration.bDriveCount++;
2762 if (pKarg->Configuration.bDataType !=
2763 CSMI_SAS_RAID_DATA_DRIVES) {
2764 i++;
2765 @@ -3996,14 +4011,16 @@ csmisas_get_raid_config(unsigned long ar
2766 sas_info = csmisas_get_device_component_by_fw(ioc,
2767 pPhysDisk0->PhysDiskBus, pPhysDisk0->PhysDiskID);
2768 if (sas_info) {
2769 - sas_address = reverse_byte_order64(sas_info->sas_address);
2770 + sas_address =
2771 + reverse_byte_order64(sas_info->sas_address);
2772 memcpy(pKarg->Configuration.Drives[i].bSASAddress,
2773 - &sas_address,sizeof(u64));
2774 + &sas_address, sizeof(u64));
2775 }
2776
2777 memcpy(pKarg->Configuration.Drives[i].bModel,
2778 pPhysDisk0->InquiryData.VendorID,
2779 - offsetof(RAID_PHYS_DISK0_INQUIRY_DATA,ProductRevLevel));
2780 + offsetof(RAID_PHYS_DISK0_INQUIRY_DATA,
2781 + ProductRevLevel));
2782 memcpy(pKarg->Configuration.Drives[i].bFirmware,
2783 pPhysDisk0->InquiryData.ProductRevLevel,
2784 sizeof(pPhysDisk0->InquiryData.ProductRevLevel));
2785 @@ -4021,10 +4038,10 @@ csmisas_get_raid_config(unsigned long ar
2786 }
2787 pKarg->Configuration.Drives[i].bDriveStatus =
2788 CSMI_SAS_DRIVE_STATUS_OK;
2789 - if(pPhysDisk0->PhysDiskStatus.State)
2790 + if (pPhysDisk0->PhysDiskStatus.State)
2791 pKarg->Configuration.Drives[i].bDriveStatus =
2792 CSMI_SAS_DRIVE_STATUS_FAILED;
2793 - else if(pPhysDisk0->ErrorData.SmartCount)
2794 + else if (pPhysDisk0->ErrorData.SmartCount)
2795 pKarg->Configuration.Drives[i].bDriveStatus =
2796 CSMI_SAS_DRIVE_STATUS_DEGRADED;
2797 pKarg->Configuration.Drives[i].bDriveUsage =
2798 @@ -4047,8 +4064,8 @@ csmisas_get_raid_config(unsigned long ar
2799 }
2800 }
2801
2802 - // Only return data on the first 240 drives
2803 - if( pKarg->Configuration.bDriveCount > 0xF0 )
2804 + /* Only return data on the first 240 drives */
2805 + if (pKarg->Configuration.bDriveCount > 0xF0)
2806 pKarg->Configuration.bDriveCount =
2807 CSMI_SAS_RAID_DRIVE_COUNT_TOO_BIG;
2808
2809 @@ -4060,11 +4077,11 @@ csmisas_get_raid_config(unsigned long ar
2810 pci_free_consistent(ioc->pcidev, volumepage0sz, pVolume0,
2811 volume0_dma);
2812
2813 - if(pPhysDisk0 != NULL)
2814 + if (pPhysDisk0 != NULL)
2815 pci_free_consistent(ioc->pcidev, physdiskpage0sz, pPhysDisk0,
2816 physdisk0_dma);
2817
2818 - if(pIocPage5 != NULL)
2819 + if (pIocPage5 != NULL)
2820 pci_free_consistent(ioc->pcidev, ioc_page5_sz, pIocPage5,
2821 ioc_page5_dma);
2822
2823 @@ -4075,17 +4092,17 @@ csmisas_get_raid_config(unsigned long ar
2824 switch (pKarg->Configuration.bDataType) {
2825 case CSMI_SAS_RAID_DATA_ADDITIONAL_DATA:
2826 copy_buffer_sz = sizeof(IOCTL_HEADER) +
2827 - offsetof(CSMI_SAS_RAID_CONFIG,Data) +
2828 + offsetof(CSMI_SAS_RAID_CONFIG, Data) +
2829 sizeof(CSMI_SAS_RAID_SET_ADDITIONAL_DATA);
2830 break;
2831 case CSMI_SAS_RAID_DATA_DRIVES:
2832 if (pKarg->Configuration.bDriveCount ==
2833 CSMI_SAS_RAID_DRIVE_COUNT_SUPRESSED)
2834 copy_buffer_sz = sizeof(IOCTL_HEADER) +
2835 - offsetof(CSMI_SAS_RAID_CONFIG,Drives);
2836 - else
2837 + offsetof(CSMI_SAS_RAID_CONFIG, Drives);
2838 + else
2839 copy_buffer_sz = sizeof(IOCTL_HEADER) +
2840 - offsetof(CSMI_SAS_RAID_CONFIG,Drives) +
2841 + offsetof(CSMI_SAS_RAID_CONFIG, Drives) +
2842 (pKarg->Configuration.bDriveCount *
2843 sizeof(CSMI_SAS_RAID_DRIVES));
2844 break;
2845 @@ -4097,12 +4114,12 @@ csmisas_get_raid_config(unsigned long ar
2846 if (copy_to_user(uarg, pKarg, copy_buffer_sz)) {
2847 printk(KERN_ERR "%s@%d::%s() - "
2848 "Unable to write out csmi_sas_get_raid_config @ %p\n",
2849 - __FILE__, __LINE__, __FUNCTION__, uarg);
2850 + __FILE__, __LINE__, __func__, uarg);
2851 free_pages((unsigned long)pKarg, memory_pages);
2852 return -EFAULT;
2853 }
2854
2855 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2856 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2857 free_pages((unsigned long)pKarg, memory_pages);
2858 return 0;
2859 }
2860 @@ -4119,15 +4136,15 @@ static int
2861 csmisas_get_raid_features(unsigned long arg)
2862 {
2863 CSMI_SAS_RAID_FEATURES_BUFFER __user *uarg = (void __user *) arg;
2864 - CSMI_SAS_RAID_FEATURES_BUFFER karg, *pKarg=NULL;
2865 + CSMI_SAS_RAID_FEATURES_BUFFER karg, *pKarg = NULL;
2866 int csmi_sas_raid_features_buffer_sz, iocnum;
2867 int memory_pages;
2868 MPT_ADAPTER *ioc = NULL;
2869
2870 if (copy_from_user(&karg, uarg, sizeof(IOCTL_HEADER))) {
2871 - printk(KERN_ERR "%s@%d::%s() - "
2872 - "Unable to read in csmi_sas_get_raid_features struct @ %p\n",
2873 - __FILE__, __LINE__, __FUNCTION__, uarg);
2874 + printk(KERN_ERR "%s@%d::%s() - Unable to "
2875 + "read in csmi_sas_get_raid_features struct @ %p\n",
2876 + __FILE__, __LINE__, __func__, uarg);
2877 return -EFAULT;
2878 }
2879
2880 @@ -4135,20 +4152,20 @@ csmisas_get_raid_features(unsigned long
2881 memory_pages = get_order(csmi_sas_raid_features_buffer_sz);
2882 pKarg = (CSMI_SAS_RAID_FEATURES_BUFFER *)__get_free_pages(
2883 GFP_KERNEL, memory_pages);
2884 - if (!pKarg){
2885 + if (!pKarg) {
2886 printk(KERN_ERR "%s@%d::%s() - "
2887 "Unable to malloc RAID_FEATURES_BUFFER "
2888 "csmi_sas_raid_features_buffer_sz=%d memory_pages=%d\n",
2889 - __FILE__, __LINE__, __FUNCTION__,
2890 + __FILE__, __LINE__, __func__,
2891 csmi_sas_raid_features_buffer_sz, memory_pages);
2892 return -ENOMEM;
2893 }
2894 memset(pKarg, 0, sizeof(*pKarg));
2895
2896 if (copy_from_user(pKarg, uarg, csmi_sas_raid_features_buffer_sz)) {
2897 - printk(KERN_ERR "%s@%d::%s() - "
2898 - "Unable to read in csmi_sas_get_raid_features struct @ %p\n",
2899 - __FILE__, __LINE__, __FUNCTION__, uarg);
2900 + printk(KERN_ERR "%s@%d::%s() - Unable to "
2901 + "read in csmi_sas_get_raid_features struct @ %p\n",
2902 + __FILE__, __LINE__, __func__, uarg);
2903 free_pages((unsigned long)pKarg, memory_pages);
2904 return -EFAULT;
2905 }
2906 @@ -4156,22 +4173,22 @@ csmisas_get_raid_features(unsigned long
2907 if (((iocnum = mpt_verify_adapter(pKarg->IoctlHeader.IOControllerNumber,
2908 &ioc)) < 0) || (ioc == NULL)) {
2909 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2910 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2911 + __FILE__, __func__, __LINE__, iocnum);
2912 free_pages((unsigned long)pKarg, memory_pages);
2913 return -ENODEV;
2914 }
2915
2916 if (!csmisas_is_this_sas_cntr(ioc)) {
2917 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
2918 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2919 + __FILE__, __func__, __LINE__, iocnum);
2920 free_pages((unsigned long)pKarg, memory_pages);
2921 return -ENODEV;
2922 }
2923
2924 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
2925 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
2926
2927 if (pKarg->Information.uChangeCount != 0 &&
2928 - pKarg->Information.uChangeCount != ioc->csmi_change_count ) {
2929 + pKarg->Information.uChangeCount != ioc->csmi_change_count) {
2930 pKarg->IoctlHeader.ReturnCode =
2931 CSMI_SAS_STATUS_INVALID_PARAMETER;
2932 pKarg->Information.uFailureCode =
2933 @@ -4218,12 +4235,12 @@ csmisas_get_raid_features(unsigned long
2934 sizeof(CSMI_SAS_RAID_FEATURES_BUFFER))) {
2935 printk(KERN_ERR "%s@%d::%s() - "
2936 "Unable to write out csmi_sas_get_raid_features @ %p\n",
2937 - __FILE__, __LINE__, __FUNCTION__, uarg);
2938 + __FILE__, __LINE__, __func__, uarg);
2939 free_pages((unsigned long)pKarg, memory_pages);
2940 return -EFAULT;
2941 }
2942
2943 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
2944 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
2945 free_pages((unsigned long)pKarg, memory_pages);
2946 return 0;
2947 }
2948 @@ -4240,7 +4257,7 @@ static int
2949 csmisas_set_raid_control(unsigned long arg)
2950 {
2951 CSMI_SAS_RAID_CONTROL_BUFFER __user *uarg = (void __user *) arg;
2952 - CSMI_SAS_RAID_CONTROL_BUFFER karg, *pKarg=NULL;
2953 + CSMI_SAS_RAID_CONTROL_BUFFER karg, *pKarg = NULL;
2954 int csmi_sas_raid_control_buffer_sz, iocnum;
2955 int memory_pages;
2956 MPT_ADAPTER *ioc = NULL;
2957 @@ -4248,7 +4265,7 @@ csmisas_set_raid_control(unsigned long a
2958 if (copy_from_user(&karg, uarg, sizeof(IOCTL_HEADER))) {
2959 printk(KERN_ERR "%s@%d::%s() - "
2960 "Unable to read in csmi_sas_set_raid_control struct @ %p\n",
2961 - __FILE__, __LINE__, __FUNCTION__, uarg);
2962 + __FILE__, __LINE__, __func__, uarg);
2963 return -EFAULT;
2964 }
2965
2966 @@ -4256,11 +4273,11 @@ csmisas_set_raid_control(unsigned long a
2967 memory_pages = get_order(csmi_sas_raid_control_buffer_sz);
2968 pKarg = (CSMI_SAS_RAID_CONTROL_BUFFER *)__get_free_pages(
2969 GFP_KERNEL, memory_pages);
2970 - if (!pKarg){
2971 + if (!pKarg) {
2972 printk(KERN_ERR "%s@%d::%s() - "
2973 "Unable to malloc RAID_CONTROL_BUFFER "
2974 "csmi_sas_raid_control_buffer_sz=%d memory_pages=%d\n",
2975 - __FILE__, __LINE__, __FUNCTION__,
2976 + __FILE__, __LINE__, __func__,
2977 csmi_sas_raid_control_buffer_sz, memory_pages);
2978 return -ENOMEM;
2979 }
2980 @@ -4269,7 +4286,7 @@ csmisas_set_raid_control(unsigned long a
2981 if (copy_from_user(pKarg, uarg, csmi_sas_raid_control_buffer_sz)) {
2982 printk(KERN_ERR "%s@%d::%s() - "
2983 "Unable to read in csmi_sas_set_raid_control struct @ %p\n",
2984 - __FILE__, __LINE__, __FUNCTION__, uarg);
2985 + __FILE__, __LINE__, __func__, uarg);
2986 free_pages((unsigned long)pKarg, memory_pages);
2987 return -EFAULT;
2988 }
2989 @@ -4277,22 +4294,22 @@ csmisas_set_raid_control(unsigned long a
2990 if (((iocnum = mpt_verify_adapter(pKarg->IoctlHeader.IOControllerNumber,
2991 &ioc)) < 0) || (ioc == NULL)) {
2992 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
2993 - __FILE__, __FUNCTION__, __LINE__, iocnum);
2994 + __FILE__, __func__, __LINE__, iocnum);
2995 free_pages((unsigned long)pKarg, memory_pages);
2996 return -ENODEV;
2997 }
2998
2999 if (!csmisas_is_this_sas_cntr(ioc)) {
3000 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3001 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3002 + __FILE__, __func__, __LINE__, iocnum);
3003 free_pages((unsigned long)pKarg, memory_pages);
3004 return -ENODEV;
3005 }
3006
3007 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3008 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3009
3010 if (pKarg->Information.uChangeCount != 0 &&
3011 - pKarg->Information.uChangeCount != ioc->csmi_change_count ) {
3012 + pKarg->Information.uChangeCount != ioc->csmi_change_count) {
3013 pKarg->IoctlHeader.ReturnCode =
3014 CSMI_SAS_STATUS_INVALID_PARAMETER;
3015 pKarg->Information.uFailureCode =
3016 @@ -4329,8 +4346,8 @@ csmisas_set_raid_control(unsigned long a
3017 goto cim_set_raid_control_exit;
3018 }
3019
3020 - if( !strcmp(pKarg->Information.bClearConfiguration,
3021 - CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE) ) {
3022 + if (!strcmp(pKarg->Information.bClearConfiguration,
3023 + CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE)) {
3024 pKarg->IoctlHeader.ReturnCode =
3025 CSMI_SAS_STATUS_INVALID_PARAMETER;
3026 pKarg->Information.uFailureCode =
3027 @@ -4349,12 +4366,12 @@ csmisas_set_raid_control(unsigned long a
3028 sizeof(CSMI_SAS_RAID_CONTROL_BUFFER))) {
3029 printk(KERN_ERR "%s@%d::%s() - "
3030 "Unable to write out csmi_sas_set_raid_control @ %p\n",
3031 - __FILE__, __LINE__, __FUNCTION__, uarg);
3032 + __FILE__, __LINE__, __func__, uarg);
3033 free_pages((unsigned long)pKarg, memory_pages);
3034 return -EFAULT;
3035 }
3036
3037 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3038 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3039 free_pages((unsigned long)pKarg, memory_pages);
3040 return 0;
3041 }
3042 @@ -4378,42 +4395,39 @@ csmisas_get_raid_element(unsigned long a
3043 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_RAID_ELEMENT_BUFFER))) {
3044 printk(KERN_ERR "%s@%d::%s() - "
3045 "Unable to read in csmisas_get_raid_element struct @ %p\n",
3046 - __FILE__, __LINE__, __FUNCTION__, uarg);
3047 + __FILE__, __LINE__, __func__, uarg);
3048 return -EFAULT;
3049 }
3050
3051 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3052 &ioc)) < 0) || (ioc == NULL)) {
3053 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3054 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3055 + __FILE__, __func__, __LINE__, iocnum);
3056 return -ENODEV;
3057 }
3058
3059 if (!csmisas_is_this_sas_cntr(ioc)) {
3060 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3061 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3062 + __FILE__, __func__, __LINE__, iocnum);
3063 return -ENODEV;
3064 }
3065
3066 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3067 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3068
3069 -/* TODO - implement IOCTL here */
3070 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;
3071 dcsmisasprintk(ioc, printk(KERN_DEBUG ": not implemented\n"));
3072
3073 -// csmisas_get_raid_element_exit:
3074 -
3075 /* Copy the data from kernel memory to user memory
3076 */
3077 if (copy_to_user(uarg, &karg,
3078 sizeof(CSMI_SAS_RAID_ELEMENT_BUFFER))) {
3079 printk(KERN_ERR "%s@%d::%s() - "
3080 "Unable to write out csmisas_get_raid_element @ %p\n",
3081 - __FILE__, __LINE__, __FUNCTION__, uarg);
3082 + __FILE__, __LINE__, __func__, uarg);
3083 return -EFAULT;
3084 }
3085
3086 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3087 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3088 return 0;
3089
3090 }
3091 @@ -4434,45 +4448,43 @@ csmisas_set_raid_operation(unsigned long
3092 MPT_ADAPTER *ioc = NULL;
3093 int iocnum;
3094
3095 - if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_RAID_SET_OPERATION_BUFFER))) {
3096 + if (copy_from_user(&karg, uarg,
3097 + sizeof(CSMI_SAS_RAID_SET_OPERATION_BUFFER))) {
3098 printk(KERN_ERR "%s@%d::%s() - "
3099 "Unable to read in csmi_set_raid_operation struct @ %p\n",
3100 - __FILE__, __LINE__, __FUNCTION__, uarg);
3101 + __FILE__, __LINE__, __func__, uarg);
3102 return -EFAULT;
3103 }
3104
3105 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3106 &ioc)) < 0) || (ioc == NULL)) {
3107 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3108 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3109 + __FILE__, __func__, __LINE__, iocnum);
3110 return -ENODEV;
3111 }
3112
3113 if (!csmisas_is_this_sas_cntr(ioc)) {
3114 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3115 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3116 + __FILE__, __func__, __LINE__, iocnum);
3117 return -ENODEV;
3118 }
3119
3120 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3121 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3122
3123 -/* TODO - implement IOCTL here */
3124 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;
3125 dcsmisasprintk(ioc, printk(KERN_DEBUG ": not implemented\n"));
3126
3127 -// cim_set_raid_operation:
3128 -
3129 /* Copy the data from kernel memory to user memory
3130 */
3131 if (copy_to_user(uarg, &karg,
3132 sizeof(CSMI_SAS_RAID_SET_OPERATION_BUFFER))) {
3133 printk(KERN_ERR "%s@%d::%s() - "
3134 "Unable to write out csmi_set_raid_operation @ %p\n",
3135 - __FILE__, __LINE__, __FUNCTION__, uarg);
3136 + __FILE__, __LINE__, __func__, uarg);
3137 return -EFAULT;
3138 }
3139
3140 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3141 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3142 return 0;
3143
3144 }
3145 @@ -4512,24 +4524,24 @@ csmisas_task_managment(unsigned long arg
3146 if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_SSP_TASK_IU_BUFFER))) {
3147 printk(KERN_ERR "%s@%d::%s() - "
3148 "Unable to read in csmi_sas_task_managment struct @ %p\n",
3149 - __FILE__, __LINE__, __FUNCTION__, uarg);
3150 + __FILE__, __LINE__, __func__, uarg);
3151 return -EFAULT;
3152 }
3153
3154 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3155 &ioc)) < 0) || (ioc == NULL)) {
3156 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3157 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3158 + __FILE__, __func__, __LINE__, iocnum);
3159 return -ENODEV;
3160 }
3161
3162 if (!csmisas_is_this_sas_cntr(ioc)) {
3163 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3164 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3165 + __FILE__, __func__, __LINE__, iocnum);
3166 return -ENODEV;
3167 }
3168
3169 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3170 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3171
3172 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
3173
3174 @@ -4575,18 +4587,22 @@ csmisas_task_managment(unsigned long arg
3175 goto cim_get_task_managment_exit;
3176
3177 switch (karg.Parameters.uInformation) {
3178 - case CSMI_SAS_SSP_TEST:
3179 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request for test purposes\n"));
3180 - break;
3181 - case CSMI_SAS_SSP_EXCEEDED:
3182 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request due to timeout\n"));
3183 - break;
3184 - case CSMI_SAS_SSP_DEMAND:
3185 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request demanded by app\n"));
3186 - break;
3187 - case CSMI_SAS_SSP_TRIGGER:
3188 - dcsmisasprintk(ioc, printk(KERN_DEBUG "TM request sent to trigger event\n"));
3189 - break;
3190 + case CSMI_SAS_SSP_TEST:
3191 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3192 + "TM request for test purposes\n"));
3193 + break;
3194 + case CSMI_SAS_SSP_EXCEEDED:
3195 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3196 + "TM request due to timeout\n"));
3197 + break;
3198 + case CSMI_SAS_SSP_DEMAND:
3199 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3200 + "TM request demanded by app\n"));
3201 + break;
3202 + case CSMI_SAS_SSP_TRIGGER:
3203 + dcsmisasprintk(ioc, printk(KERN_DEBUG
3204 + "TM request sent to trigger event\n"));
3205 + break;
3206 }
3207
3208 switch (taskType) {
3209 @@ -4601,12 +4617,12 @@ csmisas_task_managment(unsigned long arg
3210 mf = MPT_INDEX_2_MFPTR(hd->ioc, i);
3211 TaskMsgContext =
3212 mf->u.frame.hwhdr.msgctxu.MsgContext;
3213 - found_qtag=1;
3214 + found_qtag = 1;
3215 break;
3216 }
3217 }
3218
3219 - if(!found_qtag)
3220 + if (!found_qtag)
3221 goto cim_get_task_managment_exit;
3222
3223 case MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET:
3224 @@ -4618,7 +4634,6 @@ csmisas_task_managment(unsigned long arg
3225
3226 /* Single threading ....
3227 */
3228 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3229 mutex_lock(&ioc->taskmgmt_cmds.mutex);
3230 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
3231 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3232 @@ -4626,50 +4641,34 @@ csmisas_task_managment(unsigned long arg
3233 CSMI_SAS_STATUS_FAILED;
3234 goto cim_get_task_managment_exit;
3235 }
3236 -#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0))
3237 - if (mptctl_set_tm_flags(hd) != 0) {
3238 - karg.IoctlHeader.ReturnCode =
3239 - CSMI_SAS_STATUS_FAILED;
3240 - goto cim_get_task_managment_exit;
3241 - }
3242 -#endif
3243 /* Send request
3244 */
3245 if ((mf = mpt_get_msg_frame(mptctl_taskmgmt_id, ioc)) == NULL) {
3246 - dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
3247 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3248 + dcsmisasprintk(ioc,
3249 + printk(KERN_ERR ": no msg frames!\n"));
3250 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3251 mpt_clear_taskmgmt_in_progress_flag(ioc);
3252 -#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0))
3253 - mptctl_free_tm_flags(ioc);
3254 -#endif
3255 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3256 goto cim_get_task_managment_exit;
3257 }
3258
3259 mpi_hdr = (MPIHeader_t *) mf;
3260 MsgContext = mpi_hdr->MsgContext;
3261 - pScsiTm = (pSCSITaskMgmt_t ) mf;
3262 + pScsiTm = (pSCSITaskMgmt_t) mf;
3263
3264 - memset(pScsiTm,0,sizeof(SCSITaskMgmt_t));
3265 + memset(pScsiTm, 0, sizeof(SCSITaskMgmt_t));
3266 pScsiTm->TaskType = taskType;
3267 pScsiTm->Bus = channel;
3268 pScsiTm->TargetID = id;
3269 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3270 int_to_scsilun(karg.Parameters.bLun,
3271 (struct scsi_lun *)pScsiTm->LUN);
3272 -#else
3273 - pScsiTm->LUN[1] = karg.Parameters.bLun;
3274 -#endif
3275 pScsiTm->MsgContext = MsgContext;
3276 pScsiTm->TaskMsgContext = TaskMsgContext;
3277 pScsiTm->Function = MPI_FUNCTION_SCSI_TASK_MGMT;
3278
3279 if (csmisas_send_handshake_wait(ioc, mf,
3280 karg.IoctlHeader.Timeout) != 0) {
3281 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3282 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3283 -#endif
3284 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3285 goto cim_get_task_managment_exit;
3286 }
3287 @@ -4677,25 +4676,26 @@ csmisas_task_managment(unsigned long arg
3288 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) {
3289
3290 pScsiTmReply =
3291 - (pSCSITaskMgmtReply_t ) ioc->ioctl_cmds.reply;
3292 + (pSCSITaskMgmtReply_t) ioc->ioctl_cmds.reply;
3293
3294 ioc_status = le16_to_cpu(pScsiTmReply->IOCStatus)
3295 & MPI_IOCSTATUS_MASK;
3296
3297 - memset(&karg.Status,0,
3298 + memset(&karg.Status, 0,
3299 sizeof(CSMI_SAS_SSP_PASSTHRU_STATUS));
3300
3301 - if(ioc_status == MPI_IOCSTATUS_SUCCESS) {
3302 + if (ioc_status == MPI_IOCSTATUS_SUCCESS) {
3303 karg.IoctlHeader.ReturnCode =
3304 CSMI_SAS_STATUS_SUCCESS;
3305 karg.Status.bSSPStatus =
3306 CSMI_SAS_SSP_STATUS_COMPLETED;
3307 - }else if(ioc_status == MPI_IOCSTATUS_INSUFFICIENT_RESOURCES) {
3308 + } else if (ioc_status
3309 + == MPI_IOCSTATUS_INSUFFICIENT_RESOURCES) {
3310 karg.IoctlHeader.ReturnCode =
3311 CSMI_SAS_STATUS_SUCCESS;
3312 karg.Status.bSSPStatus =
3313 CSMI_SAS_SSP_STATUS_RETRY;
3314 - }else {
3315 + } else {
3316 karg.IoctlHeader.ReturnCode =
3317 CSMI_SAS_STATUS_FAILED;
3318 karg.Status.bSSPStatus =
3319 @@ -4711,9 +4711,7 @@ csmisas_task_managment(unsigned long arg
3320 break;
3321 }
3322
3323 -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15))
3324 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
3325 -#endif
3326
3327 cim_get_task_managment_exit:
3328
3329 @@ -4723,11 +4721,11 @@ csmisas_task_managment(unsigned long arg
3330 sizeof(CSMI_SAS_SSP_TASK_IU_BUFFER))) {
3331 printk(KERN_ERR "%s@%d::%s() - "
3332 "Unable to write out csmi_sas_task_managment @ %p\n",
3333 - __FILE__, __LINE__, __FUNCTION__, uarg);
3334 + __FILE__, __LINE__, __func__, uarg);
3335 return -EFAULT;
3336 }
3337
3338 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3339 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3340 return 0;
3341 }
3342
3343 @@ -4827,19 +4825,19 @@ csmisas_phy_reset(MPT_ADAPTER *ioc, u8 P
3344
3345 if ((opcode != MPI_SAS_OP_PHY_LINK_RESET) &&
3346 (opcode != MPI_SAS_OP_PHY_HARD_RESET))
3347 - return -1;
3348 + return -1;
3349
3350 /* Get a MF for this command.
3351 */
3352 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
3353 dcsmisasprintk(ioc, printk(KERN_ERR ": no msg frames!\n"));
3354 return -1;
3355 - }
3356 + }
3357
3358 mpi_hdr = (MPIHeader_t *) mf;
3359 MsgContext = mpi_hdr->MsgContext;
3360 sasIoUnitCntrReq = (SasIoUnitControlRequest_t *)mf;
3361 - memset(sasIoUnitCntrReq,0,sizeof(SasIoUnitControlRequest_t));
3362 + memset(sasIoUnitCntrReq, 0, sizeof(SasIoUnitControlRequest_t));
3363 sasIoUnitCntrReq->Function = MPI_FUNCTION_SAS_IO_UNIT_CONTROL;
3364 sasIoUnitCntrReq->MsgContext = MsgContext;
3365 sasIoUnitCntrReq->Operation = opcode;
3366 @@ -4857,7 +4855,7 @@ csmisas_phy_reset(MPT_ADAPTER *ioc, u8 P
3367 & MPI_IOCSTATUS_MASK;
3368 if (ioc_status != MPI_IOCSTATUS_SUCCESS) {
3369 printk(KERN_DEBUG "%s: IOCStatus=0x%X IOCLogInfo=0x%X\n",
3370 - __FUNCTION__,
3371 + __func__,
3372 sasIoUnitCntrReply->IOCStatus,
3373 sasIoUnitCntrReply->IOCLogInfo);
3374 return -1;
3375 @@ -4878,12 +4876,12 @@ csmisas_phy_control(unsigned long arg)
3376 CSMI_SAS_PHY_CONTROL_BUFFER __user *uarg = (void __user *) arg;
3377 IOCTL_HEADER ioctl_header;
3378 PCSMI_SAS_PHY_CONTROL_BUFFER karg;
3379 - SasIOUnitPage0_t *sasIoUnitPg0=NULL;
3380 + SasIOUnitPage0_t *sasIoUnitPg0 = NULL;
3381 dma_addr_t sasIoUnitPg0_dma;
3382 - int sasIoUnitPg0_data_sz=0;
3383 - SasIOUnitPage1_t *sasIoUnitPg1=NULL;
3384 + int sasIoUnitPg0_data_sz = 0;
3385 + SasIOUnitPage1_t *sasIoUnitPg1 = NULL;
3386 dma_addr_t sasIoUnitPg1_dma;
3387 - int sasIoUnitPg1_data_sz=0;
3388 + int sasIoUnitPg1_data_sz = 0;
3389 ConfigExtendedPageHeader_t hdr;
3390 CONFIGPARMS cfg;
3391 MPT_ADAPTER *ioc = NULL;
3392 @@ -4894,7 +4892,7 @@ csmisas_phy_control(unsigned long arg)
3393 if (copy_from_user(&ioctl_header, uarg, sizeof(IOCTL_HEADER))) {
3394 printk(KERN_ERR "%s@%d::%s() - "
3395 "Unable to read in IOCTL_HEADER"
3396 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3397 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3398 return -EFAULT;
3399 }
3400
3401 @@ -4902,11 +4900,11 @@ csmisas_phy_control(unsigned long arg)
3402 memory_pages = get_order(csmi_sas_phy_control_buffer_sz);
3403 karg = (PCSMI_SAS_PHY_CONTROL_BUFFER)__get_free_pages(
3404 GFP_KERNEL, memory_pages);
3405 - if (!karg){
3406 + if (!karg) {
3407 printk(KERN_ERR "%s@%d::%s() - "
3408 "Unable to malloc SAS_PHY_CONTROL_BUFFER "
3409 "csmi_sas_phy_control_buffer_sz=%d memory_pages=%d\n",
3410 - __FILE__, __LINE__, __FUNCTION__,
3411 + __FILE__, __LINE__, __func__,
3412 csmi_sas_phy_control_buffer_sz, memory_pages);
3413 return -ENOMEM;
3414 }
3415 @@ -4915,7 +4913,7 @@ csmisas_phy_control(unsigned long arg)
3416 if (copy_from_user(karg, uarg, csmi_sas_phy_control_buffer_sz)) {
3417 printk(KERN_ERR "%s@%d::%s() - "
3418 "Unable to read in csmi_sas_phy_control_buffer "
3419 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3420 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3421 free_pages((unsigned long)karg, memory_pages);
3422 return -EFAULT;
3423 }
3424 @@ -4923,19 +4921,19 @@ csmisas_phy_control(unsigned long arg)
3425 if (((iocnum = mpt_verify_adapter(ioctl_header.IOControllerNumber,
3426 &ioc)) < 0) || (ioc == NULL)) {
3427 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3428 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3429 + __FILE__, __func__, __LINE__, iocnum);
3430 free_pages((unsigned long)karg, memory_pages);
3431 return -ENODEV;
3432 }
3433
3434 if (!csmisas_is_this_sas_cntr(ioc)) {
3435 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3436 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3437 + __FILE__, __func__, __LINE__, iocnum);
3438 free_pages((unsigned long)karg, memory_pages);
3439 return -ENODEV;
3440 }
3441
3442 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3443 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3444
3445 if (karg->bPhyIdentifier >= ioc->num_ports) {
3446 karg->IoctlHeader.ReturnCode =
3447 @@ -4970,7 +4968,8 @@ csmisas_phy_control(unsigned long arg)
3448 }
3449
3450 if (hdr.ExtPageLength == 0) {
3451 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3452 + dcsmisasprintk(ioc,
3453 + printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3454 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3455 goto cim_sas_phy_control_exit;
3456 }
3457 @@ -4980,7 +4979,8 @@ csmisas_phy_control(unsigned long arg)
3458 sasIoUnitPg0_data_sz, &sasIoUnitPg0_dma);
3459
3460 if (!sasIoUnitPg0) {
3461 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3462 + dcsmisasprintk(ioc,
3463 + printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3464 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3465 goto cim_sas_phy_control_exit;
3466 }
3467 @@ -5023,7 +5023,8 @@ csmisas_phy_control(unsigned long arg)
3468 }
3469
3470 if (hdr.ExtPageLength == 0) {
3471 - dcsmisasprintk(ioc, printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3472 + dcsmisasprintk(ioc,
3473 + printk(KERN_ERR ": hdr.ExtPageLength == 0\n"));
3474 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3475 goto cim_sas_phy_control_exit;
3476 }
3477 @@ -5033,7 +5034,8 @@ csmisas_phy_control(unsigned long arg)
3478 sasIoUnitPg1_data_sz, &sasIoUnitPg1_dma);
3479
3480 if (!sasIoUnitPg1) {
3481 - dcsmisasprintk(ioc, printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3482 + dcsmisasprintk(ioc,
3483 + printk(KERN_ERR ": pci_alloc_consistent: FAILED\n"));
3484 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;
3485 goto cim_sas_phy_control_exit;
3486 }
3487 @@ -5054,19 +5056,18 @@ csmisas_phy_control(unsigned long arg)
3488 case CSMI_SAS_PC_LINK_RESET:
3489 case CSMI_SAS_PC_HARD_RESET:
3490 {
3491 - u8 opcode = (karg->uFunction==CSMI_SAS_PC_LINK_RESET) ?
3492 + u8 opcode = (karg->uFunction == CSMI_SAS_PC_LINK_RESET) ?
3493 MPI_SAS_OP_PHY_LINK_RESET : MPI_SAS_OP_PHY_HARD_RESET;
3494
3495 - if((karg->uLinkFlags & CSMI_SAS_PHY_ACTIVATE_CONTROL) &&
3496 + if ((karg->uLinkFlags & CSMI_SAS_PHY_ACTIVATE_CONTROL) &&
3497 (karg->usLengthOfControl >= sizeof(CSMI_SAS_PHY_CONTROL)) &&
3498 - (karg->bNumberOfControls > 0)){
3499 - if(karg->Control[0].bRate ==
3500 + (karg->bNumberOfControls > 0)) {
3501 + if (karg->Control[0].bRate ==
3502 CSMI_SAS_LINK_RATE_1_5_GBPS) {
3503 sasIoUnitPg1->PhyData[karg->bPhyIdentifier].MaxMinLinkRate =
3504 MPI_SAS_IOUNIT1_MAX_RATE_1_5 |
3505 MPI_SAS_IOUNIT1_MIN_RATE_1_5;
3506 - }
3507 - else if(karg->Control[0].bRate ==
3508 + } else if (karg->Control[0].bRate ==
3509 CSMI_SAS_LINK_RATE_3_0_GBPS) {
3510 sasIoUnitPg1->PhyData[karg->bPhyIdentifier].MaxMinLinkRate =
3511 MPI_SAS_IOUNIT1_MAX_RATE_3_0 |
3512 @@ -5103,7 +5104,7 @@ csmisas_phy_control(unsigned long arg)
3513
3514 }
3515 case CSMI_SAS_PC_PHY_DISABLE:
3516 - if(karg->usLengthOfControl || karg->bNumberOfControls) {
3517 + if (karg->usLengthOfControl || karg->bNumberOfControls) {
3518 karg->IoctlHeader.ReturnCode =
3519 CSMI_SAS_STATUS_INVALID_PARAMETER;
3520 break;
3521 @@ -5135,14 +5136,14 @@ csmisas_phy_control(unsigned long arg)
3522 break;
3523
3524 case CSMI_SAS_PC_GET_PHY_SETTINGS:
3525 - if(karg->usLengthOfControl || karg->bNumberOfControls) {
3526 + if (karg->usLengthOfControl || karg->bNumberOfControls) {
3527 karg->IoctlHeader.ReturnCode =
3528 CSMI_SAS_STATUS_INVALID_PARAMETER;
3529 break;
3530 }
3531 - if(csmi_sas_phy_control_buffer_sz <
3532 - offsetof(CSMI_SAS_PHY_CONTROL_BUFFER,Control) +
3533 - (4* sizeof(CSMI_SAS_PHY_CONTROL))) {
3534 + if (csmi_sas_phy_control_buffer_sz <
3535 + offsetof(CSMI_SAS_PHY_CONTROL_BUFFER, Control) +
3536 + (4 * sizeof(CSMI_SAS_PHY_CONTROL))) {
3537 karg->IoctlHeader.ReturnCode =
3538 CSMI_SAS_STATUS_INVALID_PARAMETER;
3539 break;
3540 @@ -5175,15 +5176,15 @@ csmisas_phy_control(unsigned long arg)
3541
3542 /* Copy the data from kernel memory to user memory
3543 */
3544 - if (copy_to_user(uarg, karg,csmi_sas_phy_control_buffer_sz)) {
3545 + if (copy_to_user(uarg, karg, csmi_sas_phy_control_buffer_sz)) {
3546 printk(KERN_ERR "%s@%d::%s() - "
3547 "Unable to write out csmi_sas_phy_control_buffer @ %p\n",
3548 - __FILE__, __LINE__, __FUNCTION__, uarg);
3549 + __FILE__, __LINE__, __func__, uarg);
3550 free_pages((unsigned long)karg, memory_pages);
3551 return -EFAULT;
3552 }
3553
3554 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3555 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3556 free_pages((unsigned long)karg, memory_pages);
3557 return 0;
3558 }
3559 @@ -5202,7 +5203,8 @@ csmisas_phy_control(unsigned long arg)
3560 * -EFAULT for non-successful reply or no reply (timeout)
3561 **/
3562 static int
3563 -csmisas_get_manuf_pg_7(MPT_ADAPTER *ioc, ManufacturingPage7_t *mfgpage7_buffer, int mfg_size)
3564 +csmisas_get_manuf_pg_7(MPT_ADAPTER *ioc, ManufacturingPage7_t *mfgpage7_buffer,
3565 + int mfg_size)
3566 {
3567 ConfigPageHeader_t hdr;
3568 CONFIGPARMS cfg;
3569 @@ -5281,41 +5283,41 @@ csmisas_get_connector_info(unsigned long
3570 printk(KERN_ERR "%s@%d::%s() - "
3571 "Unable to read in csmi_sas_connector_info_buffer"
3572 " struct @ %p\n",
3573 - __FILE__, __LINE__, __FUNCTION__, uarg);
3574 + __FILE__, __LINE__, __func__, uarg);
3575 return -EFAULT;
3576 }
3577
3578 if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,
3579 &ioc)) < 0) || (ioc == NULL)) {
3580 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3581 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3582 + __FILE__, __func__, __LINE__, iocnum);
3583 return -ENODEV;
3584 }
3585
3586 if (!csmisas_is_this_sas_cntr(ioc)) {
3587 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3588 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3589 + __FILE__, __func__, __LINE__, iocnum);
3590 return -ENODEV;
3591 }
3592
3593 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3594 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3595
3596 karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
3597
3598 /* `32` is the sizeof MPI_MANPAGE7_CONNECTOR_INFO */
3599 for (i = 0; i < 32; i++) {
3600 karg.Reference[i].uPinout = CSMI_SAS_CON_UNKNOWN;
3601 - strcpy(karg.Reference[i].bConnector,"");
3602 + strcpy(karg.Reference[i].bConnector, "");
3603 karg.Reference[i].bLocation = CSMI_SAS_CON_UNKNOWN;
3604 }
3605
3606 - mfgPg7_sz = offsetof(CONFIG_PAGE_MANUFACTURING_7,ConnectorInfo) +
3607 + mfgPg7_sz = offsetof(CONFIG_PAGE_MANUFACTURING_7, ConnectorInfo) +
3608 (ioc->num_ports * sizeof(MPI_MANPAGE7_CONNECTOR_INFO));
3609 mfgPg7 = kmalloc(mfgPg7_sz, GFP_KERNEL);
3610 - if (!mfgPg7){
3611 + if (!mfgPg7) {
3612 printk(KERN_ERR "%s@%d::%s() - "
3613 "Unable to malloc @ %p\n",
3614 - __FILE__, __LINE__, __FUNCTION__, mfgPg7);
3615 + __FILE__, __LINE__, __func__, mfgPg7);
3616 return -EFAULT;
3617 }
3618 memset(mfgPg7, 0, mfgPg7_sz);
3619 @@ -5339,13 +5341,12 @@ csmisas_get_connector_info(unsigned long
3620 if (copy_to_user(uarg, &karg,
3621 sizeof(CSMI_SAS_CONNECTOR_INFO_BUFFER))) {
3622 printk(KERN_ERR "%s@%d::%s() - "
3623 - "Unable to write out csmi_sas_connector_info_buffer @"
3624 - "%p\n",
3625 - __FILE__, __LINE__, __FUNCTION__, uarg);
3626 + "Unable to write out csmi_sas_connector_info_buffer @%p\n",
3627 + __FILE__, __LINE__, __func__, uarg);
3628 return -EFAULT;
3629 }
3630
3631 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3632 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3633 return 0;
3634 }
3635
3636 @@ -5357,21 +5358,21 @@ csmisas_get_connector_info(unsigned long
3637 **/
3638 static int
3639 csmisas_fill_location_data(MPT_ADAPTER *ioc, u8 bus, u8 id, u8 opcode,
3640 - CSMI_SAS_LOCATION_IDENTIFIER * location_ident)
3641 + CSMI_SAS_LOCATION_IDENTIFIER *location_ident)
3642 {
3643
3644 ConfigExtendedPageHeader_t hdr;
3645 CONFIGPARMS cfg;
3646 int rc;
3647 - SasDevicePage0_t *sasDevicePg0=NULL;
3648 - SasEnclosurePage0_t *sasEnclosurePg0=NULL;
3649 - dma_addr_t sasDevicePg0_dma,sasEnclosurePg0_dma;
3650 - int sasDevicePg0_data_sz=0;
3651 - int sasEnclosurePg0_data_sz=0;
3652 + SasDevicePage0_t *sasDevicePg0 = NULL;
3653 + SasEnclosurePage0_t *sasEnclosurePg0 = NULL;
3654 + dma_addr_t sasDevicePg0_dma, sasEnclosurePg0_dma;
3655 + int sasDevicePg0_data_sz = 0;
3656 + int sasEnclosurePg0_data_sz = 0;
3657 u64 sas_address;
3658
3659 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3660 - memset (location_ident, 0, sizeof(*location_ident));
3661 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3662 + memset(location_ident, 0, sizeof(*location_ident));
3663
3664 /* SAS Device Page 0 */
3665 hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION;
3666 @@ -5389,12 +5390,12 @@ csmisas_fill_location_data(MPT_ADAPTER *
3667 cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;
3668
3669 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3670 - rc=-1;
3671 + rc = -1;
3672 goto fill_location_data_exit;
3673 }
3674
3675 if (hdr.ExtPageLength == 0) {
3676 - rc=-1;
3677 + rc = -1;
3678 goto fill_location_data_exit;
3679 }
3680
3681 @@ -5402,7 +5403,7 @@ csmisas_fill_location_data(MPT_ADAPTER *
3682 sasDevicePg0 = (SasDevicePage0_t *) pci_alloc_consistent(
3683 ioc->pcidev, sasDevicePg0_data_sz, &sasDevicePg0_dma);
3684 if (!sasDevicePg0) {
3685 - rc=-1;
3686 + rc = -1;
3687 goto fill_location_data_exit;
3688 }
3689
3690 @@ -5414,7 +5415,7 @@ csmisas_fill_location_data(MPT_ADAPTER *
3691 MPI_SAS_DEVICE_PGAD_FORM_SHIFT);
3692
3693 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3694 - rc=-1;
3695 + rc = -1;
3696 goto fill_location_data_exit;
3697 }
3698
3699 @@ -5442,12 +5443,12 @@ csmisas_fill_location_data(MPT_ADAPTER *
3700 cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;
3701
3702 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3703 - rc=0;
3704 + rc = 0;
3705 goto fill_location_data_exit;
3706 }
3707
3708 if (hdr.ExtPageLength == 0) {
3709 - rc=0;
3710 + rc = 0;
3711 goto fill_location_data_exit;
3712 }
3713
3714 @@ -5455,36 +5456,34 @@ csmisas_fill_location_data(MPT_ADAPTER *
3715 sasEnclosurePg0 = (SasEnclosurePage0_t *) pci_alloc_consistent(
3716 ioc->pcidev, sasEnclosurePg0_data_sz, &sasEnclosurePg0_dma);
3717 if (!sasEnclosurePg0) {
3718 - rc=0;
3719 + rc = 0;
3720 goto fill_location_data_exit;
3721 }
3722 cfg.physAddr = sasEnclosurePg0_dma;
3723 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3724 cfg.pageAddr = sasDevicePg0->EnclosureHandle
3725 - + (MPI_SAS_ENCLOS_PGAD_FORM_HANDLE << MPI_SAS_ENCLOS_PGAD_FORM_SHIFT);
3726 + + (MPI_SAS_ENCLOS_PGAD_FORM_HANDLE <<
3727 + MPI_SAS_ENCLOS_PGAD_FORM_SHIFT);
3728
3729 if ((rc = mpt_config(ioc, &cfg)) != 0) {
3730 - rc=0;
3731 + rc = 0;
3732 goto fill_location_data_exit;
3733 }
3734
3735 - location_ident->bLocationFlags |= CSMI_SAS_LOCATE_ENCLOSURE_IDENTIFIER_VALID;
3736 + location_ident->bLocationFlags |=
3737 + CSMI_SAS_LOCATE_ENCLOSURE_IDENTIFIER_VALID;
3738 memcpy(&sas_address, &sasEnclosurePg0->EnclosureLogicalID, sizeof(u64));
3739 sas_address = reverse_byte_order64(sas_address);
3740 if (sas_address)
3741 - memcpy(location_ident->bEnclosureIdentifier, &sas_address, sizeof(u64));
3742 + memcpy(location_ident->bEnclosureIdentifier, &sas_address,
3743 + sizeof(u64));
3744 else
3745 - strcpy(location_ident->bEnclosureIdentifier,"Internal");
3746 + strcpy(location_ident->bEnclosureIdentifier, "Internal");
3747
3748 -// bBayPrefix - not supported
3749 +/* bBayPrefix - not supported */
3750
3751 -// TODO - We need to look at sasEnclosurePg0-.Flags , to determine
3752 -// whether SEP BUS/TargetID is valid. Ifs its a SES device, then
3753 -// issue internal inquiry to (bus/id) to gather the Enclosure name.
3754 -// If the device is SMP, then issue SMP_MANUFACTURING to get enclosure name
3755 -// If its direct attached, there is no enclosure name
3756 location_ident->bLocationFlags |= CSMI_SAS_LOCATE_ENCLOSURE_NAME_VALID;
3757 - strcpy(location_ident->bEnclosureName,"Not Supported");
3758 + strcpy(location_ident->bEnclosureName, "Not Supported");
3759
3760 location_ident->bLocationFlags |= CSMI_SAS_LOCATE_LOCATION_STATE_VALID;
3761 location_ident->bLocationState = CSMI_SAS_LOCATE_UNKNOWN;
3762 @@ -5493,11 +5492,6 @@ csmisas_fill_location_data(MPT_ADAPTER *
3763 location_ident->bBayIdentifier = le16_to_cpu(sasDevicePg0->Slot);
3764
3765
3766 -// TODO - illuminating LEDs,
3767 -// karg->bIdentify = CSMI_SAS_LOCATE_FORCE_OFF, CSMI_SAS_LOCATE_FORCE_ON
3768 -// We can enable/disable LEDs by SCSI Enclosure Processor MPI request message
3769 -// printk("Flags=0x%x\n",sasEnclosurePg0->Flags);
3770 -
3771 /* check sasEnclosurePg0->Flags -
3772 * to validate whether we need to send the SEPRequest
3773 * bit:5 should be set
3774 @@ -5527,13 +5521,13 @@ fill_location_data_exit:
3775 pci_free_consistent(ioc->pcidev, sasEnclosurePg0_data_sz,
3776 sasEnclosurePg0, sasEnclosurePg0_dma);
3777
3778 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3779 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3780 return rc;
3781 }
3782
3783 static int
3784 -csmisas_fill_location_data_raid(MPT_ADAPTER *ioc, PCSMI_SAS_GET_LOCATION_BUFFER karg, u8 VolumeBus,
3785 - u8 volumeID)
3786 +csmisas_fill_location_data_raid(MPT_ADAPTER *ioc,
3787 + PCSMI_SAS_GET_LOCATION_BUFFER karg, u8 VolumeBus, u8 volumeID)
3788 {
3789 pRaidVolumePage0_t pVolume0 = NULL;
3790 pRaidPhysDiskPage0_t pPhysDisk0 = NULL;
3791 @@ -5554,9 +5548,9 @@ csmisas_fill_location_data_raid(MPT_ADAP
3792
3793 csmi_sas_get_location_sz = karg->IoctlHeader.Length;
3794 physDiskNumMax = (csmi_sas_get_location_sz -
3795 - offsetof(CSMI_SAS_GET_LOCATION_BUFFER,Location))
3796 + offsetof(CSMI_SAS_GET_LOCATION_BUFFER, Location))
3797 / sizeof(CSMI_SAS_LOCATION_IDENTIFIER);
3798 - karg->bNumberOfLocationIdentifiers=0;
3799 + karg->bNumberOfLocationIdentifiers = 0;
3800
3801 /*
3802 * get RAID Volume Page 0
3803 @@ -5592,7 +5586,7 @@ csmisas_fill_location_data_raid(MPT_ADAP
3804
3805 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3806 cfg.physAddr = volume0_dma;
3807 - if (mpt_config(ioc, &cfg) != 0){
3808 + if (mpt_config(ioc, &cfg) != 0) {
3809 rc = -1;
3810 goto sas_fill_location_data_raid_exit;
3811 }
3812 @@ -5632,17 +5626,17 @@ csmisas_fill_location_data_raid(MPT_ADAP
3813 }
3814 cfg.physAddr = physdisk0_dma;
3815
3816 - for (i=0; i < min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
3817 + for (i = 0; i < min(pVolume0->NumPhysDisks, physDiskNumMax); i++) {
3818
3819 /* obtain a refresh of pPhysDisk0 */
3820 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
3821 cfg.pageAddr = pVolume0->PhysDisk[i].PhysDiskNum;
3822 - if (mpt_config(ioc, &cfg) != 0){
3823 + if (mpt_config(ioc, &cfg) != 0) {
3824 rc = -1;
3825 goto sas_fill_location_data_raid_exit;
3826 }
3827
3828 - if((csmisas_fill_location_data(ioc, pPhysDisk0->PhysDiskBus,
3829 + if ((csmisas_fill_location_data(ioc, pPhysDisk0->PhysDiskBus,
3830 pPhysDisk0->PhysDiskID, karg->bIdentify,
3831 &karg->Location[karg->bNumberOfLocationIdentifiers])) == 0)
3832 karg->bNumberOfLocationIdentifiers++;
3833 @@ -5679,7 +5673,7 @@ csmisas_fill_location_data_raid(MPT_ADAP
3834 if (csmisas_get_ioc_pg5(ioc, iocPage5, sz) != 0)
3835 goto sas_fill_location_data_raid_exit;
3836
3837 - for(i = 0, idx = pVolume0->NumPhysDisks ; i < num_hotpares;
3838 + for (i = 0, idx = pVolume0->NumPhysDisks ; i < num_hotpares;
3839 i++, idx++) {
3840
3841 if (idx >= physDiskNumMax)
3842 @@ -5728,11 +5722,11 @@ csmisas_fill_location_data_raid(MPT_ADAP
3843 if ((pVolume0->VolumeType ==
3844 MPI_RAID_VOL_TYPE_IME) &&
3845 ((tmpTotalMaxLBA * 2) +
3846 - (64*2*1024 ) /*metadata = 64MB*/ >
3847 + (64*2*1024) /*metadata = 64MB*/ >
3848 le32_to_cpu(pPhysDisk0->MaxLBA)))
3849 continue;
3850
3851 - if((csmisas_fill_location_data(ioc,
3852 + if ((csmisas_fill_location_data(ioc,
3853 pPhysDisk0->PhysDiskBus, pPhysDisk0->PhysDiskID,
3854 karg->bIdentify,
3855 &karg->Location[karg->bNumberOfLocationIdentifiers])) == 0)
3856 @@ -5749,7 +5743,7 @@ csmisas_fill_location_data_raid(MPT_ADAP
3857 pci_free_consistent(ioc->pcidev, volumepage0sz, pVolume0,
3858 volume0_dma);
3859
3860 - if(pPhysDisk0)
3861 + if (pPhysDisk0)
3862 pci_free_consistent(ioc->pcidev, physdiskpage0sz, pPhysDisk0,
3863 physdisk0_dma);
3864
3865 @@ -5771,7 +5765,7 @@ csmisas_get_location(unsigned long arg)
3866 PCSMI_SAS_GET_LOCATION_BUFFER karg;
3867 IOCTL_HEADER ioctl_header;
3868 MPT_ADAPTER *ioc = NULL;
3869 - int iocnum,i;
3870 + int iocnum, i;
3871 int csmi_sas_get_location_sz;
3872 int memory_pages;
3873 struct sas_device_info *sas_info;
3874 @@ -5779,7 +5773,7 @@ csmisas_get_location(unsigned long arg)
3875 if (copy_from_user(&ioctl_header, uarg, sizeof(IOCTL_HEADER))) {
3876 printk(KERN_ERR "%s@%d::%s() - "
3877 "Unable to read in IOCTL_HEADER"
3878 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3879 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3880 return -EFAULT;
3881 }
3882
3883 @@ -5787,11 +5781,11 @@ csmisas_get_location(unsigned long arg)
3884 memory_pages = get_order(csmi_sas_get_location_sz);
3885 karg = (PCSMI_SAS_GET_LOCATION_BUFFER)__get_free_pages(
3886 GFP_KERNEL, memory_pages);
3887 - if (!karg){
3888 + if (!karg) {
3889 printk(KERN_ERR "%s@%d::%s() - "
3890 "Unable to malloc GET_LOCATION_BUFFER "
3891 "csmi_sas_get_location_sz=%d memory_pages=%d\n",
3892 - __FILE__, __LINE__, __FUNCTION__,
3893 + __FILE__, __LINE__, __func__,
3894 csmi_sas_get_location_sz, memory_pages);
3895 return -ENOMEM;
3896 }
3897 @@ -5800,7 +5794,7 @@ csmisas_get_location(unsigned long arg)
3898 if (copy_from_user(karg, uarg, csmi_sas_get_location_sz)) {
3899 printk(KERN_ERR "%s@%d::%s() - "
3900 "Unable to read in csmi_sas_phy_control_buffer "
3901 - "struct @ %p\n", __FILE__, __LINE__, __FUNCTION__, uarg);
3902 + "struct @ %p\n", __FILE__, __LINE__, __func__, uarg);
3903 free_pages((unsigned long)karg, memory_pages);
3904 return -EFAULT;
3905 }
3906 @@ -5808,22 +5802,22 @@ csmisas_get_location(unsigned long arg)
3907 if (((iocnum = mpt_verify_adapter(karg->IoctlHeader.IOControllerNumber,
3908 &ioc)) < 0) || (ioc == NULL)) {
3909 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
3910 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3911 + __FILE__, __func__, __LINE__, iocnum);
3912 free_pages((unsigned long)karg, memory_pages);
3913 return -ENODEV;
3914 }
3915
3916 if (!csmisas_is_this_sas_cntr(ioc)) {
3917 printk(KERN_ERR "%s::%s() @%d - ioc%d not SAS controller!\n",
3918 - __FILE__, __FUNCTION__, __LINE__, iocnum);
3919 + __FILE__, __func__, __LINE__, iocnum);
3920 free_pages((unsigned long)karg, memory_pages);
3921 return -ENODEV;
3922 }
3923
3924 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n",__FUNCTION__));
3925 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s enter.\n", __func__));
3926
3927 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_INVALID_PARAMETER;
3928 - if(karg->bLengthOfLocationIdentifier !=
3929 + if (karg->bLengthOfLocationIdentifier !=
3930 sizeof(CSMI_SAS_LOCATION_IDENTIFIER))
3931 goto cim_sas_get_location_exit;
3932
3933 @@ -5834,12 +5828,12 @@ csmisas_get_location(unsigned long arg)
3934
3935 /* RAID SUPPORT */
3936 if (ioc->raid_data.pIocPg2 && sas_info->is_logical_volume) {
3937 - for (i=0; i<ioc->raid_data.pIocPg2->NumActiveVolumes; i++){
3938 + for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
3939 if (sas_info->fw.id ==
3940 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID &&
3941 sas_info->fw.channel ==
3942 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus) {
3943 - if(csmisas_fill_location_data_raid(ioc, karg,
3944 + if (csmisas_fill_location_data_raid(ioc, karg,
3945 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus,
3946 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) == 0)
3947 karg->IoctlHeader.ReturnCode =
3948 @@ -5858,13 +5852,13 @@ csmisas_get_location(unsigned long arg)
3949
3950 /* make sure there's enough room to populate the Location[] struct */
3951 if ((csmi_sas_get_location_sz -
3952 - offsetof(CSMI_SAS_GET_LOCATION_BUFFER,Location)) <
3953 + offsetof(CSMI_SAS_GET_LOCATION_BUFFER, Location)) <
3954 sizeof(CSMI_SAS_LOCATION_IDENTIFIER))
3955 goto cim_sas_get_location_exit;
3956
3957 - karg->bNumberOfLocationIdentifiers=1;
3958 - karg->Location[0].bLocationFlags=0;
3959 - if((csmisas_fill_location_data(ioc, sas_info->fw.channel,
3960 + karg->bNumberOfLocationIdentifiers = 1;
3961 + karg->Location[0].bLocationFlags = 0;
3962 + if ((csmisas_fill_location_data(ioc, sas_info->fw.channel,
3963 sas_info->fw.id, karg->bIdentify, &karg->Location[0])) == 0)
3964 karg->IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;
3965 else
3966 @@ -5877,12 +5871,12 @@ csmisas_get_location(unsigned long arg)
3967 if (copy_to_user(uarg, karg, csmi_sas_get_location_sz)) {
3968 printk(KERN_ERR "%s@%d::%s() - "
3969 "Unable to write out csmi_sas_get_location_buffer "
3970 - "@ %p\n",__FILE__, __LINE__, __FUNCTION__, uarg);
3971 + "@ %p\n", __FILE__, __LINE__, __func__, uarg);
3972 free_pages((unsigned long)karg, memory_pages);
3973 return -EFAULT;
3974 }
3975
3976 - dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n",__FUNCTION__));
3977 + dcsmisasprintk(ioc, printk(KERN_DEBUG "%s exit.\n", __func__));
3978 free_pages((unsigned long)karg, memory_pages);
3979 return 0;
3980 }
3981 --- a/drivers/message/fusion/csmi/csmisas.h
3982 +++ b/drivers/message/fusion/csmi/csmisas.h
3983 @@ -87,10 +87,10 @@ Revision History:
3984 #ifndef _CSMI_SAS_H_
3985 #define _CSMI_SAS_H_
3986
3987 -// CSMI Specification Revision, the intent is that all versions of the
3988 -// specification will be backward compatible after the 1.00 release.
3989 -// Major revision number, corresponds to xxxx. of CSMI specification
3990 -// Minor revision number, corresponds to .xxxx of CSMI specification
3991 +/* CSMI Specification Revision, the intent is that all versions of the
3992 + specification will be backward compatible after the 1.00 release.
3993 + Major revision number, corresponds to xxxx. of CSMI specification
3994 + Minor revision number, corresponds to .xxxx of CSMI specification */
3995 #define CSMI_MAJOR_REVISION 0
3996 #define CSMI_MINOR_REVISION 90
3997
3998 @@ -104,60 +104,60 @@ Revision History:
3999 /* TARGET OS LINUX SPECIFIC CODE */
4000 /*************************************************************************/
4001
4002 -// EDM #ifdef _linux
4003 #ifdef __KERNEL__
4004
4005 -// Linux base types
4006 +/* Linux base types */
4007
4008 #include <linux/types.h>
4009
4010 #define __i8 char
4011
4012 -// pack definition
4013 +/* pack definition */
4014
4015 -// EDM #define CSMI_SAS_BEGIN_PACK(x) pack(x)
4016 -// EDM #define CSMI_SAS_END_PACK pack()
4017 +#if 0
4018 + #define CSMI_SAS_BEGIN_PACK(x) pack(x)
4019 + #define CSMI_SAS_END_PACK pack()
4020
4021 -// IOCTL Control Codes
4022 -// (IoctlHeader.ControlCode)
4023 + /* IOCTL Control Codes */
4024 + /* (IoctlHeader.ControlCode) */
4025
4026 -// Control Codes prior to 0.77
4027 + /* Control Codes prior to 0.77 */
4028
4029 -// Control Codes requiring CSMI_ALL_SIGNATURE
4030 + /* Control Codes requiring CSMI_ALL_SIGNATURE */
4031
4032 -// #define CC_CSMI_SAS_GET_DRIVER_INFO 0x12345678
4033 -// #define CC_CSMI_SAS_GET_CNTLR_CONFIG 0x23456781
4034 -// #define CC_CSMI_SAS_GET_CNTLR_STATUS 0x34567812
4035 -// #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0x92345678
4036 + #define CC_CSMI_SAS_GET_DRIVER_INFO 0x12345678
4037 + #define CC_CSMI_SAS_GET_CNTLR_CONFIG 0x23456781
4038 + #define CC_CSMI_SAS_GET_CNTLR_STATUS 0x34567812
4039 + #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0x92345678
4040
4041 -// Control Codes requiring CSMI_RAID_SIGNATURE
4042 + /* Control Codes requiring CSMI_RAID_SIGNATURE */
4043
4044 -// #define CC_CSMI_SAS_GET_RAID_INFO 0x45678123
4045 -// #define CC_CSMI_SAS_GET_RAID_CONFIG 0x56781234
4046 + #define CC_CSMI_SAS_GET_RAID_INFO 0x45678123
4047 + #define CC_CSMI_SAS_GET_RAID_CONFIG 0x56781234
4048
4049 -// Control Codes requiring CSMI_SAS_SIGNATURE
4050 + /* Control Codes requiring CSMI_SAS_SIGNATURE */
4051
4052 -// #define CC_CSMI_SAS_GET_PHY_INFO 0x67812345
4053 -// #define CC_CSMI_SAS_SET_PHY_INFO 0x78123456
4054 -// #define CC_CSMI_SAS_GET_LINK_ERRORS 0x81234567
4055 -// #define CC_CSMI_SAS_SMP_PASSTHRU 0xA1234567
4056 -// #define CC_CSMI_SAS_SSP_PASSTHRU 0xB1234567
4057 -// #define CC_CSMI_SAS_STP_PASSTHRU 0xC1234567
4058 -// #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xD1234567
4059 -// #define CC_CSMI_SAS_GET_SCSI_ADDRESS 0xE1234567
4060 -// #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xF1234567
4061 -// #define CC_CSMI_SAS_TASK_MANAGEMENT 0xA2345678
4062 -
4063 -// Control Codes for 0.77 and later
4064 + #define CC_CSMI_SAS_GET_PHY_INFO 0x67812345
4065 + #define CC_CSMI_SAS_SET_PHY_INFO 0x78123456
4066 + #define CC_CSMI_SAS_GET_LINK_ERRORS 0x81234567
4067 + #define CC_CSMI_SAS_SMP_PASSTHRU 0xA1234567
4068 + #define CC_CSMI_SAS_SSP_PASSTHRU 0xB1234567
4069 + #define CC_CSMI_SAS_STP_PASSTHRU 0xC1234567
4070 + #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xD1234567
4071 + #define CC_CSMI_SAS_GET_SCSI_ADDRESS 0xE1234567
4072 + #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xF1234567
4073 + #define CC_CSMI_SAS_TASK_MANAGEMENT 0xA2345678
4074 +#endif
4075 + /* Control Codes for 0.77 and later */
4076
4077 -// Control Codes requiring CSMI_ALL_SIGNATURE
4078 + /* Control Codes requiring CSMI_ALL_SIGNATURE */
4079
4080 #define CC_CSMI_SAS_GET_DRIVER_INFO 0xCC770001
4081 #define CC_CSMI_SAS_GET_CNTLR_CONFIG 0xCC770002
4082 #define CC_CSMI_SAS_GET_CNTLR_STATUS 0xCC770003
4083 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0xCC770004
4084
4085 -// Control Codes requiring CSMI_RAID_SIGNATURE
4086 +/* Control Codes requiring CSMI_RAID_SIGNATURE */
4087
4088 #define CC_CSMI_SAS_GET_RAID_INFO 0xCC77000A
4089 #define CC_CSMI_SAS_GET_RAID_CONFIG 0xCC77000B
4090 @@ -166,7 +166,7 @@ Revision History:
4091 #define CC_CSMI_SAS_GET_RAID_ELEMENT 0xCC77000E
4092 #define CC_CSMI_SAS_SET_RAID_OPERATION 0xCC77000F
4093
4094 -// Control Codes requiring CSMI_SAS_SIGNATURE
4095 +/* Control Codes requiring CSMI_SAS_SIGNATURE */
4096
4097 #define CC_CSMI_SAS_GET_PHY_INFO 0xCC770014
4098 #define CC_CSMI_SAS_SET_PHY_INFO 0xCC770015
4099 @@ -182,14 +182,14 @@ Revision History:
4100 #define CC_CSMI_SAS_GET_LOCATION 0xCC770025
4101
4102
4103 -// Control Codes requiring CSMI_PHY_SIGNATURE
4104 +/* Control Codes requiring CSMI_PHY_SIGNATURE */
4105
4106 #define CC_CSMI_SAS_PHY_CONTROL 0xCC77003C
4107
4108 -// EDM #pragma CSMI_SAS_BEGIN_PACK(8)
4109 +/* #pragma CSMI_SAS_BEGIN_PACK(8) */
4110 #pragma pack(8)
4111
4112 -// IOCTL_HEADER
4113 +/* IOCTL_HEADER */
4114 typedef struct _IOCTL_HEADER {
4115 __u32 IOControllerNumber;
4116 __u32 Length;
4117 @@ -199,189 +199,18 @@ typedef struct _IOCTL_HEADER {
4118 } IOCTL_HEADER,
4119 *PIOCTL_HEADER;
4120
4121 -// EDM #pragma CSMI_SAS_END_PACK
4122 -#pragma pack()
4123 -
4124 -#endif
4125 -
4126 -/*************************************************************************/
4127 -/* TARGET OS WINDOWS SPECIFIC CODE */
4128 -/*************************************************************************/
4129 -
4130 -#ifdef _WIN32
4131 -
4132 -// windows IOCTL definitions
4133 -
4134 -#ifndef _NTDDSCSIH_
4135 -#include <ntddscsi.h>
4136 -#endif
4137 -
4138 -// pack definition
4139 -
4140 -#if defined _MSC_VER
4141 - #define CSMI_SAS_BEGIN_PACK(x) pack(push,x)
4142 - #define CSMI_SAS_END_PACK pack(pop)
4143 -#elif defined __BORLANDC__
4144 - #define CSMI_SAS_BEGIN_PACK(x) option -a##x
4145 - #define CSMI_SAS_END_PACK option -a.
4146 -#else
4147 - #error "CSMISAS.H - Must externally define a pack compiler designator."
4148 -#endif
4149 -
4150 -// base types
4151 -
4152 -#define __u8 unsigned char
4153 -#define __u16 unsigned short
4154 -#define __u32 unsigned long
4155 -#define __u64 unsigned __int64
4156 -
4157 -#define __i8 char
4158 -
4159 -// IOCTL Control Codes
4160 -// (IoctlHeader.ControlCode)
4161 -
4162 -// Control Codes requiring CSMI_ALL_SIGNATURE
4163 -
4164 -#define CC_CSMI_SAS_GET_DRIVER_INFO 1
4165 -#define CC_CSMI_SAS_GET_CNTLR_CONFIG 2
4166 -#define CC_CSMI_SAS_GET_CNTLR_STATUS 3
4167 -#define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 4
4168 -
4169 -// Control Codes requiring CSMI_RAID_SIGNATURE
4170 -
4171 -#define CC_CSMI_SAS_GET_RAID_INFO 10
4172 -#define CC_CSMI_SAS_GET_RAID_CONFIG 11
4173 -#define CC_CSMI_SAS_GET_RAID_FEATURES 12
4174 -#define CC_CSMI_SAS_SET_RAID_CONTROL 13
4175 -#define CC_CSMI_SAS_GET_RAID_ELEMENT 14
4176 -#define CC_CSMI_SAS_SET_RAID_OPERATION 15
4177 -
4178 -// Control Codes requiring CSMI_SAS_SIGNATURE
4179 -
4180 -#define CC_CSMI_SAS_GET_PHY_INFO 20
4181 -#define CC_CSMI_SAS_SET_PHY_INFO 21
4182 -#define CC_CSMI_SAS_GET_LINK_ERRORS 22
4183 -#define CC_CSMI_SAS_SMP_PASSTHRU 23
4184 -#define CC_CSMI_SAS_SSP_PASSTHRU 24
4185 -#define CC_CSMI_SAS_STP_PASSTHRU 25
4186 -#define CC_CSMI_SAS_GET_SATA_SIGNATURE 26
4187 -#define CC_CSMI_SAS_GET_SCSI_ADDRESS 27
4188 -#define CC_CSMI_SAS_GET_DEVICE_ADDRESS 28
4189 -#define CC_CSMI_SAS_TASK_MANAGEMENT 29
4190 -#define CC_CSMI_SAS_GET_CONNECTOR_INFO 30
4191 -#define CC_CSMI_SAS_GET_LOCATION 31
4192 -
4193 -// Control Codes requiring CSMI_PHY_SIGNATURE
4194 -
4195 -#define CC_CSMI_SAS_PHY_CONTROL 60
4196 -
4197 -#define IOCTL_HEADER SRB_IO_CONTROL
4198 -#define PIOCTL_HEADER PSRB_IO_CONTROL
4199 -
4200 -#endif
4201 -
4202 -/*************************************************************************/
4203 -/* TARGET OS NETWARE SPECIFIC CODE */
4204 -/*************************************************************************/
4205 -
4206 -#ifdef _NETWARE
4207 -
4208 -// NetWare IOCTL definitions
4209 -
4210 -#define CSMI_SAS_BEGIN_PACK(x) pack(x)
4211 -#define CSMI_SAS_END_PACK pack()
4212 -
4213 -#ifndef LONG
4214 -typedef unsigned long LONG;
4215 -#endif
4216 -
4217 -#ifndef WORD
4218 -typedef unsigned short WORD;
4219 -#endif
4220 -
4221 -#ifndef BYTE
4222 -typedef unsigned char BYTE;
4223 -#endif
4224 -
4225 -/* Need to have these definitions for Netware */
4226 -#define __u8 unsigned char
4227 -#define __u16 unsigned short
4228 -#define __u32 unsigned long
4229 -#define __u64 unsigned __int64
4230 -
4231 -#define __i8 char
4232 -
4233 -
4234 -// EDM #pragma CSMI_SAS_BEGIN_PACK(8)
4235 -#pragma pack(8)
4236 -
4237 -// IOCTL_HEADER
4238 -typedef struct _IOCTL_HEADER {
4239 - __u32 Length;
4240 - __u32 ReturnCode;
4241 -} IOCTL_HEADER,
4242 - *PIOCTL_HEADER;
4243 -
4244 -// EDM #pragma CSMI_SAS_END_PACK
4245 #pragma pack()
4246
4247 -// IOCTL Control Codes
4248 -// (IoctlHeader.ControlCode)
4249 -
4250 -// Control Codes requiring CSMI_ALL_SIGNATURE
4251 -
4252 -#define CC_CSMI_SAS_GET_DRIVER_INFO 0x01FF0001
4253 -#define CC_CSMI_SAS_GET_CNTLR_CONFIG 0x01FF0002
4254 -#define CC_CSMI_SAS_GET_CNTLR_STATUS 0x01FF0003
4255 -#define CC_CSMI_SAS_FIRMWARE_DOWNLOAD 0x01FF0004
4256 -
4257 -// Control Codes requiring CSMI_RAID_SIGNATURE
4258 -
4259 -#define CC_CSMI_SAS_GET_RAID_INFO 0x01FF000A
4260 -#define CC_CSMI_SAS_GET_RAID_CONFIG 0x01FF000B
4261 -#define CC_CSMI_SAS_GET_RAID_FEATURES 0x01FF000C
4262 -#define CC_CSMI_SAS_SET_RAID_CONTROL 0x01FF000D
4263 -#define CC_CSMI_SAS_GET_RAID_ELEMENT 0x01FF000E
4264 -#define CC_CSMI_SAS_SET_RAID_OPERATION 0x01FF000F
4265 -
4266 -// Control Codes requiring CSMI_SAS_SIGNATURE
4267 -
4268 -#define CC_CSMI_SAS_GET_PHY_INFO 0x01FF0014
4269 -#define CC_CSMI_SAS_SET_PHY_INFO 0x01FF0015
4270 -#define CC_CSMI_SAS_GET_LINK_ERRORS 0x01FF0016
4271 -#define CC_CSMI_SAS_SMP_PASSTHRU 0x01FF0017
4272 -#define CC_CSMI_SAS_SSP_PASSTHRU 0x01FF0018
4273 -#define CC_CSMI_SAS_STP_PASSTHRU 0x01FF0019
4274 -#define CC_CSMI_SAS_GET_SATA_SIGNATURE 0x01FF001A
4275 -#define CC_CSMI_SAS_GET_SCSI_ADDRESS 0x01FF001B
4276 -#define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0x01FF001C
4277 -#define CC_CSMI_SAS_TASK_MANAGEMENT 0x01FF001D
4278 -#define CC_CSMI_SAS_GET_CONNECTOR_INFO 0x01FF001E
4279 -#define CC_CSMI_SAS_GET_LOCATION 0x01FF001F
4280 -
4281 -// Control Codes requiring CSMI_PHY_SIGNATURE
4282 -
4283 -#define CC_CSMI_SAS_PHY_CONTROL 60
4284 -
4285 #endif
4286
4287 /*************************************************************************/
4288 -/* TARGET OS NOT DEFINED ERROR */
4289 -/*************************************************************************/
4290 -
4291 -// EDM
4292 -//#if (!_WIN32 && !_linux && !_NETWARE)
4293 -// #error "Unknown target OS."
4294 -//#endif
4295 -
4296 -/*************************************************************************/
4297 /* OS INDEPENDENT CODE */
4298 /*************************************************************************/
4299
4300 /* * * * * * * * * * Class Independent IOCTL Constants * * * * * * * * * */
4301
4302 -// Return codes for all IOCTL's regardless of class
4303 -// (IoctlHeader.ReturnCode)
4304 +/* Return codes for all IOCTL's regardless of class*/
4305 +/* (IoctlHeader.ReturnCode) */
4306
4307 #define CSMI_SAS_STATUS_SUCCESS 0
4308 #define CSMI_SAS_STATUS_FAILED 1
4309 @@ -389,51 +218,51 @@ typedef struct _IOCTL_HEADER {
4310 #define CSMI_SAS_STATUS_INVALID_PARAMETER 3
4311 #define CSMI_SAS_STATUS_WRITE_ATTEMPTED 4
4312
4313 -// Signature value
4314 -// (IoctlHeader.Signature)
4315 +/* Signature value
4316 + (IoctlHeader.Signature) */
4317
4318 #define CSMI_ALL_SIGNATURE "CSMIALL"
4319
4320 -// Timeout value default of 60 seconds
4321 -// (IoctlHeader.Timeout)
4322 +/* Timeout value default of 60 seconds
4323 + (IoctlHeader.Timeout) */
4324
4325 #define CSMI_ALL_TIMEOUT 60
4326
4327 -// Direction values for data flow on this IOCTL
4328 -// (IoctlHeader.Direction, Linux only)
4329 +/* Direction values for data flow on this IOCTL
4330 + (IoctlHeader.Direction, Linux only) */
4331 #define CSMI_SAS_DATA_READ 0
4332 #define CSMI_SAS_DATA_WRITE 1
4333
4334 -// I/O Bus Types
4335 -// ISA and EISA bus types are not supported
4336 -// (bIoBusType)
4337 +/* I/O Bus Types
4338 + ISA and EISA bus types are not supported
4339 + (bIoBusType) */
4340
4341 #define CSMI_SAS_BUS_TYPE_PCI 3
4342 #define CSMI_SAS_BUS_TYPE_PCMCIA 4
4343
4344 -// Controller Status
4345 -// (uStatus)
4346 +/* Controller Status
4347 + (uStatus) */
4348
4349 #define CSMI_SAS_CNTLR_STATUS_GOOD 1
4350 #define CSMI_SAS_CNTLR_STATUS_FAILED 2
4351 #define CSMI_SAS_CNTLR_STATUS_OFFLINE 3
4352 #define CSMI_SAS_CNTLR_STATUS_POWEROFF 4
4353
4354 -// Offline Status Reason
4355 -// (uOfflineReason)
4356 +/* Offline Status Reason
4357 + (uOfflineReason) */
4358
4359 #define CSMI_SAS_OFFLINE_REASON_NO_REASON 0
4360 #define CSMI_SAS_OFFLINE_REASON_INITIALIZING 1
4361 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_DEGRADED 2
4362 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_FAILURE 3
4363
4364 -// Controller Class
4365 -// (bControllerClass)
4366 +/* Controller Class
4367 + (bControllerClass) */
4368
4369 #define CSMI_SAS_CNTLR_CLASS_HBA 5
4370
4371 -// Controller Flag bits
4372 -// (uControllerFlags)
4373 +/* Controller Flag bits
4374 + (uControllerFlags) */
4375
4376 #define CSMI_SAS_CNTLR_SAS_HBA 0x00000001
4377 #define CSMI_SAS_CNTLR_SAS_RAID 0x00000002
4378 @@ -441,32 +270,29 @@ typedef struct _IOCTL_HEADER {
4379 #define CSMI_SAS_CNTLR_SATA_RAID 0x00000008
4380 #define CSMI_SAS_CNTLR_SMART_ARRAY 0x00000010
4381
4382 -// for firmware download
4383 +/* for firmware download */
4384 #define CSMI_SAS_CNTLR_FWD_SUPPORT 0x00010000
4385 #define CSMI_SAS_CNTLR_FWD_ONLINE 0x00020000
4386 #define CSMI_SAS_CNTLR_FWD_SRESET 0x00040000
4387 #define CSMI_SAS_CNTLR_FWD_HRESET 0x00080000
4388 #define CSMI_SAS_CNTLR_FWD_RROM 0x00100000
4389
4390 -// for RAID configuration supported
4391 +/* for RAID configuration supported */
4392 #define CSMI_SAS_CNTLR_RAID_CFG_SUPPORT 0x01000000
4393
4394 -// Download Flag bits
4395 -// (uDownloadFlags)
4396 +/* Download Flag bits (uDownloadFlags) */
4397 #define CSMI_SAS_FWD_VALIDATE 0x00000001
4398 #define CSMI_SAS_FWD_SOFT_RESET 0x00000002
4399 #define CSMI_SAS_FWD_HARD_RESET 0x00000004
4400
4401 -// Firmware Download Status
4402 -// (usStatus)
4403 +/* Firmware Download Status (usStatus) */
4404 #define CSMI_SAS_FWD_SUCCESS 0
4405 #define CSMI_SAS_FWD_FAILED 1
4406 #define CSMI_SAS_FWD_USING_RROM 2
4407 #define CSMI_SAS_FWD_REJECT 3
4408 #define CSMI_SAS_FWD_DOWNREV 4
4409
4410 -// Firmware Download Severity
4411 -// (usSeverity>
4412 +/* Firmware Download Severity (usSeverity) */
4413 #define CSMI_SAS_FWD_INFORMATION 0
4414 #define CSMI_SAS_FWD_WARNING 1
4415 #define CSMI_SAS_FWD_ERROR 2
4416 @@ -474,25 +300,22 @@ typedef struct _IOCTL_HEADER {
4417
4418 /* * * * * * * * * * SAS RAID Class IOCTL Constants * * * * * * * * */
4419
4420 -// Return codes for the RAID IOCTL's regardless of class
4421 -// (IoctlHeader.ReturnCode)
4422 +/* Return codes for the RAID IOCTL's regardless of class */
4423 +/* (IoctlHeader.ReturnCode) */
4424
4425 #define CSMI_SAS_RAID_SET_OUT_OF_RANGE 1000
4426 #define CSMI_SAS_RAID_SET_BUFFER_TOO_SMALL 1001
4427 #define CSMI_SAS_RAID_SET_DATA_CHANGED 1002
4428
4429 -// Signature value
4430 -// (IoctlHeader.Signature)
4431 +/* Signature value (IoctlHeader.Signature) */
4432
4433 #define CSMI_RAID_SIGNATURE "CSMIARY"
4434
4435 -// Timeout value default of 60 seconds
4436 -// (IoctlHeader.Timeout)
4437 +/* Timeout value default of 60 seconds (IoctlHeader.Timeout) */
4438
4439 #define CSMI_RAID_TIMEOUT 60
4440
4441 -// RAID Types
4442 -// (bRaidType)
4443 +/* RAID Types (bRaidType) */
4444 #define CSMI_SAS_RAID_TYPE_NONE 0
4445 #define CSMI_SAS_RAID_TYPE_0 1
4446 #define CSMI_SAS_RAID_TYPE_1 2
4447 @@ -504,12 +327,11 @@ typedef struct _IOCTL_HEADER {
4448 #define CSMI_SAS_RAID_TYPE_VOLUME 8
4449 #define CSMI_SAS_RAID_TYPE_1E 9
4450 #define CSMI_SAS_RAID_TYPE_OTHER 255
4451 -// the last value 255 was already defined for other
4452 -// so end is defined as 254
4453 +/* the last value 255 was already defined for other so end is defined as 254 */
4454 #define CSMI_SAS_RAID_TYPE_END 254
4455
4456 -// RAID Status
4457 -// (bStatus)
4458 +/* RAID Status (bStatus) */
4459 +
4460 #define CSMI_SAS_RAID_SET_STATUS_OK 0
4461 #define CSMI_SAS_RAID_SET_STATUS_DEGRADED 1
4462 #define CSMI_SAS_RAID_SET_STATUS_REBUILDING 2
4463 @@ -519,19 +341,16 @@ typedef struct _IOCTL_HEADER {
4464 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_REBUILD 6
4465 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_TRANSFORMATION 7
4466
4467 -// RAID Drive Count
4468 -// (bDriveCount, 0xF1 to 0xFF are reserved)
4469 +/* RAID Drive Count (bDriveCount, 0xF1 to 0xFF are reserved) */
4470 #define CSMI_SAS_RAID_DRIVE_COUNT_TOO_BIG 0xF1
4471 #define CSMI_SAS_RAID_DRIVE_COUNT_SUPRESSED 0xF2
4472
4473 -// RAID Data Type
4474 -// (bDataType)
4475 +/* RAID Data Type (bDataType) */
4476 #define CSMI_SAS_RAID_DATA_DRIVES 0
4477 #define CSMI_SAS_RAID_DATA_DEVICE_ID 1
4478 #define CSMI_SAS_RAID_DATA_ADDITIONAL_DATA 2
4479
4480 -// RAID Drive Status
4481 -// (bDriveStatus)
4482 +/* RAID Drive Status (bDriveStatus) */
4483 #define CSMI_SAS_DRIVE_STATUS_OK 0
4484 #define CSMI_SAS_DRIVE_STATUS_REBUILDING 1
4485 #define CSMI_SAS_DRIVE_STATUS_FAILED 2
4486 @@ -539,15 +358,13 @@ typedef struct _IOCTL_HEADER {
4487 #define CSMI_SAS_DRIVE_STATUS_OFFLINE 4
4488 #define CSMI_SAS_DRIVE_STATUS_QUEUED_FOR_REBUILD 5
4489
4490 -// RAID Drive Usage
4491 -// (bDriveUsage)
4492 +/* RAID Drive Usage (bDriveUsage) */
4493 #define CSMI_SAS_DRIVE_CONFIG_NOT_USED 0
4494 #define CSMI_SAS_DRIVE_CONFIG_MEMBER 1
4495 #define CSMI_SAS_DRIVE_CONFIG_SPARE 2
4496 #define CSMI_SAS_DRIVE_CONFIG_SPARE_ACTIVE 3
4497
4498 -// RAID Drive Type
4499 -// (bDriveType)
4500 +/* RAID Drive Type (bDriveType) */
4501 #define CSMI_SAS_DRIVE_TYPE_UNKNOWN 0
4502 #define CSMI_SAS_DRIVE_TYPE_SINGLE_PORT_SAS 1
4503 #define CSMI_SAS_DRIVE_TYPE_DUAL_PORT_SAS 2
4504 @@ -555,23 +372,20 @@ typedef struct _IOCTL_HEADER {
4505 #define CSMI_SAS_DRIVE_TYPE_SATA_PS 4
4506 #define CSMI_SAS_DRIVE_TYPE_OTHER 255
4507
4508 -// RAID Write Protect
4509 -// (bWriteProtect)
4510 +/* RAID Write Protect (bWriteProtect) */
4511 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNKNOWN 0
4512 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNCHANGED 0
4513 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_ENABLED 1
4514 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_DISABLED 2
4515
4516 -// RAID Cache Setting
4517 -// (bCacheSetting)
4518 +/* RAID Cache Setting (bCacheSetting) */
4519 #define CSMI_SAS_RAID_SET_CACHE_UNKNOWN 0
4520 #define CSMI_SAS_RAID_SET_CACHE_UNCHANGED 0
4521 #define CSMI_SAS_RAID_SET_CACHE_ENABLED 1
4522 #define CSMI_SAS_RAID_SET_CACHE_DISABLED 2
4523 #define CSMI_SAS_RAID_SET_CACHE_CORRUPT 3
4524
4525 -// RAID Features
4526 -// (uFeatures)
4527 +/* RAID Features (uFeatures) */
4528 #define CSMI_SAS_RAID_FEATURE_TRANSFORMATION 0x00000001
4529 #define CSMI_SAS_RAID_FEATURE_REBUILD 0x00000002
4530 #define CSMI_SAS_RAID_FEATURE_SPLIT_MIRROR 0x00000004
4531 @@ -580,8 +394,7 @@ typedef struct _IOCTL_HEADER {
4532 #define CSMI_SAS_RAID_FEATURE_SURFACE_SCAN 0x00000020
4533 #define CSMI_SAS_RAID_FEATURE_SPARES_SHARED 0x00000040
4534
4535 -// RAID Priority
4536 -// (bDefaultTransformPriority, etc.)
4537 +/* RAID Priority (bDefaultTransformPriority, etc.) */
4538 #define CSMI_SAS_PRIORITY_UNKNOWN 0
4539 #define CSMI_SAS_PRIORITY_UNCHANGED 0
4540 #define CSMI_SAS_PRIORITY_AUTO 1
4541 @@ -590,30 +403,25 @@ typedef struct _IOCTL_HEADER {
4542 #define CSMI_SAS_PRIORITY_MEDIUM 4
4543 #define CSMI_SAS_PRIORITY_HIGH 5
4544
4545 -// RAID Transformation Rules
4546 -// (uRaidSetTransformationRules)
4547 +/* RAID Transformation Rules (uRaidSetTransformationRules) */
4548 #define CSMI_SAS_RAID_RULE_AVAILABLE_MEMORY 0x00000001
4549 #define CSMI_SAS_RAID_RULE_OVERLAPPED_EXTENTS 0x00000002
4550
4551 -// RAID Cache Ratios Supported
4552 -// (bCacheRatiosSupported)
4553 -// from 0 to 100 defines the write to read ratio, 0 is 100% write
4554 +/* RAID Cache Ratios Supported (bCacheRatiosSupported) */
4555 +/* from 0 to 100 defines the write to read ratio, 0 is 100% write */
4556 #define CSMI_SAS_RAID_CACHE_RATIO_RANGE 101
4557 #define CSMI_SAS_RAID_CACHE_RATIO_FIXED 102
4558 #define CSMI_SAS_RAID_CACHE_RATIO_AUTO 103
4559 #define CSMI_SAS_RAID_CACHE_RATIO_END 255
4560
4561 -// RAID Cache Ratio Flag
4562 -// (bCacheRatioFlag)
4563 +/* RAID Cache Ratio Flag (bCacheRatioFlag) */
4564 #define CSMI_SAS_RAID_CACHE_RATIO_DISABLE 0
4565 #define CSMI_SAS_RAID_CACHE_RATIO_ENABLE 1
4566
4567 -// RAID Clear Configuration Signature
4568 -// (bClearConfiguration)
4569 +/* RAID Clear Configuration Signature (bClearConfiguration) */
4570 #define CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE "RAIDCLR"
4571
4572 -// RAID Failure Codes
4573 -// (uFailureCode)
4574 +/* RAID Failure Codes (uFailureCode) */
4575 #define CSMI_SAS_FAIL_CODE_OK 0
4576 #define CSMI_SAS_FAIL_CODE_PARAMETER_INVALID 1000
4577 #define CSMI_SAS_FAIL_CODE_TRANSFORM_PRIORITY_INVALID 1001
4578 @@ -638,22 +446,19 @@ typedef struct _IOCTL_HEADER {
4579
4580 #define CSMI_SAS_FAIL_CODE_WAIT_FOR_OPERATION 3000
4581
4582 -// RAID Enumeration Types
4583 -// (uEnumerationType)
4584 +/* RAID Enumeration Types (uEnumerationType) */
4585 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE 0
4586 #define CSMI_SAS_RAID_ELEMENT_TYPE_MODULE 1
4587 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE_RAID_SET 2
4588 #define CSMI_SAS_RAID_ELEMENT_TYPE_EXTENT_DRIVE 3
4589
4590 -// RAID Extent Types
4591 -// (bExtentType)
4592 +/* RAID Extent Types (bExtentType) */
4593 #define CSMI_SAS_RAID_EXTENT_RESERVED 0
4594 #define CSMI_SAS_RAID_EXTENT_METADATA 1
4595 #define CSMI_SAS_RAID_EXTENT_ALLOCATED 2
4596 #define CSMI_SAS_RAID_EXTENT_UNALLOCATED 3
4597
4598 -// RAID Operation Types
4599 -// (uOperationType)
4600 +/* RAID Operation Types (uOperationType) */
4601 #define CSMI_SAS_RAID_SET_CREATE 0
4602 #define CSMI_SAS_RAID_SET_LABEL 1
4603 #define CSMI_SAS_RAID_SET_TRANSFORM 2
4604 @@ -663,23 +468,20 @@ typedef struct _IOCTL_HEADER {
4605 #define CSMI_SAS_RAID_SET_ONLINE_STATE 6
4606 #define CSMI_SAS_RAID_SET_SPARE 7
4607
4608 -// RAID Transform Types
4609 -// (bTransformType)
4610 +/* RAID Transform Types (bTransformType) */
4611 #define CSMI_SAS_RAID_SET_TRANSFORM_SPLIT_MIRROR 0
4612 #define CSMI_SAS_RAID_SET_TRANSFORM_MERGE_RAID_0 1
4613 #define CSMI_SAS_RAID_SET_TRANSFORM_LUN_RENUMBER 2
4614 #define CSMI_SAS_RAID_SET_TRANSFORM_RAID_SET 3
4615
4616 -// RAID Online State
4617 -// (bOnlineState)
4618 +/* RAID Online State (bOnlineState) */
4619 #define CSMI_SAS_RAID_SET_STATE_UNKNOWN 0
4620 #define CSMI_SAS_RAID_SET_STATE_ONLINE 1
4621 #define CSMI_SAS_RAID_SET_STATE_OFFLINE 2
4622
4623 /* * * * * * * * * * SAS HBA Class IOCTL Constants * * * * * * * * * */
4624
4625 -// Return codes for SAS IOCTL's
4626 -// (IoctlHeader.ReturnCode)
4627 +/* Return codes for SAS IOCTL's (IoctlHeader.ReturnCode) */
4628
4629 #define CSMI_SAS_PHY_INFO_CHANGED CSMI_SAS_STATUS_SUCCESS
4630 #define CSMI_SAS_PHY_INFO_NOT_CHANGEABLE 2000
4631 @@ -700,18 +502,15 @@ typedef struct _IOCTL_HEADER {
4632 #define CSMI_SAS_NO_SCSI_ADDRESS 2013
4633 #define CSMI_SAS_NO_DEVICE_ADDRESS 2014
4634
4635 -// Signature value
4636 -// (IoctlHeader.Signature)
4637 +/* Signature value (IoctlHeader.Signature) */
4638
4639 #define CSMI_SAS_SIGNATURE "CSMISAS"
4640
4641 -// Timeout value default of 60 seconds
4642 -// (IoctlHeader.Timeout)
4643 +/* Timeout value default of 60 seconds (IoctlHeader.Timeout) */
4644
4645 #define CSMI_SAS_TIMEOUT 60
4646
4647 -// Device types
4648 -// (bDeviceType)
4649 +/* Device types (bDeviceType) */
4650
4651 #define CSMI_SAS_PHY_UNUSED 0x00
4652 #define CSMI_SAS_NO_DEVICE_ATTACHED 0x00
4653 @@ -719,16 +518,15 @@ typedef struct _IOCTL_HEADER {
4654 #define CSMI_SAS_EDGE_EXPANDER_DEVICE 0x20
4655 #define CSMI_SAS_FANOUT_EXPANDER_DEVICE 0x30
4656
4657 -// Protocol options
4658 -// (bInitiatorPortProtocol, bTargetPortProtocol)
4659 +/* Protocol options (bInitiatorPortProtocol, bTargetPortProtocol) */
4660
4661 #define CSMI_SAS_PROTOCOL_SATA 0x01
4662 #define CSMI_SAS_PROTOCOL_SMP 0x02
4663 #define CSMI_SAS_PROTOCOL_STP 0x04
4664 #define CSMI_SAS_PROTOCOL_SSP 0x08
4665
4666 -// Negotiated and hardware link rates
4667 -// (bNegotiatedLinkRate, bMinimumLinkRate, bMaximumLinkRate)
4668 +/* Negotiated and hardware link rates */
4669 +/* (bNegotiatedLinkRate, bMinimumLinkRate, bMaximumLinkRate) */
4670
4671 #define CSMI_SAS_LINK_RATE_UNKNOWN 0x00
4672 #define CSMI_SAS_PHY_DISABLED 0x01
4673 @@ -739,8 +537,7 @@ typedef struct _IOCTL_HEADER {
4674 #define CSMI_SAS_LINK_RATE_3_0_GBPS 0x09
4675 #define CSMI_SAS_LINK_VIRTUAL 0x10
4676
4677 -// Discover state
4678 -// (bAutoDiscover)
4679 +/* Discover state (bAutoDiscover) */
4680
4681 #define CSMI_SAS_DISCOVER_NOT_SUPPORTED 0x00
4682 #define CSMI_SAS_DISCOVER_NOT_STARTED 0x01
4683 @@ -748,57 +545,49 @@ typedef struct _IOCTL_HEADER {
4684 #define CSMI_SAS_DISCOVER_COMPLETE 0x03
4685 #define CSMI_SAS_DISCOVER_ERROR 0x04
4686
4687 -// Phy features
4688 +/* Phy features */
4689
4690 #define CSMI_SAS_PHY_VIRTUAL_SMP 0x01
4691
4692 -// Programmed link rates
4693 -// (bMinimumLinkRate, bMaximumLinkRate)
4694 -// (bProgrammedMinimumLinkRate, bProgrammedMaximumLinkRate)
4695 +/* Programmed link rates (bMinimumLinkRate, bMaximumLinkRate) */
4696 +/* (bProgrammedMinimumLinkRate, bProgrammedMaximumLinkRate) */
4697
4698 #define CSMI_SAS_PROGRAMMED_LINK_RATE_UNCHANGED 0x00
4699 #define CSMI_SAS_PROGRAMMED_LINK_RATE_1_5_GBPS 0x08
4700 #define CSMI_SAS_PROGRAMMED_LINK_RATE_3_0_GBPS 0x09
4701
4702 -// Link rate
4703 -// (bNegotiatedLinkRate in CSMI_SAS_SET_PHY_INFO)
4704 +/* Link rate (bNegotiatedLinkRate in CSMI_SAS_SET_PHY_INFO) */
4705
4706 #define CSMI_SAS_LINK_RATE_NEGOTIATE 0x00
4707 #define CSMI_SAS_LINK_RATE_PHY_DISABLED 0x01
4708
4709 -// Signal class
4710 -// (bSignalClass in CSMI_SAS_SET_PHY_INFO)
4711 +/* Signal class (bSignalClass in CSMI_SAS_SET_PHY_INFO) */
4712
4713 #define CSMI_SAS_SIGNAL_CLASS_UNKNOWN 0x00
4714 #define CSMI_SAS_SIGNAL_CLASS_DIRECT 0x01
4715 #define CSMI_SAS_SIGNAL_CLASS_SERVER 0x02
4716 #define CSMI_SAS_SIGNAL_CLASS_ENCLOSURE 0x03
4717
4718 -// Link error reset
4719 -// (bResetCounts)
4720 +/* Link error reset (bResetCounts) */
4721
4722 #define CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS 0x00
4723 #define CSMI_SAS_LINK_ERROR_RESET_COUNTS 0x01
4724
4725 -// Phy identifier
4726 -// (bPhyIdentifier)
4727 +/* Phy identifier (bPhyIdentifier) */
4728
4729 #define CSMI_SAS_USE_PORT_IDENTIFIER 0xFF
4730
4731 -// Port identifier
4732 -// (bPortIdentifier)
4733 +/* Port identifier (bPortIdentifier) */
4734
4735 #define CSMI_SAS_IGNORE_PORT 0xFF
4736
4737 -// Programmed link rates
4738 -// (bConnectionRate)
4739 +/* Programmed link rates (bConnectionRate) */
4740
4741 #define CSMI_SAS_LINK_RATE_NEGOTIATED 0x00
4742 #define CSMI_SAS_LINK_RATE_1_5_GBPS 0x08
4743 #define CSMI_SAS_LINK_RATE_3_0_GBPS 0x09
4744
4745 -// Connection status
4746 -// (bConnectionStatus)
4747 +/* Connection status (bConnectionStatus) */
4748
4749 #define CSMI_SAS_OPEN_ACCEPT 0
4750 #define CSMI_SAS_OPEN_REJECT_BAD_DESTINATION 1
4751 @@ -814,8 +603,7 @@ typedef struct _IOCTL_HEADER {
4752 #define CSMI_SAS_OPEN_REJECT_STP_RESOURCES_BUSY 11
4753 #define CSMI_SAS_OPEN_REJECT_WRONG_DESTINATION 12
4754
4755 -// SSP Status
4756 -// (bSSPStatus)
4757 +/* SSP Status (bSSPStatus)*/
4758
4759 #define CSMI_SAS_SSP_STATUS_UNKNOWN 0x00
4760 #define CSMI_SAS_SSP_STATUS_WAITING 0x01
4761 @@ -824,8 +612,7 @@ typedef struct _IOCTL_HEADER {
4762 #define CSMI_SAS_SSP_STATUS_RETRY 0x04
4763 #define CSMI_SAS_SSP_STATUS_NO_TAG 0x05
4764
4765 -// SSP Flags
4766 -// (uFlags)
4767 +/* SSP Flags (uFlags) */
4768
4769 #define CSMI_SAS_SSP_READ 0x00000001
4770 #define CSMI_SAS_SSP_WRITE 0x00000002
4771 @@ -836,15 +623,13 @@ typedef struct _IOCTL_HEADER {
4772 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ORDERED 0x00000020
4773 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ACA 0x00000040
4774
4775 -// SSP Data present
4776 -// (bDataPresent)
4777 +/* SSP Data present (bDataPresent) */
4778
4779 #define CSMI_SAS_SSP_NO_DATA_PRESENT 0x00
4780 #define CSMI_SAS_SSP_RESPONSE_DATA_PRESENT 0x01
4781 #define CSMI_SAS_SSP_SENSE_DATA_PRESENT 0x02
4782
4783 -// STP Flags
4784 -// (uFlags)
4785 +/* STP Flags (uFlags) */
4786
4787 #define CSMI_SAS_STP_READ 0x00000001
4788 #define CSMI_SAS_STP_WRITE 0x00000002
4789 @@ -856,15 +641,13 @@ typedef struct _IOCTL_HEADER {
4790 #define CSMI_SAS_STP_EXECUTE_DIAG 0x00000100
4791 #define CSMI_SAS_STP_RESET_DEVICE 0x00000200
4792
4793 -// Task Management Flags
4794 -// (uFlags)
4795 +/* Task Management Flags (uFlags) */
4796
4797 #define CSMI_SAS_TASK_IU 0x00000001
4798 #define CSMI_SAS_HARD_RESET_SEQUENCE 0x00000002
4799 #define CSMI_SAS_SUPPRESS_RESULT 0x00000004
4800
4801 -// Task Management Functions
4802 -// (bTaskManagement)
4803 +/* Task Management Functions (bTaskManagement) */
4804
4805 #define CSMI_SAS_SSP_ABORT_TASK 0x01
4806 #define CSMI_SAS_SSP_ABORT_TASK_SET 0x02
4807 @@ -873,16 +656,14 @@ typedef struct _IOCTL_HEADER {
4808 #define CSMI_SAS_SSP_CLEAR_ACA 0x40
4809 #define CSMI_SAS_SSP_QUERY_TASK 0x80
4810
4811 -// Task Management Information
4812 -// (uInformation)
4813 +/* Task Management Information (uInformation) */
4814
4815 #define CSMI_SAS_SSP_TEST 1
4816 #define CSMI_SAS_SSP_EXCEEDED 2
4817 #define CSMI_SAS_SSP_DEMAND 3
4818 #define CSMI_SAS_SSP_TRIGGER 4
4819
4820 -// Connector Pinout Information
4821 -// (uPinout)
4822 +/* Connector Pinout Information (uPinout) */
4823
4824 #define CSMI_SAS_CON_UNKNOWN 0x00000001
4825 #define CSMI_SAS_CON_SFF_8482 0x00000002
4826 @@ -895,10 +676,9 @@ typedef struct _IOCTL_HEADER {
4827 #define CSMI_SAS_CON_SFF_8484_LANE_3 0x00040000
4828 #define CSMI_SAS_CON_SFF_8484_LANE_4 0x00080000
4829
4830 -// Connector Location Information
4831 -// (bLocation)
4832 +/* Connector Location Information (bLocation) */
4833
4834 -// same as uPinout above...
4835 +/* same as uPinout above... */
4836 // #define CSMI_SAS_CON_UNKNOWN 0x01
4837 #define CSMI_SAS_CON_INTERNAL 0x02
4838 #define CSMI_SAS_CON_EXTERNAL 0x04
4839 @@ -907,15 +687,13 @@ typedef struct _IOCTL_HEADER {
4840 #define CSMI_SAS_CON_NOT_PRESENT 0x20
4841 #define CSMI_SAS_CON_NOT_CONNECTED 0x80
4842
4843 -// Device location identification
4844 -// (bIdentify)
4845 +/* Device location identification (bIdentify) */
4846
4847 #define CSMI_SAS_LOCATE_UNKNOWN 0x00
4848 #define CSMI_SAS_LOCATE_FORCE_OFF 0x01
4849 #define CSMI_SAS_LOCATE_FORCE_ON 0x02
4850
4851 -// Location Valid flags
4852 -// (uLocationFlags)
4853 +/* Location Valid flags (uLocationFlags) */
4854
4855 #define CSMI_SAS_LOCATE_SAS_ADDRESS_VALID 0x00000001
4856 #define CSMI_SAS_LOCATE_SAS_LUN_VALID 0x00000002
4857 @@ -927,48 +705,41 @@ typedef struct _IOCTL_HEADER {
4858
4859 /* * * * * * * * SAS Phy Control Class IOCTL Constants * * * * * * * * */
4860
4861 -// Return codes for SAS Phy Control IOCTL's
4862 -// (IoctlHeader.ReturnCode)
4863 +/* Return codes for SAS Phy Control IOCTL's (IoctlHeader.ReturnCode) */
4864
4865 -// Signature value
4866 -// (IoctlHeader.Signature)
4867 +/* Signature value (IoctlHeader.Signature) */
4868
4869 #define CSMI_PHY_SIGNATURE "CSMIPHY"
4870
4871 -// Phy Control Functions
4872 -// (bFunction)
4873 +/* Phy Control Functions (bFunction) */
4874
4875 -// values 0x00 to 0xFF are consistent in definition with the SMP PHY CONTROL
4876 -// function defined in the SAS spec
4877 +/* values 0x00 to 0xFF are consistent in definition with the SMP PHY CONTROL
4878 + function defined in the SAS spec */
4879 #define CSMI_SAS_PC_NOP 0x00000000
4880 #define CSMI_SAS_PC_LINK_RESET 0x00000001
4881 #define CSMI_SAS_PC_HARD_RESET 0x00000002
4882 #define CSMI_SAS_PC_PHY_DISABLE 0x00000003
4883 -// 0x04 to 0xFF reserved...
4884 +/* 0x04 to 0xFF reserved... */
4885 #define CSMI_SAS_PC_GET_PHY_SETTINGS 0x00000100
4886
4887 -// Link Flags
4888 +/* Link Flags */
4889 #define CSMI_SAS_PHY_ACTIVATE_CONTROL 0x00000001
4890 #define CSMI_SAS_PHY_UPDATE_SPINUP_RATE 0x00000002
4891 #define CSMI_SAS_PHY_AUTO_COMWAKE 0x00000004
4892
4893 -// Device Types for Phy Settings
4894 -// (bType)
4895 +/* Device Types for Phy Settings (bType) */
4896 #define CSMI_SAS_UNDEFINED 0x00
4897 #define CSMI_SAS_SATA 0x01
4898 #define CSMI_SAS_SAS 0x02
4899
4900 -// Transmitter Flags
4901 -// (uTransmitterFlags)
4902 +/* Transmitter Flags (uTransmitterFlags) */
4903 #define CSMI_SAS_PHY_PREEMPHASIS_DISABLED 0x00000001
4904
4905 -// Receiver Flags
4906 -// (uReceiverFlags)
4907 +/* Receiver Flags (uReceiverFlags) */
4908 #define CSMI_SAS_PHY_EQUALIZATION_DISABLED 0x00000001
4909
4910 -// Pattern Flags
4911 -// (uPatternFlags)
4912 -// #define CSMI_SAS_PHY_ACTIVATE_CONTROL 0x00000001
4913 +/* Pattern Flags (uPatternFlags) */
4914 +#define CSMI_SAS_PHY_ACTIVATE_CONTROL 0x00000001
4915 #define CSMI_SAS_PHY_DISABLE_SCRAMBLING 0x00000002
4916 #define CSMI_SAS_PHY_DISABLE_ALIGN 0x00000004
4917 #define CSMI_SAS_PHY_DISABLE_SSC 0x00000008
4918 @@ -976,18 +747,16 @@ typedef struct _IOCTL_HEADER {
4919 #define CSMI_SAS_PHY_FIXED_PATTERN 0x00000010
4920 #define CSMI_SAS_PHY_USER_PATTERN 0x00000020
4921
4922 -// Fixed Patterns
4923 -// (bFixedPattern)
4924 +/* Fixed Patterns (bFixedPattern) */
4925 #define CSMI_SAS_PHY_CJPAT 0x00000001
4926 #define CSMI_SAS_PHY_ALIGN 0x00000002
4927
4928 -// Type Flags
4929 -// (bTypeFlags)
4930 +/* Type Flags (bTypeFlags) */
4931 #define CSMI_SAS_PHY_POSITIVE_DISPARITY 0x01
4932 #define CSMI_SAS_PHY_NEGATIVE_DISPARITY 0x02
4933 #define CSMI_SAS_PHY_CONTROL_CHARACTER 0x04
4934
4935 -// Miscellaneous
4936 +/* Miscellaneous */
4937 #define SLOT_NUMBER_UNKNOWN 0xFFFF
4938
4939 /*************************************************************************/
4940 @@ -996,10 +765,9 @@ typedef struct _IOCTL_HEADER {
4941
4942 /* * * * * * * * * * Class Independent Structures * * * * * * * * * */
4943
4944 -// EDM #pragma CSMI_SAS_BEGIN_PACK(8)
4945 #pragma pack(8)
4946
4947 -// CC_CSMI_SAS_DRIVER_INFO
4948 +/* CC_CSMI_SAS_DRIVER_INFO */
4949
4950 typedef struct _CSMI_SAS_DRIVER_INFO {
4951 __u8 szName[81];
4952 @@ -1019,7 +787,7 @@ typedef struct _CSMI_SAS_DRIVER_INFO_BUF
4953 } CSMI_SAS_DRIVER_INFO_BUFFER,
4954 *PCSMI_SAS_DRIVER_INFO_BUFFER;
4955
4956 -// CC_CSMI_SAS_CNTLR_CONFIGURATION
4957 +/* CC_CSMI_SAS_CNTLR_CONFIGURATION */
4958
4959 typedef struct _CSMI_SAS_PCI_BUS_ADDRESS {
4960 __u8 bBusNumber;
4961 @@ -1074,7 +842,7 @@ typedef struct _CSMI_SAS_CNTLR_CONFIG_BU
4962 } CSMI_SAS_CNTLR_CONFIG_BUFFER,
4963 *PCSMI_SAS_CNTLR_CONFIG_BUFFER;
4964
4965 -// CC_CSMI_SAS_CNTLR_STATUS
4966 +/* CC_CSMI_SAS_CNTLR_STATUS */
4967
4968 typedef struct _CSMI_SAS_CNTLR_STATUS {
4969 __u32 uStatus;
4970 @@ -1089,7 +857,7 @@ typedef struct _CSMI_SAS_CNTLR_STATUS_BU
4971 } CSMI_SAS_CNTLR_STATUS_BUFFER,
4972 *PCSMI_SAS_CNTLR_STATUS_BUFFER;
4973
4974 -// CC_CSMI_SAS_FIRMWARE_DOWNLOAD
4975 +/* CC_CSMI_SAS_FIRMWARE_DOWNLOAD */
4976
4977 typedef struct _CSMI_SAS_FIRMWARE_DOWNLOAD {
4978 __u32 uBufferLength;
4979 @@ -1107,7 +875,7 @@ typedef struct _CSMI_SAS_FIRMWARE_DOWNLO
4980 } CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER,
4981 *PCSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER;
4982
4983 -// CC_CSMI_SAS_RAID_INFO
4984 +/* CC_CSMI_SAS_RAID_INFO */
4985
4986 typedef struct _CSMI_SAS_RAID_INFO {
4987 __u32 uNumRaidSets;
4988 @@ -1140,7 +908,7 @@ typedef struct _CSMI_SAS_RAID_INFO_BUFFE
4989 } CSMI_SAS_RAID_INFO_BUFFER,
4990 *PCSMI_SAS_RAID_INFO_BUFFER;
4991
4992 -// CC_CSMI_SAS_GET_RAID_CONFIG
4993 +/* CC_CSMI_SAS_GET_RAID_CONFIG */
4994
4995 typedef struct _CSMI_SAS_RAID_DRIVES {
4996 __u8 bModel[40];
4997 @@ -1220,7 +988,7 @@ typedef struct _CSMI_SAS_RAID_CONFIG_BUF
4998 } CSMI_SAS_RAID_CONFIG_BUFFER,
4999 *PCSMI_SAS_RAID_CONFIG_BUFFER;
5000
5001 -// CC_CSMI_SAS_GET_RAID_FEATURES
5002 +/* CC_CSMI_SAS_GET_RAID_FEATURES */
5003
5004 typedef struct _CSMI_SAS_RAID_TYPE_DESCRIPTION {
5005 __u8 bRaidType;
5006 @@ -1256,7 +1024,7 @@ typedef struct _CSMI_SAS_RAID_FEATURES_B
5007 } CSMI_SAS_RAID_FEATURES_BUFFER,
5008 *PCSMI_SAS_RAID_FEATURES_BUFFER;
5009
5010 -// CC_CSMI_SAS_SET_RAID_CONTROL
5011 +/* CC_CSMI_SAS_SET_RAID_CONTROL */
5012
5013 typedef struct _CSMI_SAS_RAID_CONTROL {
5014 __u8 bTransformPriority;
5015 @@ -1279,7 +1047,7 @@ typedef struct _CSMI_SAS_RAID_CONTROL_BU
5016 } CSMI_SAS_RAID_CONTROL_BUFFER,
5017 *PCSMI_SAS_RAID_CONTROL_BUFFER;
5018
5019 -// CC_CSMI_SAS_GET_RAID_ELEMENT
5020 +/* CC_CSMI_SAS_GET_RAID_ELEMENT */
5021
5022 typedef struct _CSMI_SAS_DRIVE_EXTENT_INFO {
5023 __u32 uDriveIndex;
5024 @@ -1353,7 +1121,7 @@ typedef struct _CSMI_SAS_RAID_ELEMENT_BU
5025 } CSMI_SAS_RAID_ELEMENT_BUFFER,
5026 *PCSMI_SAS_RAID_ELEMENT_BUFFER;
5027
5028 -// CC_CSMI_SAS_SET_RAID_OPERATION
5029 +/* CC_CSMI_SAS_SET_RAID_OPERATION */
5030
5031 typedef struct _CSMI_SAS_RAID_SET_LIST {
5032 __u32 uRaidSetIndex;
5033 @@ -1503,7 +1271,7 @@ typedef struct _CSMI_SAS_RAID_SET_OPERAT
5034
5035 /* * * * * * * * * * SAS HBA Class Structures * * * * * * * * * */
5036
5037 -// CC_CSMI_SAS_GET_PHY_INFO
5038 +/* CC_CSMI_SAS_GET_PHY_INFO */
5039
5040 typedef struct _CSMI_SAS_IDENTIFY {
5041 __u8 bDeviceType;
5042 @@ -1545,7 +1313,7 @@ typedef struct _CSMI_SAS_PHY_INFO_BUFFER
5043 } CSMI_SAS_PHY_INFO_BUFFER,
5044 *PCSMI_SAS_PHY_INFO_BUFFER;
5045
5046 -// CC_CSMI_SAS_SET_PHY_INFO
5047 +/* CC_CSMI_SAS_SET_PHY_INFO */
5048
5049 typedef struct _CSMI_SAS_SET_PHY_INFO {
5050 __u8 bPhyIdentifier;
5051 @@ -1563,7 +1331,7 @@ typedef struct _CSMI_SAS_SET_PHY_INFO_BU
5052 } CSMI_SAS_SET_PHY_INFO_BUFFER,
5053 *PCSMI_SAS_SET_PHY_INFO_BUFFER;
5054
5055 -// CC_CSMI_SAS_GET_LINK_ERRORS
5056 +/* CC_CSMI_SAS_GET_LINK_ERRORS */
5057
5058 typedef struct _CSMI_SAS_LINK_ERRORS {
5059 __u8 bPhyIdentifier;
5060 @@ -1582,7 +1350,7 @@ typedef struct _CSMI_SAS_LINK_ERRORS_BUF
5061 } CSMI_SAS_LINK_ERRORS_BUFFER,
5062 *PCSMI_SAS_LINK_ERRORS_BUFFER;
5063
5064 -// CC_CSMI_SAS_SMP_PASSTHRU
5065 +/* CC_CSMI_SAS_SMP_PASSTHRU */
5066
5067 typedef struct _CSMI_SAS_SMP_REQUEST {
5068 __u8 bFrameType;
5069 @@ -1622,7 +1390,7 @@ typedef struct _CSMI_SAS_SMP_PASSTHRU_BU
5070 } CSMI_SAS_SMP_PASSTHRU_BUFFER,
5071 *PCSMI_SAS_SMP_PASSTHRU_BUFFER;
5072
5073 -// CC_CSMI_SAS_SSP_PASSTHRU
5074 +/* CC_CSMI_SAS_SSP_PASSTHRU */
5075
5076 typedef struct _CSMI_SAS_SSP_PASSTHRU {
5077 __u8 bPhyIdentifier;
5078 @@ -1661,7 +1429,7 @@ typedef struct _CSMI_SAS_SSP_PASSTHRU_BU
5079 } CSMI_SAS_SSP_PASSTHRU_BUFFER,
5080 *PCSMI_SAS_SSP_PASSTHRU_BUFFER;
5081
5082 -// CC_CSMI_SAS_STP_PASSTHRU
5083 +/* CC_CSMI_SAS_STP_PASSTHRU */
5084
5085 typedef struct _CSMI_SAS_STP_PASSTHRU {
5086 __u8 bPhyIdentifier;
5087 @@ -1693,7 +1461,7 @@ typedef struct _CSMI_SAS_STP_PASSTHRU_BU
5088 } CSMI_SAS_STP_PASSTHRU_BUFFER,
5089 *PCSMI_SAS_STP_PASSTHRU_BUFFER;
5090
5091 -// CC_CSMI_SAS_GET_SATA_SIGNATURE
5092 +/* CC_CSMI_SAS_GET_SATA_SIGNATURE */
5093
5094 typedef struct _CSMI_SAS_SATA_SIGNATURE {
5095 __u8 bPhyIdentifier;
5096 @@ -1708,7 +1476,7 @@ typedef struct _CSMI_SAS_SATA_SIGNATURE_
5097 } CSMI_SAS_SATA_SIGNATURE_BUFFER,
5098 *PCSMI_SAS_SATA_SIGNATURE_BUFFER;
5099
5100 -// CC_CSMI_SAS_GET_SCSI_ADDRESS
5101 +/* CC_CSMI_SAS_GET_SCSI_ADDRESS */
5102
5103 typedef struct _CSMI_SAS_GET_SCSI_ADDRESS_BUFFER {
5104 IOCTL_HEADER IoctlHeader;
5105 @@ -1721,7 +1489,7 @@ typedef struct _CSMI_SAS_GET_SCSI_ADDRES
5106 } CSMI_SAS_GET_SCSI_ADDRESS_BUFFER,
5107 *PCSMI_SAS_GET_SCSI_ADDRESS_BUFFER;
5108
5109 -// CC_CSMI_SAS_GET_DEVICE_ADDRESS
5110 +/* CC_CSMI_SAS_GET_DEVICE_ADDRESS */
5111
5112 typedef struct _CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER {
5113 IOCTL_HEADER IoctlHeader;
5114 @@ -1734,7 +1502,7 @@ typedef struct _CSMI_SAS_GET_DEVICE_ADDR
5115 } CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER,
5116 *PCSMI_SAS_GET_DEVICE_ADDRESS_BUFFER;
5117
5118 -// CC_CSMI_SAS_TASK_MANAGEMENT
5119 +/* CC_CSMI_SAS_TASK_MANAGEMENT */
5120
5121 typedef struct _CSMI_SAS_SSP_TASK_IU {
5122 __u8 bHostIndex;
5123 @@ -1757,7 +1525,7 @@ typedef struct _CSMI_SAS_SSP_TASK_IU_BUF
5124 } CSMI_SAS_SSP_TASK_IU_BUFFER,
5125 *PCSMI_SAS_SSP_TASK_IU_BUFFER;
5126
5127 -// CC_CSMI_SAS_GET_CONNECTOR_INFO
5128 +/* CC_CSMI_SAS_GET_CONNECTOR_INFO */
5129
5130 typedef struct _CSMI_SAS_GET_CONNECTOR_INFO {
5131 __u32 uPinout;
5132 @@ -1773,7 +1541,7 @@ typedef struct _CSMI_SAS_CONNECTOR_INFO_
5133 } CSMI_SAS_CONNECTOR_INFO_BUFFER,
5134 *PCSMI_SAS_CONNECTOR_INFO_BUFFER;
5135
5136 -// CC_CSMI_SAS_GET_LOCATION
5137 +/* CC_CSMI_SAS_GET_LOCATION */
5138
5139 typedef struct _CSMI_SAS_LOCATION_IDENTIFIER {
5140 __u32 bLocationFlags;
5141 @@ -1801,7 +1569,7 @@ typedef struct _CSMI_SAS_GET_LOCATION_BU
5142 } CSMI_SAS_GET_LOCATION_BUFFER,
5143 *PCSMI_SAS_GET_LOCATION_BUFFER;
5144
5145 -// CC_CSMI_SAS_PHY_CONTROL
5146 +/* CC_CSMI_SAS_PHY_CONTROL */
5147
5148 typedef struct _CSMI_SAS_CHARACTER {
5149 __u8 bTypeFlags;
5150 @@ -1848,7 +1616,6 @@ typedef struct _CSMI_SAS_PHY_CONTROL_BUF
5151 } CSMI_SAS_PHY_CONTROL_BUFFER,
5152 *PCSMI_SAS_PHY_CONTROL_BUFFER;
5153
5154 -//EDM #pragma CSMI_SAS_END_PACK
5155 #pragma pack()
5156
5157 #endif // _CSMI_SAS_H_
5158 --- a/drivers/message/fusion/lsi/mpi_cnfg.h
5159 +++ b/drivers/message/fusion/lsi/mpi_cnfg.h
5160 @@ -1452,8 +1452,7 @@ typedef struct _CONFIG_PAGE_BIOS_2
5161 #define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05)
5162 #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06)
5163
5164 -typedef struct _CONFIG_PAGE_BIOS_4
5165 -{
5166 +typedef struct _CONFIG_PAGE_BIOS_4 {
5167 CONFIG_PAGE_HEADER Header; /* 00h */
5168 U64 ReassignmentBaseWWID; /* 04h */
5169 } CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4,
5170 --- a/drivers/message/fusion/lsi/mpi_log_sas.h
5171 +++ b/drivers/message/fusion/lsi/mpi_log_sas.h
5172 @@ -160,11 +160,12 @@
5173
5174
5175 #define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200)
5176 +
5177 #define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300)
5178 -#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */
5179 - /* Bit 0 is Status Bit 0: FrameXferErr */
5180 - /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
5181 - /* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
5182 +/* Bits 0-3 encode Transport Status Register (offset 0x08) */
5183 +/* Bit 0 is Status Bit 0: FrameXferErr */
5184 +/* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
5185 +/* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
5186
5187 #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500)
5188 #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600)
5189 @@ -179,7 +180,7 @@
5190 #define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01)
5191 #define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00)
5192 #define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000)
5193 -#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000) /* not currently used in mainline */
5194 +#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000)
5195 #define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK (0x00003000)
5196 #define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP (0x00004000)
5197 #define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD (0x00005000)
5198 @@ -308,7 +309,6 @@
5199 /* Device Firmware Update: Unable to allocate memory for page */
5200 #define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE (0x00010056)
5201 /* Device Firmware Update: */
5202 -//#define IR_LOGINFO_DEV_FW_UPDATE_ERR_ (0x00010054)
5203
5204
5205 /****************************************************************************/
5206 --- a/drivers/message/fusion/lsi/mpi_type.h
5207 +++ b/drivers/message/fusion/lsi/mpi_type.h
5208 @@ -50,18 +50,8 @@ typedef signed short S16;
5209 typedef unsigned short U16;
5210
5211
5212 -#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__PPC__) || defined(__ppc)
5213 -
5214 - typedef signed int S32;
5215 - typedef unsigned int U32;
5216 -
5217 -#else
5218 -
5219 - typedef signed long S32;
5220 - typedef unsigned long U32;
5221 -
5222 -#endif
5223 -
5224 +typedef int32_t S32;
5225 +typedef u_int32_t U32;
5226
5227 typedef struct _S64
5228 {
5229 --- a/drivers/message/fusion/mptbase.c
5230 +++ b/drivers/message/fusion/mptbase.c
5231 @@ -83,15 +83,18 @@ MODULE_VERSION(my_VERSION);
5232
5233 static int mpt_msi_enable_spi;
5234 module_param(mpt_msi_enable_spi, int, 0);
5235 -MODULE_PARM_DESC(mpt_msi_enable_spi, " Enable MSI Support for SPI controllers (default=0)");
5236 +MODULE_PARM_DESC(mpt_msi_enable_spi,
5237 + " Enable MSI Support for SPI controllers (default=0)");
5238
5239 static int mpt_msi_enable_fc;
5240 module_param(mpt_msi_enable_fc, int, 0);
5241 -MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC controllers (default=0)");
5242 +MODULE_PARM_DESC(mpt_msi_enable_fc,
5243 + " Enable MSI Support for FC controllers (default=0)");
5244
5245 static int mpt_msi_enable_sas = 1;
5246 module_param(mpt_msi_enable_sas, int, 0);
5247 -MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS controllers (default=1)");
5248 +MODULE_PARM_DESC(mpt_msi_enable_sas,
5249 + " Enable MSI Support for SAS controllers (default=1)");
5250
5251
5252 static int mpt_channel_mapping;
5253 @@ -99,18 +102,20 @@ module_param(mpt_channel_mapping, int, 0
5254 MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)");
5255
5256 int mpt_debug_level;
5257 +EXPORT_SYMBOL(mpt_debug_level);
5258 +
5259 static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
5260 module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
5261 &mpt_debug_level, 0600);
5262 -MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)");
5263 -EXPORT_SYMBOL(mpt_debug_level);
5264 +MODULE_PARM_DESC(mpt_debug_level,
5265 + " debug level - refer to mptdebug.h - (default=0)");
5266
5267 int mpt_fwfault_debug;
5268 +EXPORT_SYMBOL(mpt_fwfault_debug);
5269 module_param_call(mpt_fwfault_debug, param_set_int, param_get_int,
5270 &mpt_fwfault_debug, 0600);
5271 MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
5272 " and halt Firmware on fault - (default=0)");
5273 -EXPORT_SYMBOL(mpt_fwfault_debug);
5274
5275
5276 #ifdef MFCNT
5277 @@ -122,7 +127,7 @@ static int mfcounter = 0;
5278 /*
5279 * Public data...
5280 */
5281 -struct proc_dir_entry *mpt_proc_root_dir;
5282 +static struct proc_dir_entry *mpt_proc_root_dir;
5283
5284 #define WHOINIT_UNKNOWN 0xAA
5285
5286 @@ -156,7 +161,8 @@ static u8 last_drv_idx;
5287 /*
5288 * Forward protos...
5289 */
5290 -static int mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply);
5291 +static int mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
5292 + MPT_FRAME_HDR *reply);
5293 static int mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes,
5294 u32 *req, int replyBytes, u16 *u16reply, int maxwait,
5295 int sleepFlag);
5296 @@ -188,7 +194,8 @@ static int mpt_readScsiDevicePageHeaders
5297 static void mpt_read_ioc_pg_1(MPT_ADAPTER *ioc);
5298 static void mpt_read_ioc_pg_4(MPT_ADAPTER *ioc);
5299 static void mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc);
5300 -static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch, int sleepFlag);
5301 +static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch,
5302 + int sleepFlag);
5303 static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp);
5304 static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag);
5305 static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init);
5306 @@ -353,10 +360,10 @@ mpt_fault_reset_work(struct work_struct
5307 printk(MYIOC_s_WARN_FMT "IOC is in FAULT state (%04xh)!!!\n",
5308 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
5309 printk(MYIOC_s_WARN_FMT "Issuing HardReset from %s!!\n",
5310 - ioc->name, __FUNCTION__);
5311 + ioc->name, __func__);
5312 rc = mpt_HardResetHandler(ioc, CAN_SLEEP);
5313 printk(MYIOC_s_WARN_FMT "%s: HardReset: %s\n", ioc->name,
5314 - __FUNCTION__, (rc == 0) ? "success" : "failed");
5315 + __func__, (rc == 0) ? "success" : "failed");
5316 ioc_raw_state = mpt_GetIocState(ioc, 0);
5317 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT)
5318 printk(MYIOC_s_WARN_FMT "IOC is in FAULT state after "
5319 @@ -378,11 +385,11 @@ mpt_fault_reset_work(struct work_struct
5320 ioc = ioc->alt_ioc;
5321
5322 /* rearm the timer */
5323 - spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
5324 + spin_lock_irqsave(&ioc->fault_reset_work_lock, flags);
5325 if (ioc->reset_work_q)
5326 queue_delayed_work(ioc->reset_work_q, &ioc->fault_reset_work,
5327 msecs_to_jiffies(MPT_POLLING_INTERVAL));
5328 - spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
5329 + spin_unlock_irqrestore(&ioc->fault_reset_work_lock, flags);
5330 }
5331
5332 /*
5333 @@ -439,7 +446,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa
5334 if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
5335 MptCallbacks[cb_idx] == NULL) {
5336 printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n",
5337 - __FUNCTION__, ioc->name, cb_idx);
5338 + __func__, ioc->name, cb_idx);
5339 goto out;
5340 }
5341
5342 @@ -497,9 +504,6 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5343 mpt_sas_log_info(ioc, log_info);
5344 }
5345
5346 - /* TODO - add shost_attrs, or command line option, and
5347 - * extend this to SAS/FC
5348 - */
5349 if (ioc_stat & MPI_IOCSTATUS_MASK)
5350 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf);
5351
5352 @@ -507,7 +511,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5353 if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
5354 MptCallbacks[cb_idx] == NULL) {
5355 printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n",
5356 - __FUNCTION__, ioc->name, cb_idx);
5357 + __func__, ioc->name, cb_idx);
5358 freeme = 0;
5359 goto out;
5360 }
5361 @@ -523,11 +527,11 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5362 mb();
5363 }
5364
5365 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5366 /**
5367 * mpt_interrupt - MPT adapter (IOC) specific interrupt handler.
5368 * @irq: irq number (not used)
5369 * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure
5370 - * @r: pt_regs pointer (not used)
5371 *
5372 * This routine is registered via the request_irq() kernel API call,
5373 * and handles all interrupts generated from a specific MPT adapter
5374 @@ -539,7 +543,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
5375 * This routine handles register-level access of the adapter but
5376 * dispatches (calls) a protocol-specific callback routine to handle
5377 * the protocol-specific details of the MPT request completion.
5378 - **/
5379 + */
5380 static irqreturn_t
5381 mpt_interrupt(int irq, void *bus_id)
5382 {
5383 @@ -630,6 +634,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAM
5384 return freereq;
5385 }
5386
5387 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5388 /**
5389 * mpt_register - Register protocol-specific main callback handler.
5390 * @cbfunc: callback function pointer
5391 @@ -648,7 +653,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAM
5392 * {N,...,7,6,5,...,1} if successful.
5393 * A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be
5394 * considered an error by the caller.
5395 - **/
5396 + */
5397 u8
5398 mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
5399 {
5400 @@ -672,13 +677,14 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DR
5401 return last_drv_idx;
5402 }
5403
5404 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5405 /**
5406 * mpt_deregister - Deregister a protocol drivers resources.
5407 * @cb_idx: previously registered callback handle
5408 *
5409 * Each protocol-specific driver should call this routine when its
5410 * module is unloaded.
5411 - **/
5412 + */
5413 void
5414 mpt_deregister(u8 cb_idx)
5415 {
5416 @@ -691,9 +697,9 @@ mpt_deregister(u8 cb_idx)
5417 }
5418 }
5419
5420 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5421 /**
5422 - * mpt_event_register - Register protocol-specific event callback
5423 - * handler.
5424 + * mpt_event_register - Register protocol-specific event callback handler.
5425 * @cb_idx: previously registered (via mpt_register) callback handle
5426 * @ev_cbfunc: callback function
5427 *
5428 @@ -701,7 +707,7 @@ mpt_deregister(u8 cb_idx)
5429 * if/when they choose to be notified of MPT events.
5430 *
5431 * Returns 0 for success.
5432 - **/
5433 + */
5434 int
5435 mpt_event_register(u8 cb_idx, MPT_EVHANDLER ev_cbfunc)
5436 {
5437 @@ -712,15 +718,15 @@ mpt_event_register(u8 cb_idx, MPT_EVHAND
5438 return 0;
5439 }
5440
5441 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5442 /**
5443 - * mpt_event_deregister - Deregister protocol-specific event callback
5444 - * handler.
5445 + * mpt_event_deregister - Deregister protocol-specific event callback handler.
5446 * @cb_idx: previously registered callback handle
5447 *
5448 * Each protocol-specific driver should call this routine
5449 * when it does not (or can no longer) handle events,
5450 * or when its module is unloaded.
5451 - **/
5452 + */
5453 void
5454 mpt_event_deregister(u8 cb_idx)
5455 {
5456 @@ -730,6 +736,7 @@ mpt_event_deregister(u8 cb_idx)
5457 MptEvHandlers[cb_idx] = NULL;
5458 }
5459
5460 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5461 /**
5462 * mpt_reset_register - Register protocol-specific IOC reset handler.
5463 * @cb_idx: previously registered (via mpt_register) callback handle
5464 @@ -739,7 +746,7 @@ mpt_event_deregister(u8 cb_idx)
5465 * if/when they choose to be notified of IOC resets.
5466 *
5467 * Returns 0 for success.
5468 - **/
5469 + */
5470 int
5471 mpt_reset_register(u8 cb_idx, MPT_RESETHANDLER reset_func)
5472 {
5473 @@ -750,6 +757,7 @@ mpt_reset_register(u8 cb_idx, MPT_RESETH
5474 return 0;
5475 }
5476
5477 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5478 /**
5479 * mpt_reset_deregister - Deregister protocol-specific IOC reset handler.
5480 * @cb_idx: previously registered callback handle
5481 @@ -757,7 +765,7 @@ mpt_reset_register(u8 cb_idx, MPT_RESETH
5482 * Each protocol-specific driver should call this routine
5483 * when it does not (or can no longer) handle IOC reset handling,
5484 * or when its module is unloaded.
5485 - **/
5486 + */
5487 void
5488 mpt_reset_deregister(u8 cb_idx)
5489 {
5490 @@ -767,11 +775,12 @@ mpt_reset_deregister(u8 cb_idx)
5491 MptResetHandlers[cb_idx] = NULL;
5492 }
5493
5494 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5495 /**
5496 * mpt_device_driver_register - Register device driver hooks
5497 * @dd_cbfunc: driver callbacks struct
5498 * @cb_idx: MPT protocol driver index
5499 - **/
5500 + */
5501 int
5502 mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, u8 cb_idx)
5503 {
5504 @@ -785,8 +794,6 @@ mpt_device_driver_register(struct mpt_pc
5505
5506 /* call per pci device probe entry point */
5507 list_for_each_entry(ioc, &ioc_list, list) {
5508 - if (!pci_get_drvdata(ioc->pcidev))
5509 - continue;
5510 id = ioc->pcidev->driver ?
5511 ioc->pcidev->driver->id_table : NULL;
5512 if (dd_cbfunc->probe)
5513 @@ -796,10 +803,11 @@ mpt_device_driver_register(struct mpt_pc
5514 return 0;
5515 }
5516
5517 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5518 /**
5519 * mpt_device_driver_deregister - DeRegister device driver hooks
5520 * @cb_idx: MPT protocol driver index
5521 - **/
5522 + */
5523 void
5524 mpt_device_driver_deregister(u8 cb_idx)
5525 {
5526 @@ -819,15 +827,18 @@ mpt_device_driver_deregister(u8 cb_idx)
5527 MptDeviceDriverHandlers[cb_idx] = NULL;
5528 }
5529
5530 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5531 /**
5532 - * mpt_get_msg_frame - Obtain a MPT request frame from the pool (of 1024)
5533 - * allocated per MPT adapter.
5534 + * mpt_get_msg_frame - Obtain an MPT request frame from the pool
5535 * @cb_idx: Handle of registered MPT protocol driver
5536 * @ioc: Pointer to MPT adapter structure
5537 *
5538 + * Obtain an MPT request frame from the pool (of 1024) that are
5539 + * allocated per MPT adapter.
5540 + *
5541 * Returns pointer to a MPT request frame or %NULL if none are available
5542 * or IOC is not active.
5543 - **/
5544 + */
5545 MPT_FRAME_HDR*
5546 mpt_get_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc)
5547 {
5548 @@ -886,16 +897,16 @@ mpt_get_msg_frame(u8 cb_idx, MPT_ADAPTER
5549 return mf;
5550 }
5551
5552 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5553 /**
5554 - * mpt_put_msg_frame - Send a protocol specific MPT request frame
5555 - * to a IOC.
5556 + * mpt_put_msg_frame - Send a protocol-specific MPT request frame to an IOC
5557 * @cb_idx: Handle of registered MPT protocol driver
5558 * @ioc: Pointer to MPT adapter structure
5559 * @mf: Pointer to MPT request frame
5560 *
5561 - * This routine posts a MPT request frame to the request post FIFO of a
5562 + * This routine posts an MPT request frame to the request post FIFO of a
5563 * specific MPT adapter.
5564 - **/
5565 + */
5566 void
5567 mpt_put_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
5568 {
5569 @@ -921,13 +932,15 @@ mpt_put_msg_frame(u8 cb_idx, MPT_ADAPTER
5570 }
5571
5572 /**
5573 - * mpt_put_msg_frame_hi_pri - Send a protocol specific MPT request frame
5574 - * to a IOC using hi priority request queue.
5575 + * mpt_put_msg_frame_hi_pri - Send a hi-pri protocol-specific MPT request frame
5576 * @cb_idx: Handle of registered MPT protocol driver
5577 * @ioc: Pointer to MPT adapter structure
5578 * @mf: Pointer to MPT request frame
5579 *
5580 - * This routine posts a MPT request frame to the request post FIFO of a
5581 + * Send a protocol-specific MPT request frame to an IOC using
5582 + * hi-priority request queue.
5583 + *
5584 + * This routine posts an MPT request frame to the request post FIFO of a
5585 * specific MPT adapter.
5586 **/
5587 void
5588 @@ -952,6 +965,7 @@ mpt_put_msg_frame_hi_pri(u8 cb_idx, MPT_
5589 CHIPREG_WRITE32(&ioc->chip->RequestHiPriFifo, mf_dma_addr);
5590 }
5591
5592 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5593 /**
5594 * mpt_free_msg_frame - Place MPT request frame back on FreeQ.
5595 * @handle: Handle of registered MPT protocol driver
5596 @@ -960,7 +974,7 @@ mpt_put_msg_frame_hi_pri(u8 cb_idx, MPT_
5597 *
5598 * This routine places a MPT request frame back on the MPT adapter's
5599 * FreeQ.
5600 - **/
5601 + */
5602 void
5603 mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
5604 {
5605 @@ -970,7 +984,8 @@ mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT
5606 spin_lock_irqsave(&ioc->FreeQlock, flags);
5607 if (cpu_to_le32(mf->u.frame.linkage.arg1) == 0xdeadbeaf)
5608 goto out;
5609 - mf->u.frame.linkage.arg1 = cpu_to_le32(0xdeadbeaf); /* signature to know if this mf is freed */
5610 + /* signature to know if this mf is freed */
5611 + mf->u.frame.linkage.arg1 = cpu_to_le32(0xdeadbeaf);
5612 list_add_tail(&mf->u.frame.linkage.list, &ioc->FreeQ);
5613 #ifdef MFCNT
5614 ioc->mfcnt--;
5615 @@ -1122,7 +1137,7 @@ mpt_add_chain_64bit(char *pAddr, u8 next
5616 * request which are greater than 1 byte in size.
5617 *
5618 * Returns 0 for success, non-zero for failure.
5619 - **/
5620 + */
5621 int
5622 mpt_send_handshake_request(u8 cb_idx, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag)
5623 {
5624 @@ -1199,6 +1214,7 @@ mpt_send_handshake_request(u8 cb_idx, MP
5625 return r;
5626 }
5627
5628 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5629 /**
5630 * mpt_host_page_access_control - control the IOC's Host Page Buffer access
5631 * @ioc: Pointer to MPT adapter structure
5632 @@ -1215,7 +1231,7 @@ mpt_send_handshake_request(u8 cb_idx, MP
5633 * 3h Free Buffer { MPI_DB_HPBAC_FREE_BUFFER }
5634 *
5635 * Returns 0 for success, non-zero for failure.
5636 - **/
5637 + */
5638 static int
5639 mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag)
5640 {
5641 @@ -1240,6 +1256,7 @@ mpt_host_page_access_control(MPT_ADAPTER
5642 return 0;
5643 }
5644
5645 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5646 /**
5647 * mpt_host_page_alloc - allocate system memory for the fw
5648 * @ioc: Pointer to pointer to IOC adapter
5649 @@ -1247,7 +1264,7 @@ mpt_host_page_access_control(MPT_ADAPTER
5650 *
5651 * If we already allocated memory in past, then resend the same pointer.
5652 * Returns 0 for success, non-zero for failure.
5653 - **/
5654 + */
5655 static int
5656 mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
5657 {
5658 @@ -1305,6 +1322,7 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pI
5659 return 0;
5660 }
5661
5662 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5663 /**
5664 * mpt_verify_adapter - Given IOC identifier, set pointer to its adapter structure.
5665 * @iocid: IOC unique identifier (integer)
5666 @@ -1315,7 +1333,7 @@ return 0;
5667 *
5668 * Returns iocid and sets iocpp if iocid is found.
5669 * Returns -1 if iocid is not found.
5670 - **/
5671 + */
5672 int
5673 mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
5674 {
5675 @@ -1604,7 +1622,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
5676 return r;
5677 }
5678 if (sizeof(dma_addr_t) > 4) {
5679 - const uint64_t required_mask = dma_get_required_mask(&pdev->dev);
5680 + uint64_t required_mask;
5681 + required_mask = dma_get_required_mask(&pdev->dev);
5682 if (required_mask > DMA_32BIT_MASK
5683 && !pci_set_dma_mask(pdev, DMA_64BIT_MASK)
5684 && !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
5685 @@ -1674,15 +1693,13 @@ mpt_mapresources(MPT_ADAPTER *ioc)
5686 ioc->chip = (SYSIF_REGS __iomem *)mem;
5687
5688 /* Save Port IO values in case we need to do downloadboot */
5689 - {
5690 - u8 *pmem = (u8*)port;
5691 - ioc->pio_mem_phys = port;
5692 - ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
5693 - }
5694 + ioc->pio_mem_phys = port;
5695 + ioc->pio_chip = (SYSIF_REGS __iomem *)port;
5696
5697 return 0;
5698 }
5699
5700 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5701 /**
5702 * mpt_attach - Install a PCI intelligent MPT adapter.
5703 * @pdev: Pointer to pci_dev structure
5704 @@ -1698,8 +1715,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
5705 *
5706 * Returns 0 for success, non-zero for failure.
5707 *
5708 - * TODO: Add support for polled controllers
5709 - **/
5710 + */
5711 int
5712 mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
5713 {
5714 @@ -1795,6 +1811,7 @@ mpt_attach(struct pci_dev *pdev, const s
5715
5716 /* Initialize work */
5717 INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work);
5718 + spin_lock_init(&ioc->fault_reset_work_lock);
5719
5720 /* Initialize workqueue */
5721 snprintf(ioc->reset_work_q_name, sizeof(ioc->reset_work_q_name),
5722 @@ -1809,7 +1826,8 @@ mpt_attach(struct pci_dev *pdev, const s
5723 return -ENOMEM;
5724 }
5725
5726 - dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "facts @ %p, pfacts[0] @ %p\n",
5727 + dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "facts @ %p,"
5728 + " pfacts[0] @ %p\n",
5729 ioc->name, &ioc->facts, &ioc->pfacts[0]));
5730
5731 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
5732 @@ -1911,6 +1929,9 @@ mpt_attach(struct pci_dev *pdev, const s
5733 ioc->active = 0;
5734 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
5735
5736 + /* Set IOC ptr in the pcidev's driver data. */
5737 + pci_set_drvdata(ioc->pcidev, ioc);
5738 +
5739 /* Set lookup ptr. */
5740 list_add_tail(&ioc->list, &ioc_list);
5741
5742 @@ -1979,10 +2000,11 @@ mpt_attach(struct pci_dev *pdev, const s
5743 return 0;
5744 }
5745
5746 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5747 /**
5748 * mpt_detach - Remove a PCI intelligent MPT adapter.
5749 * @pdev: Pointer to pci_dev structure
5750 - **/
5751 + */
5752 void
5753 mpt_detach(struct pci_dev *pdev)
5754 {
5755 @@ -1995,10 +2017,10 @@ mpt_detach(struct pci_dev *pdev)
5756 /*
5757 * Stop polling ioc for fault condition
5758 */
5759 - spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
5760 + spin_lock_irqsave(&ioc->fault_reset_work_lock, flags);
5761 wq = ioc->reset_work_q;
5762 ioc->reset_work_q = NULL;
5763 - spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
5764 + spin_unlock_irqrestore(&ioc->fault_reset_work_lock, flags);
5765 cancel_delayed_work(&ioc->fault_reset_work);
5766 destroy_workqueue(wq);
5767
5768 @@ -2030,11 +2052,12 @@ mpt_detach(struct pci_dev *pdev)
5769 * Power Management
5770 */
5771 #ifdef CONFIG_PM
5772 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5773 /**
5774 * mpt_suspend - Fusion MPT base driver suspend routine.
5775 * @pdev: Pointer to pci_dev structure
5776 * @state: new state to enter
5777 - **/
5778 + */
5779 int
5780 mpt_suspend(struct pci_dev *pdev, pm_message_t state)
5781 {
5782 @@ -2069,10 +2092,11 @@ mpt_suspend(struct pci_dev *pdev, pm_mes
5783 return 0;
5784 }
5785
5786 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5787 /**
5788 * mpt_resume - Fusion MPT base driver resume routine.
5789 * @pdev: Pointer to pci_dev structure
5790 - **/
5791 + */
5792 int
5793 mpt_resume(struct pci_dev *pdev)
5794 {
5795 @@ -2132,7 +2156,9 @@ mpt_resume(struct pci_dev *pdev)
5796
5797 /* bring ioc to operational state */
5798 printk(MYIOC_s_INFO_FMT "Sending mpt_do_ioc_recovery\n", ioc->name);
5799 - if ((recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0)
5800 + recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
5801 + CAN_SLEEP);
5802 + if (recovery_state != 0)
5803 printk(MYIOC_s_WARN_FMT "pci-resume: Cannot recover, "
5804 "error:[%x]\n", ioc->name, recovery_state);
5805 else
5806 @@ -2158,6 +2184,7 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *
5807 return (MptResetHandlers[index])(ioc, reset_phase);
5808 }
5809
5810 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5811 /**
5812 * mpt_do_ioc_recovery - Initialize or recover MPT adapter.
5813 * @ioc: Pointer to MPT adapter structure
5814 @@ -2176,7 +2203,9 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *
5815 * -2 if READY but IOCFacts Failed
5816 * -3 if READY but PrimeIOCFifos Failed
5817 * -4 if READY but IOCInit Failed
5818 - **/
5819 + * -5 if failed to enable_device and/or request_selected_regions
5820 + * -6 if failed to upload firmware
5821 + */
5822 static int
5823 mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
5824 {
5825 @@ -2217,14 +2246,16 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5826
5827 if (reset_alt_ioc_active && ioc->alt_ioc) {
5828 /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */
5829 - dprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": alt-ioc reply irq re-enabled\n",
5830 + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5831 + ": alt-ioc reply irq re-enabled\n",
5832 ioc->alt_ioc->name));
5833 CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
5834 ioc->alt_ioc->active = 1;
5835 }
5836
5837 } else {
5838 - printk(MYIOC_s_WARN_FMT "NOT READY WARNING!\n", ioc->name);
5839 + printk(MYIOC_s_WARN_FMT "NOT READY WARNING!\n",
5840 + ioc->name);
5841 }
5842 ret = -1;
5843 goto out;
5844 @@ -2238,7 +2269,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5845 alt_ioc_ready = 1;
5846 else
5847 printk(MYIOC_s_WARN_FMT
5848 - ": alt-ioc Not ready WARNING!\n", ioc->alt_ioc->name);
5849 + ": alt-ioc Not ready WARNING!\n",
5850 + ioc->alt_ioc->name);
5851 }
5852
5853 for (ii=0; ii<5; ii++) {
5854 @@ -2340,8 +2372,9 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5855 ret = -4;
5856 // NEW!
5857 if (alt_ioc_ready && ((rc = PrimeIocFifos(ioc->alt_ioc)) != 0)) {
5858 - printk(MYIOC_s_WARN_FMT ": alt-ioc (%d) FIFO mgmt alloc WARNING!\n",
5859 - ioc->alt_ioc->name, rc);
5860 + printk(MYIOC_s_WARN_FMT
5861 + ": alt-ioc (%d) FIFO mgmt alloc WARNING!\n",
5862 + ioc->alt_ioc->name, rc);
5863 alt_ioc_ready = 0;
5864 reset_alt_ioc_active = 0;
5865 }
5866 @@ -2382,7 +2415,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5867 } else {
5868 printk(MYIOC_s_WARN_FMT
5869 "firmware upload failure!\n", ioc->name);
5870 - ret = -5;
5871 + ret = -6;
5872 }
5873 }
5874 }
5875 @@ -2392,8 +2425,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5876 * and EventAck handling.
5877 */
5878 if ((ret == 0) && (!ioc->facts.EventState)) {
5879 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "SendEventNotification\n",
5880 - ioc->name));
5881 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
5882 + "SendEventNotification\n", ioc->name));
5883 ret = SendEventNotification(ioc, 1, sleepFlag); /* 1=Enable */
5884 }
5885
5886 @@ -2408,9 +2441,11 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5887 if (rc == 0) { /* alt ioc */
5888 if (reset_alt_ioc_active && ioc->alt_ioc) {
5889 /* (re)Enable alt-IOC! (reply interrupt) */
5890 - dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "alt-ioc reply irq re-enabled\n",
5891 + dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5892 + "alt-ioc reply irq re-enabled\n",
5893 ioc->alt_ioc->name));
5894 - CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
5895 + CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask,
5896 + MPI_HIM_DIM);
5897 ioc->alt_ioc->active = 1;
5898 }
5899 }
5900 @@ -2427,7 +2462,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5901 /*
5902 * Initalize link list for inactive raid volumes.
5903 */
5904 - init_MUTEX(&ioc->raid_data.inactive_list_mutex);
5905 + mutex_init(&ioc->raid_data.inactive_list_mutex);
5906 INIT_LIST_HEAD(&ioc->raid_data.inactive_list);
5907
5908 switch (ioc->bus_type) {
5909 @@ -2461,7 +2496,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5910 * (LANPage1_t stuff)
5911 */
5912 (void) GetLanConfigPages(ioc);
5913 - a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
5914 + a = (u8 *)
5915 + &ioc->lan_cnfg_page1.HardwareAddressLow;
5916 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5917 "LanAddr = %02X:%02X:%02X"
5918 ":%02X:%02X:%02X\n",
5919 @@ -2507,6 +2543,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5920 return ret;
5921 }
5922
5923 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5924 /**
5925 * mpt_detect_bound_ports - Search for matching PCI bus/dev_function
5926 * @ioc: Pointer to MPT adapter structure
5927 @@ -2518,7 +2555,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
5928 *
5929 * If match on PCI dev_function +/-1 is found, bind the two MPT adapters
5930 * using alt_ioc pointer fields in their %MPT_ADAPTER structures.
5931 - **/
5932 + */
5933 static void
5934 mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
5935 {
5936 @@ -2544,15 +2581,19 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc,
5937 if (_pcidev == peer) {
5938 /* Paranoia checks */
5939 if (ioc->alt_ioc != NULL) {
5940 - printk(MYIOC_s_WARN_FMT "Oops, already bound (%s <==> %s)!\n",
5941 - ioc->name, ioc->name, ioc->alt_ioc->name);
5942 + printk(MYIOC_s_WARN_FMT
5943 + "Oops, already bound (%s <==> %s)!\n",
5944 + ioc->name, ioc->name, ioc->alt_ioc->name);
5945 break;
5946 } else if (ioc_srch->alt_ioc != NULL) {
5947 - printk(MYIOC_s_WARN_FMT "Oops, already bound (%s <==> %s)!\n",
5948 - ioc_srch->name, ioc_srch->name, ioc_srch->alt_ioc->name);
5949 + printk(MYIOC_s_WARN_FMT
5950 + "Oops, already bound (%s <==> %s)!\n",
5951 + ioc_srch->name, ioc_srch->name,
5952 + ioc_srch->alt_ioc->name);
5953 break;
5954 }
5955 - dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FOUND! binding %s <==> %s\n",
5956 + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5957 + "FOUND! binding %s <==> %s\n",
5958 ioc->name, ioc->name, ioc_srch->name));
5959 ioc_srch->alt_ioc = ioc;
5960 ioc->alt_ioc = ioc_srch;
5961 @@ -2561,10 +2602,11 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc,
5962 pci_dev_put(peer);
5963 }
5964
5965 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5966 /**
5967 * mpt_adapter_disable - Disable misbehaving MPT adapter.
5968 * @ioc: Pointer to MPT adapter structure
5969 - **/
5970 + */
5971 static void
5972 mpt_adapter_disable(MPT_ADAPTER *ioc)
5973 {
5974 @@ -2577,7 +2619,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
5975 if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)
5976 ioc->cached_fw, CAN_SLEEP)) < 0) {
5977 printk(MYIOC_s_WARN_FMT
5978 - ": firmware downloadboot failure (%d)!\n", ioc->name, ret);
5979 + ": firmware downloadboot failure (%d)!\n",
5980 + ioc->name, ret);
5981 }
5982 }
5983
5984 @@ -2585,15 +2628,15 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
5985 * Put the controller into ready state (if its not already)
5986 */
5987 if (mpt_GetIocState(ioc, 1) != MPI_IOC_STATE_READY) {
5988 - if(!SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET,
5989 + if (!SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET,
5990 CAN_SLEEP)) {
5991 if (mpt_GetIocState(ioc, 1) != MPI_IOC_STATE_READY)
5992 printk(MYIOC_s_ERR_FMT "%s: IOC msg unit "
5993 "reset failed to put ioc in ready state!\n",
5994 - ioc->name, __FUNCTION__);
5995 + ioc->name, __func__);
5996 } else
5997 printk(MYIOC_s_ERR_FMT "%s: IOC msg unit reset "
5998 - "failed!\n", ioc->name, __FUNCTION__);
5999 + "failed!\n", ioc->name, __func__);
6000 }
6001
6002 /* Disable adapter interrupts! */
6003 @@ -2607,8 +2650,9 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
6004
6005 if (ioc->alloc != NULL) {
6006 sz = ioc->alloc_sz;
6007 - dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free @ %p, sz=%d bytes\n",
6008 - ioc->name, ioc->alloc, ioc->alloc_sz));
6009 + dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6010 + "free @ %p, sz=%d bytes\n", ioc->name,
6011 + ioc->alloc, ioc->alloc_sz));
6012 pci_free_consistent(ioc->pcidev, sz,
6013 ioc->alloc, ioc->alloc_dma);
6014 ioc->reply_frames = NULL;
6015 @@ -2666,10 +2710,11 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
6016 MPI_DB_HPBAC_FREE_BUFFER, NO_SLEEP)) != 0) {
6017 printk(MYIOC_s_ERR_FMT
6018 ": %s: host page buffers free failed (%d)!\n",
6019 - ioc->name, __FUNCTION__, ret);
6020 + ioc->name, __func__, ret);
6021 }
6022 - dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HostPageBuffer free @ %p, sz=%d bytes\n",
6023 - ioc->name, ioc->HostPageBuffer, ioc->HostPageBuffer_sz));
6024 + dexitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6025 + "HostPageBuffer free @ %p, sz=%d bytes\n", ioc->name,
6026 + ioc->HostPageBuffer, ioc->HostPageBuffer_sz));
6027 pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz,
6028 ioc->HostPageBuffer,
6029 ioc->HostPageBuffer_dma);
6030 @@ -2681,13 +2726,14 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
6031 pci_set_drvdata(ioc->pcidev, NULL);
6032 }
6033
6034 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6035 /**
6036 * mpt_adapter_dispose - Free all resources associated with an MPT adapter
6037 * @ioc: Pointer to MPT adapter structure
6038 *
6039 * This routine unregisters h/w resources and frees all alloc'd memory
6040 * associated with a MPT adapter structure.
6041 - **/
6042 + */
6043 static void
6044 mpt_adapter_dispose(MPT_ADAPTER *ioc)
6045 {
6046 @@ -2718,7 +2764,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
6047 #if defined(CONFIG_MTRR) && 0
6048 if (ioc->mtrr_reg > 0) {
6049 mtrr_del(ioc->mtrr_reg, 0, 0);
6050 - dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MTRR region de-registered\n", ioc->name));
6051 + dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6052 + "MTRR region de-registered\n", ioc->name));
6053 }
6054 #endif
6055
6056 @@ -2727,7 +2774,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
6057
6058 sz_last = ioc->alloc_total;
6059 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free'd %d of %d bytes\n",
6060 - ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first));
6061 + ioc->name, sz_first-sz_last+(int)sizeof(*ioc),
6062 + sz_first));
6063
6064 if (ioc->alt_ioc)
6065 ioc->alt_ioc->alt_ioc = NULL;
6066 @@ -2735,10 +2783,11 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
6067 kfree(ioc);
6068 }
6069
6070 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6071 /**
6072 * MptDisplayIocCapabilities - Disply IOC's capabilities.
6073 * @ioc: Pointer to MPT adapter structure
6074 - **/
6075 + */
6076 static void
6077 MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
6078 {
6079 @@ -2777,6 +2826,7 @@ MptDisplayIocCapabilities(MPT_ADAPTER *i
6080 printk("}\n");
6081 }
6082
6083 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6084 /**
6085 * MakeIocReady - Get IOC to a READY state, using KickStart if needed.
6086 * @ioc: Pointer to MPT_ADAPTER structure
6087 @@ -2790,7 +2840,7 @@ MptDisplayIocCapabilities(MPT_ADAPTER *i
6088 * -2 - Msg Unit Reset Failed
6089 * -3 - IO Unit Reset Failed
6090 * -4 - IOC owned by a PEER
6091 - **/
6092 + */
6093 static int
6094 MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
6095 {
6096 @@ -2804,7 +2854,8 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6097
6098 /* Get current [raw] IOC state */
6099 ioc_state = mpt_GetIocState(ioc, 0);
6100 - dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MakeIocReady, [raw] state=%08x\n", ioc->name, ioc_state));
6101 + dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6102 + "MakeIocReady, [raw] state=%08x\n", ioc->name, ioc_state));
6103
6104 /*
6105 * Check to see if IOC got left/stuck in doorbell handshake
6106 @@ -2817,8 +2868,10 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6107 }
6108
6109 /* Is it already READY? */
6110 - if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) {
6111 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "IOC is in READY state\n",
6112 + if (!statefault &&
6113 + (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) {
6114 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6115 + "IOC is in READY state\n",
6116 ioc->name));
6117 return 0;
6118 }
6119 @@ -2894,8 +2947,9 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6120
6121 ii++; cntdn--;
6122 if (!cntdn) {
6123 - printk(MYIOC_s_ERR_FMT "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6124 - ioc->name, ioc_state, (int)((ii+5)/HZ));
6125 + printk(MYIOC_s_ERR_FMT
6126 + "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6127 + ioc->name, ioc_state, (int)((ii+5)/HZ));
6128 return -ETIME;
6129 }
6130
6131 @@ -2916,6 +2970,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6132 return hard_reset_done;
6133 }
6134
6135 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6136 /**
6137 * mpt_GetIocState - Get the current state of a MPT adapter.
6138 * @ioc: Pointer to MPT_ADAPTER structure
6139 @@ -2923,7 +2978,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force
6140 *
6141 * Returns all IOC Doorbell register bits if cooked==0, else just the
6142 * Doorbell bits in MPI_IOC_STATE_MASK.
6143 - **/
6144 + */
6145 u32
6146 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked)
6147 {
6148 @@ -2939,6 +2994,7 @@ mpt_GetIocState(MPT_ADAPTER *ioc, int co
6149 return cooked ? sc : s;
6150 }
6151
6152 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6153 /**
6154 * GetIocFacts - Send IOCFacts request to MPT adapter.
6155 * @ioc: Pointer to MPT_ADAPTER structure
6156 @@ -2946,7 +3002,7 @@ mpt_GetIocState(MPT_ADAPTER *ioc, int co
6157 * @reason: If recovery, only update facts.
6158 *
6159 * Returns 0 for success, non-zero for failure.
6160 - **/
6161 + */
6162 static int
6163 GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
6164 {
6165 @@ -2961,9 +3017,9 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6166
6167 /* IOC *must* NOT be in RESET state! */
6168 if (ioc->last_state == MPI_IOC_STATE_RESET) {
6169 - printk(KERN_ERR MYNAM ": ERROR - Can't get IOCFacts, %s NOT READY! (%08x)\n",
6170 - ioc->name,
6171 - ioc->last_state );
6172 + printk(KERN_ERR MYNAM
6173 + ": ERROR - Can't get IOCFacts, %s NOT READY! (%08x)\n",
6174 + ioc->name, ioc->last_state);
6175 return -44;
6176 }
6177
6178 @@ -3011,7 +3067,8 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6179
6180 facts->MsgVersion = le16_to_cpu(facts->MsgVersion);
6181 if (facts->MsgVersion == MPI_VERSION_01_05)
6182 - facts->HeaderVersion = le16_to_cpu(facts->HeaderVersion);
6183 + facts->HeaderVersion =
6184 + le16_to_cpu(facts->HeaderVersion);
6185 facts->MsgContext = le32_to_cpu(facts->MsgContext);
6186 facts->IOCExceptions = le16_to_cpu(facts->IOCExceptions);
6187 facts->IOCStatus = le16_to_cpu(facts->IOCStatus);
6188 @@ -3120,6 +3177,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6189 return 0;
6190 }
6191
6192 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6193 /**
6194 * GetPortFacts - Send PortFacts request to MPT adapter.
6195 * @ioc: Pointer to MPT_ADAPTER structure
6196 @@ -3127,7 +3185,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepF
6197 * @sleepFlag: Specifies whether the process can sleep
6198 *
6199 * Returns 0 for success, non-zero for failure.
6200 - **/
6201 + */
6202 static int
6203 GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
6204 {
6205 @@ -3141,7 +3199,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6206 /* IOC *must* NOT be in RESET state! */
6207 if (ioc->last_state == MPI_IOC_STATE_RESET) {
6208 printk(MYIOC_s_ERR_FMT "Can't get PortFacts, "
6209 - " NOT READY! (%08x)\n", ioc->name, ioc->last_state );
6210 + " NOT READY! (%08x)\n", ioc->name, ioc->last_state);
6211 return -4;
6212 }
6213
6214 @@ -3159,14 +3217,14 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6215 get_pfacts.PortNumber = portnum;
6216 /* Assert: All other get_pfacts fields are zero! */
6217
6218 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "Sending get PortFacts(%d) request\n",
6219 - ioc->name, portnum));
6220 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6221 + "Sending get PortFacts(%d) request\n", ioc->name, portnum));
6222
6223 /* No non-zero fields in the get_pfacts request are greater than
6224 * 1 byte in size, so we can just fire it off as is.
6225 */
6226 ii = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&get_pfacts,
6227 - reply_sz, (u16*)pfacts, 5 /*seconds*/, sleepFlag);
6228 + reply_sz, (u16 *)pfacts, 5 /*seconds*/, sleepFlag);
6229 if (ii != 0)
6230 return ii;
6231
6232 @@ -3201,6 +3259,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6233 return 0;
6234 }
6235
6236 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6237 /**
6238 * SendIocInit - Send IOCInit request to MPT adapter.
6239 * @ioc: Pointer to MPT_ADAPTER structure
6240 @@ -3209,7 +3268,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portn
6241 * Send IOCInit followed by PortEnable to bring IOC to OPERATIONAL state.
6242 *
6243 * Returns 0 for success, non-zero for failure.
6244 - **/
6245 + */
6246 static int
6247 SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
6248 {
6249 @@ -3323,6 +3382,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepF
6250 return r;
6251 }
6252
6253 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6254 /**
6255 * SendPortEnable - Send PortEnable request to MPT adapter port.
6256 * @ioc: Pointer to MPT_ADAPTER structure
6257 @@ -3332,7 +3392,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepF
6258 * Send PortEnable to bring IOC to OPERATIONAL state.
6259 *
6260 * Returns 0 for success, non-zero for failure.
6261 - **/
6262 + */
6263 static int
6264 SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
6265 {
6266 @@ -3355,18 +3415,19 @@ SendPortEnable(MPT_ADAPTER *ioc, int por
6267 /* port_enable.MsgFlags = 0; */
6268 /* port_enable.MsgContext = 0; */
6269
6270 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "Sending Port(%d)Enable (req @ %p)\n",
6271 - ioc->name, portnum, &port_enable));
6272 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6273 + "Sending Port(%d)Enable (req @ %p)\n", ioc->name,
6274 + portnum, &port_enable));
6275
6276 /* RAID FW may take a long time to enable
6277 */
6278 if (ioc->ir_firmware || ioc->bus_type == SAS) {
6279 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
6280 - (u32*)&port_enable, reply_sz, (u16*)&reply_buf,
6281 + (u32 *)&port_enable, reply_sz, (u16 *)&reply_buf,
6282 300 /*seconds*/, sleepFlag);
6283 } else {
6284 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
6285 - (u32*)&port_enable, reply_sz, (u16*)&reply_buf,
6286 + (u32 *)&port_enable, reply_sz, (u16 *)&reply_buf,
6287 30 /*seconds*/, sleepFlag);
6288 }
6289 return rc;
6290 @@ -3435,6 +3496,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
6291 ioc->cached_fw = NULL;
6292 }
6293
6294 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6295 /**
6296 * mpt_do_upload - Construct and Send FWUpload request to MPT adapter port.
6297 * @ioc: Pointer to MPT_ADAPTER structure
6298 @@ -3447,7 +3509,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
6299 * on the bound IOC, the second image is discarded
6300 * and memory is free'd. Both channels must upload to prevent
6301 * IOC from running in degraded mode.
6302 - **/
6303 + */
6304 static int
6305 mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
6306 {
6307 @@ -3499,8 +3561,8 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6308 ioc->facts.FWImageSize, request_size));
6309 DBG_DUMP_FW_REQUEST_FRAME(ioc, (u32 *)prequest);
6310
6311 - ii = mpt_handshake_req_reply_wait(ioc, request_size, (u32*)prequest,
6312 - reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag);
6313 + ii = mpt_handshake_req_reply_wait(ioc, request_size, (u32 *)prequest,
6314 + reply_sz, (u16 *)preply, 65 /*seconds*/, sleepFlag);
6315
6316 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FW Upload completed "
6317 "rc=%x \n", ioc->name, ii));
6318 @@ -3512,10 +3574,10 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6319 */
6320 int status;
6321 status = le16_to_cpu(preply->IOCStatus) &
6322 - MPI_IOCSTATUS_MASK;
6323 + MPI_IOCSTATUS_MASK;
6324 if (status == MPI_IOCSTATUS_SUCCESS &&
6325 ioc->facts.FWImageSize ==
6326 - le32_to_cpu(preply->ActualImageSize));
6327 + le32_to_cpu(preply->ActualImageSize))
6328 cmdStatus = 0;
6329 }
6330 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "do_upload cmdStatus=%d \n",
6331 @@ -3532,6 +3594,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6332 return cmdStatus;
6333 }
6334
6335 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6336 /**
6337 * mpt_downloadboot - DownloadBoot code
6338 * @ioc: Pointer to MPT_ADAPTER structure
6339 @@ -3544,7 +3607,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int slee
6340 * -1 FW Image size is 0
6341 * -2 No valid cached_fw Pointer
6342 * <0 for fw upload failure.
6343 - **/
6344 + */
6345 static int
6346 mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
6347 {
6348 @@ -3648,13 +3711,15 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6349 }
6350
6351 /* Write the IopResetVectorRegAddr */
6352 - ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Addr=%x! \n",
6353 - ioc->name, pFwHeader->IopResetRegAddr));
6354 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6355 + "Write IopResetVector Addr=%x!\n", ioc->name,
6356 + pFwHeader->IopResetRegAddr));
6357 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->IopResetRegAddr);
6358
6359 /* Write the IopResetVectorValue */
6360 - ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Value=%x! \n",
6361 - ioc->name, pFwHeader->IopResetVectorValue));
6362 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6363 + "Write IopResetVector Value=%x!\n", ioc->name,
6364 + pFwHeader->IopResetVectorValue));
6365 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, pFwHeader->IopResetVectorValue);
6366
6367 /* Clear the internal flash bad bit - autoincrementing register,
6368 @@ -3684,7 +3749,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6369 ioc->name, diag0val));
6370 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val);
6371
6372 - if (ioc->bus_type == SAS ) {
6373 + if (ioc->bus_type == SAS) {
6374 /* wait 1 sec */
6375 if (sleepFlag == CAN_SLEEP)
6376 msleep(1000);
6377 @@ -3692,7 +3757,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6378 mdelay(1000);
6379
6380 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
6381 - ddlprintk(ioc, printk (MYIOC_s_DEBUG_FMT
6382 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6383 "diag0val=%x, turning off RW_ENABLE\n", ioc->name,
6384 diag0val));
6385 diag0val &= ~(MPI_DIAG_RW_ENABLE);
6386 @@ -3715,8 +3780,9 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6387 /* Write 0xFF to reset the sequencer */
6388 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
6389
6390 - for (count = 0; count < 30; count ++) {
6391 - doorbell = CHIPREG_READ32(&ioc->chip->Doorbell) & MPI_IOC_STATE_MASK;
6392 + for (count = 0; count < 30; count++) {
6393 + doorbell = CHIPREG_READ32(&ioc->chip->Doorbell)
6394 + & MPI_IOC_STATE_MASK;
6395 if (doorbell == MPI_IOC_STATE_READY) {
6396 if (ioc->bus_type == SAS)
6397 return 0;
6398 @@ -3729,17 +3795,20 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6399 "SendIocInit successful\n", ioc->name));
6400 return 0;
6401 }
6402 - ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "looking for READY STATE:"
6403 - " doorbell=%x count=%d\n", ioc->name, doorbell, count));
6404 + ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6405 + "looking for READY STATE: doorbell=%x count=%d\n",
6406 + ioc->name, doorbell, count));
6407 if (sleepFlag == CAN_SLEEP)
6408 msleep(1000);
6409 else
6410 mdelay(1000);
6411 }
6412 - ddlprintk(ioc, printk(MYIOC_s_WARN_FMT "downloadboot failed! count=%d\n", ioc->name, count));
6413 + ddlprintk(ioc, printk(MYIOC_s_WARN_FMT
6414 + "downloadboot failed! count=%d\n", ioc->name, count));
6415 return -EFAULT;
6416 }
6417
6418 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6419 /**
6420 * KickStart - Perform hard reset of MPT adapter.
6421 * @ioc: Pointer to MPT_ADAPTER structure
6422 @@ -3764,7 +3833,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFw
6423 * OR reset but failed to come READY
6424 * -2 - no reset, could not enter DIAG mode
6425 * -3 - reset but bad FW bit
6426 - **/
6427 + */
6428 static int
6429 KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
6430 {
6431 @@ -3790,16 +3859,20 @@ KickStart(MPT_ADAPTER *ioc, int force, i
6432 if (hard_reset_done < 0)
6433 return hard_reset_done;
6434
6435 - /* may not have worked but hard_reset_done doesn't always signal failure */
6436 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "Diagnostic reset completed!\n",
6437 - ioc->name));
6438 + /* may not have worked but hard_reset_done
6439 + * doesn't always signal failure
6440 + */
6441 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6442 + "Diagnostic reset completed!\n", ioc->name));
6443
6444 cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 2; /* 2 seconds */
6445 for (cnt=0; cnt<cntdn; cnt++) {
6446 ioc_state = mpt_GetIocState(ioc, 1);
6447 - if ((ioc_state == MPI_IOC_STATE_READY) || (ioc_state == MPI_IOC_STATE_OPERATIONAL)) {
6448 - dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "KickStart successful! (cnt=%d)\n",
6449 - ioc->name, cnt));
6450 + if ((ioc_state == MPI_IOC_STATE_READY) ||
6451 + (ioc_state == MPI_IOC_STATE_OPERATIONAL)) {
6452 + dinitprintk(ioc, printk(MYIOC_s_INFO_FMT
6453 + "KickStart successful! (cnt=%d)\n", ioc->name,
6454 + cnt));
6455 return hard_reset_done;
6456 }
6457 if (sleepFlag == CAN_SLEEP) {
6458 @@ -3814,6 +3887,7 @@ KickStart(MPT_ADAPTER *ioc, int force, i
6459 return -1;
6460 }
6461
6462 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6463 /**
6464 * mpt_diag_reset - Perform hard reset of the adapter.
6465 * @ioc: Pointer to MPT_ADAPTER structure
6466 @@ -3831,7 +3905,7 @@ KickStart(MPT_ADAPTER *ioc, int force, i
6467 * 0 no reset performed because reset history bit set
6468 * -2 enabling diagnostic mode failed
6469 * -3 diagnostic reset failed
6470 - **/
6471 + */
6472 static int
6473 mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
6474 {
6475 @@ -3852,7 +3926,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6476 return 0;
6477
6478 drsprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
6479 - "address=%p\n", ioc->name, __FUNCTION__, &ioc->chip->Doorbell,
6480 + "address=%p\n", ioc->name, __func__, &ioc->chip->Doorbell,
6481 &ioc->chip->Reset_1078));
6482 CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07);
6483 if (sleepFlag == CAN_SLEEP)
6484 @@ -3868,7 +3942,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6485 */
6486 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
6487 if (MptResetHandlers[cb_idx])
6488 - (*(MptResetHandlers[cb_idx]))(ioc, MPT_IOC_PRE_RESET);
6489 + (*(MptResetHandlers[cb_idx]))
6490 + (ioc, MPT_IOC_PRE_RESET);
6491 }
6492
6493 for (count = 0; count < 60; count ++) {
6494 @@ -3907,8 +3982,10 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6495
6496 if (ioc->debug_level & MPT_DEBUG_RESET) {
6497 if (ioc->alt_ioc)
6498 - diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6499 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG1: diag0=%08x, diag1=%08x\n",
6500 + diag1val =
6501 + CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6502 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6503 + "DbG1: diag0=%08x, diag1=%08x\n",
6504 ioc->name, diag0val, diag1val));
6505 }
6506
6507 @@ -3943,14 +4020,16 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6508
6509 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
6510
6511 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Wrote magic DiagWriteEn sequence (%x)\n",
6512 - ioc->name, diag0val));
6513 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6514 + "Wrote magic DiagWriteEn sequence (%x)\n",
6515 + ioc->name, diag0val));
6516 }
6517
6518 if (ioc->debug_level & MPT_DEBUG_RESET) {
6519 if (ioc->alt_ioc)
6520 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6521 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG2: diag0=%08x, diag1=%08x\n",
6522 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6523 + "DbG2: diag0=%08x, diag1=%08x\n",
6524 ioc->name, diag0val, diag1val));
6525 }
6526 /*
6527 @@ -3966,8 +4045,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6528 */
6529 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER);
6530 hard_reset_done = 1;
6531 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Diagnostic reset performed\n",
6532 - ioc->name));
6533 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6534 + "Diagnostic reset performed\n", ioc->name));
6535
6536 /*
6537 * Call each currently registered protocol IOC reset handler
6538 @@ -3977,10 +4056,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6539 */
6540 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
6541 if (MptResetHandlers[cb_idx]) {
6542 - mpt_signal_reset(cb_idx, ioc, MPT_IOC_PRE_RESET);
6543 - if (ioc->alt_ioc) {
6544 - mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_PRE_RESET);
6545 - }
6546 + mpt_signal_reset(cb_idx, ioc,
6547 + MPT_IOC_PRE_RESET);
6548 + if (ioc->alt_ioc)
6549 + mpt_signal_reset(cb_idx,
6550 + ioc->alt_ioc, MPT_IOC_PRE_RESET);
6551 }
6552 }
6553
6554 @@ -4001,7 +4081,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6555 break;
6556 }
6557
6558 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "cached_fw: diag0val=%x count=%d\n",
6559 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6560 + "cached_fw: diag0val=%x count=%d\n",
6561 ioc->name, diag0val, count));
6562 /* wait 1 sec */
6563 if (sleepFlag == CAN_SLEEP)
6564 @@ -4055,7 +4136,8 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6565 if (ioc->debug_level & MPT_DEBUG_RESET) {
6566 if (ioc->alt_ioc)
6567 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6568 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG3: diag0=%08x, diag1=%08x\n",
6569 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6570 + "DbG3: diag0=%08x, diag1=%08x\n",
6571 ioc->name, diag0val, diag1val));
6572 }
6573
6574 @@ -4113,8 +4195,9 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6575 if (ioc->debug_level & MPT_DEBUG_RESET) {
6576 if (ioc->alt_ioc)
6577 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
6578 - drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG4: diag0=%08x, diag1=%08x\n",
6579 - ioc->name, diag0val, diag1val));
6580 + drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6581 + "DbG4: diag0=%08x, diag1=%08x\n",
6582 + ioc->name, diag0val, diag1val));
6583 }
6584
6585 /*
6586 @@ -4128,6 +4211,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6587 return hard_reset_done;
6588 }
6589
6590 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6591 /**
6592 * SendIocReset - Send IOCReset request to MPT adapter.
6593 * @ioc: Pointer to MPT_ADAPTER structure
6594 @@ -4138,7 +4222,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ign
6595 * Send IOCReset request to the MPT adapter.
6596 *
6597 * Returns 0 for success, non-zero for failure.
6598 - **/
6599 + */
6600 static int
6601 SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
6602 {
6603 @@ -4164,8 +4248,9 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_
6604 if (sleepFlag != CAN_SLEEP)
6605 count *= 10;
6606
6607 - printk(MYIOC_s_ERR_FMT "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6608 - ioc->name, state, (int)((count+5)/HZ));
6609 + printk(MYIOC_s_ERR_FMT
6610 + "Wait IOC_READY state (0x%x) timeout(%d)!\n",
6611 + ioc->name, state, (int)((count+5)/HZ));
6612 return -ETIME;
6613 }
6614
6615 @@ -4176,23 +4261,20 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_
6616 }
6617 }
6618
6619 - /* TODO!
6620 - * Cleanup all event stuff for this IOC; re-issue EventNotification
6621 - * request if needed.
6622 - */
6623 if (ioc->facts.Function)
6624 ioc->facts.EventState = 0;
6625
6626 return 0;
6627 }
6628
6629 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6630 /**
6631 * initChainBuffers - Allocate memory for and initialize chain buffers
6632 * @ioc: Pointer to MPT_ADAPTER structure
6633 *
6634 * Allocates memory for and initializes chain buffers,
6635 * chain buffer control arrays and spinlock.
6636 - **/
6637 + */
6638 static int
6639 initChainBuffers(MPT_ADAPTER *ioc)
6640 {
6641 @@ -4234,11 +4316,11 @@ initChainBuffers(MPT_ADAPTER *ioc)
6642 * num_sge = num sge in request frame + last chain buffer
6643 * scale = num sge per chain buffer if no chain element
6644 */
6645 - scale = ioc->req_sz/ ioc->SGE_size;
6646 + scale = ioc->req_sz / ioc->SGE_size;
6647 if (ioc->sg_addr_size == sizeof(u64))
6648 num_sge = scale + (ioc->req_sz - 60) / ioc->SGE_size;
6649 else
6650 - num_sge = 1+ scale + (ioc->req_sz - 64) / ioc->SGE_size;
6651 + num_sge = 1 + scale + (ioc->req_sz - 64) / ioc->SGE_size;
6652
6653 if (ioc->sg_addr_size == sizeof(u64)) {
6654 numSGE = (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale +
6655 @@ -4253,8 +4335,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
6656 if (ioc->bus_type == FC) {
6657 if (numSGE > MPT_SCSI_FC_SG_DEPTH)
6658 numSGE = MPT_SCSI_FC_SG_DEPTH;
6659 - }
6660 - else {
6661 + } else {
6662 if (numSGE > MPT_SCSI_SG_DEPTH)
6663 numSGE = MPT_SCSI_SG_DEPTH;
6664 }
6665 @@ -4292,6 +4373,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
6666 return num_chain;
6667 }
6668
6669 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6670 /**
6671 * PrimeIocFifos - Initialize IOC request and reply FIFOs.
6672 * @ioc: Pointer to MPT_ADAPTER structure
6673 @@ -4301,7 +4383,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
6674 * reply frames.
6675 *
6676 * Returns 0 for success, non-zero for failure.
6677 - **/
6678 + */
6679 static int
6680 PrimeIocFifos(MPT_ADAPTER *ioc)
6681 {
6682 @@ -4513,6 +4595,7 @@ out_fail:
6683 return -1;
6684 }
6685
6686 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6687 /**
6688 * mpt_handshake_req_reply_wait - Send MPT request to and receive reply
6689 * from IOC via doorbell handshake method.
6690 @@ -4530,7 +4613,7 @@ out_fail:
6691 * greater than 1 byte in size.
6692 *
6693 * Returns 0 for success, non-zero for failure.
6694 - **/
6695 + */
6696 static int
6697 mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
6698 int replyBytes, u16 *u16reply, int maxwait, int sleepFlag)
6699 @@ -4624,6 +4707,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER
6700 return -failcnt;
6701 }
6702
6703 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6704 /**
6705 * WaitForDoorbellAck - Wait for IOC doorbell handshake acknowledge
6706 * @ioc: Pointer to MPT_ADAPTER structure
6707 @@ -4635,7 +4719,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER
6708 * bit in its IntStatus register being clear.
6709 *
6710 * Returns a negative value on failure, else wait loop count.
6711 - **/
6712 + */
6713 static int
6714 WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
6715 {
6716 @@ -4674,6 +4758,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int
6717 return -1;
6718 }
6719
6720 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6721 /**
6722 * WaitForDoorbellInt - Wait for IOC to set its doorbell interrupt bit
6723 * @ioc: Pointer to MPT_ADAPTER structure
6724 @@ -4684,7 +4769,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int
6725 * (MPI_HIS_DOORBELL_INTERRUPT) to be set in the IntStatus register.
6726 *
6727 * Returns a negative value on failure, else wait loop count.
6728 - **/
6729 + */
6730 static int
6731 WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
6732 {
6733 @@ -4703,7 +4788,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
6734 }
6735 } else {
6736 while (--cntdn) {
6737 - udelay (1000);
6738 + udelay(1000);
6739 intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
6740 if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
6741 break;
6742 @@ -4722,6 +4807,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
6743 return -1;
6744 }
6745
6746 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6747 /**
6748 * WaitForDoorbellReply - Wait for and capture an IOC handshake reply.
6749 * @ioc: Pointer to MPT_ADAPTER structure
6750 @@ -4733,7 +4819,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int
6751 * of 128 bytes of reply data.
6752 *
6753 * Returns a negative value on failure, else size of reply in WORDS.
6754 - **/
6755 + */
6756 static int
6757 WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
6758 {
6759 @@ -4807,6 +4893,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, i
6760 return u16cnt/2;
6761 }
6762
6763 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6764 /**
6765 * GetLanConfigPages - Fetch LANConfig pages.
6766 * @ioc: Pointer to MPT_ADAPTER structure
6767 @@ -4816,7 +4903,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, i
6768 * -EPERM if not allowed due to ISR context
6769 * -EAGAIN if no msg frames currently available
6770 * -EFAULT for non-successful reply or no reply (timeout)
6771 - **/
6772 + */
6773 static int
6774 GetLanConfigPages(MPT_ADAPTER *ioc)
6775 {
6776 @@ -4863,10 +4950,6 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
6777
6778 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
6779
6780 - /* FIXME!
6781 - * Normalize endianness of structure data,
6782 - * by byte-swapping all > 1 byte fields!
6783 - */
6784
6785 }
6786
6787 @@ -4907,16 +4990,12 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
6788
6789 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage1_alloc, page1_dma);
6790
6791 - /* FIXME!
6792 - * Normalize endianness of structure data,
6793 - * by byte-swapping all > 1 byte fields!
6794 - */
6795 -
6796 }
6797
6798 return rc;
6799 }
6800
6801 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6802 /**
6803 * mptbase_sas_persist_operation - Perform operation on SAS Persistent Table
6804 * @ioc: Pointer to MPT_ADAPTER structure
6805 @@ -4929,7 +5008,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
6806 * NOTE: Don't use not this function during interrupt time.
6807 *
6808 * Returns 0 for success, non-zero error
6809 - **/
6810 + */
6811 int
6812 mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode)
6813 {
6814 @@ -4958,12 +5037,12 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6815 goto out;
6816 }
6817
6818 - printk("%s: persist_opcode=%x\n",__FUNCTION__, persist_opcode);
6819 + printk("%s: persist_opcode=%x\n",__func__, persist_opcode);
6820
6821 /* Get a MF for this command.
6822 */
6823 if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
6824 - printk("%s: no msg frames!\n",__FUNCTION__);
6825 + printk("%s: no msg frames!\n",__func__);
6826 ret = -1;
6827 goto out;
6828 }
6829 @@ -4979,12 +5058,12 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6830 timeleft = wait_for_completion_timeout(&ioc->mptbase_cmds.done, 10*HZ);
6831 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
6832 ret = -ETIME;
6833 - printk("%s: failed\n", __FUNCTION__);
6834 + printk(KERN_WARNING "%s: failed\n", __func__);
6835 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
6836 goto out;
6837 if (!timeleft) {
6838 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
6839 - ioc->name, __FUNCTION__);
6840 + ioc->name, __func__);
6841 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
6842 mpt_HardResetHandler(ioc, CAN_SLEEP);
6843 mpt_free_msg_frame(ioc, mf);
6844 @@ -5000,12 +5079,13 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6845 sasIoUnitCntrReply =
6846 (SasIoUnitControlReply_t *)ioc->mptbase_cmds.reply;
6847 if (le16_to_cpu(sasIoUnitCntrReply->IOCStatus) != MPI_IOCSTATUS_SUCCESS) {
6848 - printk("%s: IOCStatus=0x%X IOCLogInfo=0x%X\n", __FUNCTION__,
6849 - sasIoUnitCntrReply->IOCStatus, sasIoUnitCntrReply->IOCLogInfo);
6850 - printk("%s: failed\n",__FUNCTION__);
6851 + printk(KERN_WARNING "%s: IOCStatus=0x%X IOCLogInfo=0x%X\n",
6852 + __func__, sasIoUnitCntrReply->IOCStatus,
6853 + sasIoUnitCntrReply->IOCLogInfo);
6854 + printk(KERN_WARNING "%s: failed\n", __func__);
6855 ret = -1;
6856 } else
6857 - printk("%s: success\n",__FUNCTION__);
6858 + printk(KERN_INFO "%s: success\n", __func__);
6859 out:
6860
6861 CLEAR_MGMT_STATUS(ioc->mptbase_cmds.status)
6862 @@ -5013,6 +5093,8 @@ mptbase_sas_persist_operation(MPT_ADAPTE
6863 return ret;
6864 }
6865
6866 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6867 +
6868 static void
6869 mptbase_raid_process_event_data(MPT_ADAPTER *ioc,
6870 MpiEventDataRaid_t * pRaidEventData)
6871 @@ -5143,6 +5225,7 @@ mptbase_raid_process_event_data(MPT_ADAP
6872 }
6873 }
6874
6875 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6876 /**
6877 * GetIoUnitPage2 - Retrieve BIOS version and boot order information.
6878 * @ioc: Pointer to MPT_ADAPTER structure
6879 @@ -5152,7 +5235,7 @@ mptbase_raid_process_event_data(MPT_ADAP
6880 * -EPERM if not allowed due to ISR context
6881 * -EAGAIN if no msg frames currently available
6882 * -EFAULT for non-successful reply or no reply (timeout)
6883 - **/
6884 + */
6885 static int
6886 GetIoUnitPage2(MPT_ADAPTER *ioc)
6887 {
6888 @@ -5200,6 +5283,7 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
6889 return rc;
6890 }
6891
6892 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6893 /**
6894 * mpt_GetScsiPortSettings - read SCSI Port Page 0 and 2
6895 * @ioc: Pointer to a Adapter Strucutre
6896 @@ -5219,7 +5303,7 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
6897 * Both valid
6898 * Return 0
6899 * CHECK - what type of locking mechanisms should be used????
6900 - **/
6901 + */
6902 static int
6903 mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
6904 {
6905 @@ -5290,7 +5374,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6906
6907 if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) {
6908 ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS;
6909 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "noQas due to Capabilities=%x\n",
6910 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6911 + "noQas due to Capabilities=%x\n",
6912 ioc->name, pPP0->Capabilities));
6913 }
6914 ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0;
6915 @@ -5299,7 +5384,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6916 ioc->spi_data.maxSyncOffset = (u8) (data >> 16);
6917 data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK;
6918 ioc->spi_data.minSyncFactor = (u8) (data >> 8);
6919 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PortPage0 minSyncFactor=%x\n",
6920 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6921 + "PortPage0 minSyncFactor=%x\n",
6922 ioc->name, ioc->spi_data.minSyncFactor));
6923 } else {
6924 ioc->spi_data.maxSyncOffset = 0;
6925 @@ -5315,7 +5401,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6926
6927 if (ioc->spi_data.minSyncFactor < MPT_ULTRA) {
6928 ioc->spi_data.minSyncFactor = MPT_ULTRA;
6929 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HVD or SE detected, minSyncFactor=%x\n",
6930 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6931 + "HVD or SE detected, minSyncFactor=%x\n",
6932 ioc->name, ioc->spi_data.minSyncFactor));
6933 }
6934 }
6935 @@ -5420,6 +5507,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6936 return rc;
6937 }
6938
6939 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6940 /**
6941 * mpt_readScsiDevicePageHeaders - save version and length of SDP1
6942 * @ioc: Pointer to a Adapter Strucutre
6943 @@ -5427,7 +5515,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc
6944 *
6945 * Return: -EFAULT if read of config page header fails
6946 * or 0 if success.
6947 - **/
6948 + */
6949 static int
6950 mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum)
6951 {
6952 @@ -5475,7 +5563,7 @@ mpt_read_ioc_pg_6(MPT_ADAPTER *ioc)
6953 {
6954 CONFIGPARMS cfg;
6955 ConfigPageHeader_t header;
6956 - IOCPage6_t *pIoc6=NULL;
6957 + IOCPage6_t *pIoc6 = NULL;
6958 dma_addr_t ioc6_dma;
6959 int iocpage6sz;
6960 void *mem;
6961 @@ -5546,13 +5634,13 @@ mpt_inactive_raid_list_free(MPT_ADAPTER
6962 if (list_empty(&ioc->raid_data.inactive_list))
6963 return;
6964
6965 - down(&ioc->raid_data.inactive_list_mutex);
6966 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
6967 list_for_each_entry_safe(component_info, pNext,
6968 &ioc->raid_data.inactive_list, list) {
6969 list_del(&component_info->list);
6970 kfree(component_info);
6971 }
6972 - up(&ioc->raid_data.inactive_list_mutex);
6973 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
6974 }
6975
6976 /**
6977 @@ -5615,7 +5703,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
6978 if (!handle_inactive_volumes)
6979 goto out;
6980
6981 - down(&ioc->raid_data.inactive_list_mutex);
6982 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
6983 for (i = 0; i < buffer->NumPhysDisks; i++) {
6984 if(mpt_raid_phys_disk_pg0(ioc,
6985 buffer->PhysDisk[i].PhysDiskNum, &phys_disk) != 0)
6986 @@ -5631,7 +5719,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
6987 buffer->PhysDisk[i].PhysDiskNum);
6988 if (num_paths < 2)
6989 continue;
6990 - phys_disk_1 = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
6991 + phys_disk_1 = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
6992 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
6993 if (!phys_disk_1)
6994 continue;
6995 @@ -5658,7 +5746,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
6996 list_add_tail(&component_info->list,
6997 &ioc->raid_data.inactive_list);
6998 }
6999 - up(&ioc->raid_data.inactive_list_mutex);
7000 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
7001
7002 out:
7003 if (buffer)
7004 @@ -5678,7 +5766,8 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *i
7005 * -ENOMEM if pci_alloc failed
7006 **/
7007 int
7008 -mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, RaidPhysDiskPage0_t *phys_disk)
7009 +mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num,
7010 + RaidPhysDiskPage0_t *phys_disk)
7011 {
7012 CONFIGPARMS cfg;
7013 ConfigPageHeader_t hdr;
7014 @@ -5812,7 +5901,8 @@ mpt_raid_phys_disk_get_num_paths(MPT_ADA
7015 * -ENOMEM if pci_alloc failed
7016 **/
7017 int
7018 -mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, RaidPhysDiskPage1_t *phys_disk)
7019 +mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num,
7020 + RaidPhysDiskPage1_t *phys_disk)
7021 {
7022 CONFIGPARMS cfg;
7023 ConfigPageHeader_t hdr;
7024 @@ -5865,14 +5955,20 @@ mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc,
7025 for (i = 0; i < phys_disk->NumPhysDiskPaths; i++) {
7026 phys_disk->Path[i].PhysDiskID = buffer->Path[i].PhysDiskID;
7027 phys_disk->Path[i].PhysDiskBus = buffer->Path[i].PhysDiskBus;
7028 - phys_disk->Path[i].OwnerIdentifier = buffer->Path[i].OwnerIdentifier;
7029 - phys_disk->Path[i].Flags = le16_to_cpu(buffer->Path[i].Flags);
7030 - memcpy(&sas_address, &buffer->Path[i].WWID, sizeof(__le64));
7031 + phys_disk->Path[i].OwnerIdentifier =
7032 + buffer->Path[i].OwnerIdentifier;
7033 + phys_disk->Path[i].Flags =
7034 + le16_to_cpu(buffer->Path[i].Flags);
7035 + memcpy(&sas_address, &buffer->Path[i].WWID,
7036 + sizeof(__le64));
7037 sas_address = le64_to_cpu(sas_address);
7038 - memcpy(&phys_disk->Path[i].WWID, &sas_address, sizeof(__le64));
7039 - memcpy(&sas_address, &buffer->Path[i].OwnerWWID, sizeof(__le64));
7040 + memcpy(&phys_disk->Path[i].WWID, &sas_address,
7041 + sizeof(__le64));
7042 + memcpy(&sas_address, &buffer->Path[i].OwnerWWID,
7043 + sizeof(__le64));
7044 sas_address = le64_to_cpu(sas_address);
7045 - memcpy(&phys_disk->Path[i].OwnerWWID, &sas_address, sizeof(__le64));
7046 + memcpy(&phys_disk->Path[i].OwnerWWID, &sas_address,
7047 + sizeof(__le64));
7048 }
7049
7050 out:
7051 @@ -5896,8 +5992,8 @@ mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc,
7052 static int
7053 mpt_sort_ioc_pg2(const void *a, const void *b)
7054 {
7055 - ConfigPageIoc2RaidVol_t * volume_a = (ConfigPageIoc2RaidVol_t *)a;
7056 - ConfigPageIoc2RaidVol_t * volume_b = (ConfigPageIoc2RaidVol_t *)b;
7057 + ConfigPageIoc2RaidVol_t *volume_a = (ConfigPageIoc2RaidVol_t *)a;
7058 + ConfigPageIoc2RaidVol_t *volume_b = (ConfigPageIoc2RaidVol_t *)b;
7059
7060 if (volume_a->VolumeBus == volume_b->VolumeBus) {
7061 if (volume_a->VolumeID == volume_b->VolumeID)
7062 @@ -6186,7 +6282,8 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
7063 }
7064
7065 } else {
7066 - dprintk(ioc, printk(MYIOC_s_WARN_FMT "Coalescing Disabled\n", ioc->name));
7067 + dprintk(ioc, printk(MYIOC_s_WARN_FMT
7068 + "Coalescing Disabled\n", ioc->name));
7069 }
7070 }
7071
7072 @@ -6238,12 +6335,13 @@ mpt_get_manufacturing_pg_0(MPT_ADAPTER *
7073 pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);
7074 }
7075
7076 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7077 /**
7078 * SendEventNotification - Send EventNotification (on or off) request to adapter
7079 * @ioc: Pointer to MPT_ADAPTER structure
7080 * @EvSwitch: Event switch flags
7081 * @sleepFlag: Specifies whether the process can sleep
7082 - **/
7083 + */
7084 static int
7085 SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch, int sleepFlag)
7086 {
7087 @@ -6262,15 +6360,16 @@ SendEventNotification(MPT_ADAPTER *ioc,
7088 ioc->name, EvSwitch, &evn));
7089
7090 return mpt_handshake_req_reply_wait(ioc, sizeof(EventNotification_t),
7091 - (u32*)&evn, sizeof(MPIDefaultReply_t), (u16*)&reply_buf, 30,
7092 + (u32 *)&evn, sizeof(MPIDefaultReply_t), (u16 *)&reply_buf, 30,
7093 sleepFlag);
7094 }
7095
7096 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7097 /**
7098 * SendEventAck - Send EventAck request to MPT adapter.
7099 * @ioc: Pointer to MPT_ADAPTER structure
7100 * @evnp: Pointer to original EventNotification request
7101 - **/
7102 + */
7103 static int
7104 SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp)
7105 {
7106 @@ -6278,7 +6377,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNoti
7107
7108 if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
7109 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
7110 - ioc->name,__FUNCTION__));
7111 + ioc->name,__func__));
7112 return -1;
7113 }
7114
7115 @@ -6297,6 +6396,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNoti
7116 return 0;
7117 }
7118
7119 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7120 /**
7121 * mpt_config - Generic function to issue config message
7122 * @ioc: Pointer to an adapter structure
7123 @@ -6309,7 +6409,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNoti
7124 * -EPERM if not allowed due to ISR context
7125 * -EAGAIN if no msg frames currently available
7126 * -EFAULT for non-successful reply or no reply (timeout)
7127 - **/
7128 + */
7129 int
7130 mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
7131 {
7132 @@ -6334,7 +6434,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7133 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
7134 if (ioc->ioc_reset_in_progress) {
7135 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7136 - "%s: busy with host reset\n", ioc->name, __FUNCTION__));
7137 + "%s: busy with host reset\n", ioc->name, __func__));
7138 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7139 return -EBUSY;
7140 }
7141 @@ -6345,7 +6445,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7142 mpt_GetIocState(ioc, 1) != MPI_IOC_STATE_OPERATIONAL) {
7143 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7144 "%s: ioc not operational, %d, %xh\n",
7145 - ioc->name, __FUNCTION__, ioc->active,
7146 + ioc->name, __func__, ioc->active,
7147 mpt_GetIocState(ioc, 0)));
7148 return -EFAULT;
7149 }
7150 @@ -6423,7 +6523,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7151 ioc->add_sge((char *)&pReq->PageBufferSGE, flagsLength, pCfg->physAddr);
7152 timeout = (pCfg->timeout < 15) ? HZ*15 : HZ*pCfg->timeout;
7153 mpt_put_msg_frame(mpt_base_index, ioc, mf);
7154 - timeleft = wait_for_completion_timeout(&ioc->mptbase_cmds.done, timeout);
7155 + timeleft =
7156 + wait_for_completion_timeout(&ioc->mptbase_cmds.done, timeout);
7157 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
7158 ret = -ETIME;
7159 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7160 @@ -6459,7 +6560,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7161 }
7162
7163 if (retry_count)
7164 - printk(MYIOC_s_INFO_FMT "Retry completed ret=0x%x timeleft=%ld\n",
7165 + printk(MYIOC_s_INFO_FMT
7166 + "Retry completed ret=0x%x timeleft=%ld\n",
7167 ioc->name, ret, timeleft);
7168
7169 dcprintk(ioc, printk(KERN_DEBUG "IOCStatus=%04xh, IOCLogInfo=%08xh\n",
7170 @@ -6472,15 +6574,15 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7171 if (issue_hard_reset) {
7172 issue_hard_reset = 0;
7173 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
7174 - ioc->name, __FUNCTION__);
7175 + ioc->name, __func__);
7176 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
7177 mpt_HardResetHandler(ioc, CAN_SLEEP);
7178 mpt_free_msg_frame(ioc, mf);
7179 /* attempt one retry for a timed out command */
7180 if (!retry_count) {
7181 printk(MYIOC_s_INFO_FMT
7182 - "Attempting Retry Config request type 0x%x, page 0x%x,"
7183 - " action %d\n", ioc->name, page_type,
7184 + "Attempting Retry Config request type 0x%x,"
7185 + " page 0x%x, action %d\n", ioc->name, page_type,
7186 pCfg->cfghdr.hdr->PageNumber, pCfg->action);
7187 retry_count++;
7188 goto retry_config;
7189 @@ -6489,37 +6591,40 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS
7190 return ret;
7191 }
7192
7193 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7194 /**
7195 * mpt_ioc_reset - Base cleanup for hard reset
7196 * @ioc: Pointer to the adapter structure
7197 * @reset_phase: Indicates pre- or post-reset functionality
7198 *
7199 * Remark: Frees resources with internally generated commands.
7200 - **/
7201 + */
7202 static int
7203 mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
7204 {
7205 - switch(reset_phase) {
7206 + switch (reset_phase) {
7207 case MPT_IOC_SETUP_RESET:
7208 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7209 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
7210 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
7211 ioc->taskmgmt_quiesce_io = 1;
7212 break;
7213 case MPT_IOC_PRE_RESET:
7214 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7215 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
7216 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
7217 break;
7218 case MPT_IOC_POST_RESET:
7219 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7220 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
7221 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
7222 /* wake up mptbase_cmds */
7223 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_PENDING) {
7224 - ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
7225 + ioc->mptbase_cmds.status
7226 + |= MPT_MGMT_STATUS_DID_IOCRESET;
7227 complete(&ioc->mptbase_cmds.done);
7228 }
7229 /* wake up taskmgmt_cmds */
7230 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_PENDING) {
7231 - ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
7232 + ioc->taskmgmt_cmds.status
7233 + |= MPT_MGMT_STATUS_DID_IOCRESET;
7234 complete(&ioc->taskmgmt_cmds.done);
7235 }
7236 break;
7237 @@ -6532,11 +6637,12 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int rese
7238
7239
7240 #ifdef CONFIG_PROC_FS /* { */
7241 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7242 /**
7243 * procmpt_create - Create %MPT_PROCFS_MPTBASEDIR entries.
7244 *
7245 * Returns 0 for success, non-zero for failure.
7246 - **/
7247 + */
7248 static int
7249 procmpt_create(void)
7250 {
7251 @@ -6557,11 +6663,12 @@ procmpt_create(void)
7252 return 0;
7253 }
7254
7255 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7256 /**
7257 * procmpt_destroy - Tear down %MPT_PROCFS_MPTBASEDIR entries.
7258 *
7259 * Returns 0 for success, non-zero for failure.
7260 - **/
7261 + */
7262 static void
7263 procmpt_destroy(void)
7264 {
7265 @@ -6570,6 +6677,7 @@ procmpt_destroy(void)
7266 remove_proc_entry(MPT_PROCFS_MPTBASEDIR, NULL);
7267 }
7268
7269 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7270 /**
7271 * procmpt_summary_read - Handle read request of a summary file
7272 * @buf: Pointer to area to write information
7273 @@ -6581,7 +6689,7 @@ procmpt_destroy(void)
7274 *
7275 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary.
7276 * Returns number of characters written to process performing the read.
7277 - **/
7278 + */
7279 static int
7280 procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
7281 {
7282 @@ -6613,6 +6721,7 @@ procmpt_summary_read(char *buf, char **s
7283 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len);
7284 }
7285
7286 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7287 /**
7288 * procmpt_version_read - Handle read request from /proc/mpt/version.
7289 * @buf: Pointer to area to write information
7290 @@ -6623,7 +6732,7 @@ procmpt_summary_read(char *buf, char **s
7291 * @data: Pointer
7292 *
7293 * Returns number of characters written to process performing the read.
7294 - **/
7295 + */
7296 static int
7297 procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
7298 {
7299 @@ -6668,6 +6777,7 @@ procmpt_version_read(char *buf, char **s
7300 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len);
7301 }
7302
7303 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7304 /**
7305 * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info.
7306 * @buf: Pointer to area to write information
7307 @@ -6678,7 +6788,7 @@ procmpt_version_read(char *buf, char **s
7308 * @data: Pointer
7309 *
7310 * Returns number of characters written to process performing the read.
7311 - **/
7312 + */
7313 static int
7314 procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
7315 {
7316 @@ -6779,6 +6889,7 @@ mpt_get_fw_exp_ver(char *buf, MPT_ADAPTE
7317 }
7318 }
7319
7320 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7321 /**
7322 * mpt_print_ioc_summary - Write ASCII summary of IOC to a buffer.
7323 * @ioc: Pointer to MPT_ADAPTER structure
7324 @@ -6789,7 +6900,7 @@ mpt_get_fw_exp_ver(char *buf, MPT_ADAPTE
7325 *
7326 * This routine writes (english readable) ASCII text, which represents
7327 * a summary of IOC information, to a buffer.
7328 - **/
7329 + */
7330 void
7331 mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int showlan)
7332 {
7333 @@ -6901,19 +7012,19 @@ mpt_halt_firmware(MPT_ADAPTER *ioc)
7334 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {
7335 printk(MYIOC_s_ERR_FMT "IOC is in FAULT state (%04xh)!!!\n",
7336 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
7337 - if(mpt_fwfault_debug == 2)
7338 - for(;;);
7339 + if (mpt_fwfault_debug == 2)
7340 + for (;;);
7341 else
7342 - panic("%s: IOC Fault (%04xh)!!!\n",ioc->name,
7343 + panic("%s: IOC Fault (%04xh)!!!\n", ioc->name,
7344 ioc_raw_state & MPI_DOORBELL_DATA_MASK);
7345 } else {
7346 CHIPREG_WRITE32(&ioc->chip->Doorbell, 0xC0FFEE00);
7347 - if(mpt_fwfault_debug == 2) {
7348 - printk("%s: Firmware is halted due to command timeout\n"
7349 - ,ioc->name);
7350 - for(;;);
7351 - }
7352 - else
7353 + if (mpt_fwfault_debug == 2) {
7354 + printk(KERN_ERR
7355 + "%s: Firmware is halted due to command timeout\n",
7356 + ioc->name);
7357 + for (;;);
7358 + } else
7359 panic("%s: Firmware is halted due to command timeout\n",
7360 ioc->name);
7361 }
7362 @@ -6943,14 +7054,16 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7363 u32 ioc_state;
7364 unsigned long time_count;
7365
7366 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SoftResetHandler Entered!\n", ioc->name));
7367 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7368 + "SoftResetHandler Entered!\n", ioc->name));
7369
7370 ioc_state = mpt_GetIocState(ioc, 0) & MPI_IOC_STATE_MASK;
7371
7372 - if(mpt_fwfault_debug)
7373 + if (mpt_fwfault_debug)
7374 mpt_halt_firmware(ioc);
7375
7376 - if (ioc_state == MPI_IOC_STATE_FAULT || ioc_state == MPI_IOC_STATE_RESET) {
7377 + if (ioc_state == MPI_IOC_STATE_FAULT
7378 + || ioc_state == MPI_IOC_STATE_RESET) {
7379 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7380 "skipping, either in FAULT or RESET state!\n", ioc->name));
7381 return -1;
7382 @@ -6995,11 +7108,10 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7383 if ((rc = GetIocFacts(ioc, sleepFlag,
7384 MPT_HOSTEVENT_IOC_RECOVER)) == 0)
7385 break;
7386 - if (sleepFlag == CAN_SLEEP) {
7387 + if (sleepFlag == CAN_SLEEP)
7388 msleep(100);
7389 - } else {
7390 + else
7391 mdelay(100);
7392 - }
7393 }
7394 if (ii == 5)
7395 goto out;
7396 @@ -7033,13 +7145,15 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7397 if (ioc->active) { /* otherwise, hard reset coming */
7398 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
7399 if (MptResetHandlers[cb_idx])
7400 - mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
7401 + mpt_signal_reset(cb_idx,
7402 + ioc, MPT_IOC_POST_RESET);
7403 }
7404 }
7405
7406 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SoftResetHandler: completed (%d seconds): %s\n",
7407 - ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7408 - ((rc == 0) ? "SUCCESS" : "FAILED")));
7409 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7410 + "SoftResetHandler: completed (%d seconds): %s\n",
7411 + ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7412 + ((rc == 0) ? "SUCCESS" : "FAILED")));
7413
7414 return rc;
7415 }
7416 @@ -7060,7 +7174,7 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, i
7417 * FW reload/initialization failed.
7418 *
7419 * Returns 0 for SUCCESS or -1 if FAILED.
7420 - **/
7421 + */
7422 int
7423 mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7424 {
7425 @@ -7075,7 +7189,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, i
7426 printk("MF count 0x%x !\n", ioc->mfcnt);
7427 #endif
7428
7429 - if(mpt_fwfault_debug)
7430 + if (mpt_fwfault_debug)
7431 mpt_halt_firmware(ioc);
7432
7433 /* Reset the adapter. Prevent more than 1 call to
7434 @@ -7101,14 +7215,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, i
7435 if (MptResetHandlers[cb_idx]) {
7436 mpt_signal_reset(cb_idx, ioc, MPT_IOC_SETUP_RESET);
7437 if (ioc->alt_ioc)
7438 - mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_SETUP_RESET);
7439 + mpt_signal_reset(cb_idx,
7440 + ioc->alt_ioc, MPT_IOC_SETUP_RESET);
7441 }
7442 }
7443
7444 time_count = jiffies;
7445 if ((rc = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_RECOVER, sleepFlag)) != 0) {
7446 - printk(KERN_WARNING MYNAM ": WARNING - (%d) Cannot recover %s\n",
7447 - rc, ioc->name);
7448 + printk(KERN_WARNING MYNAM
7449 + ": WARNING - (%d) Cannot recover %s\n", rc, ioc->name);
7450 } else {
7451 if (ioc->hard_resets < -1)
7452 ioc->hard_resets++;
7453 @@ -7129,13 +7244,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, i
7454 if (MptResetHandlers[cb_idx]) {
7455 mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
7456 if (ioc->alt_ioc)
7457 - mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_POST_RESET);
7458 + mpt_signal_reset(cb_idx,
7459 + ioc->alt_ioc, MPT_IOC_POST_RESET);
7460 }
7461 }
7462
7463 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler: completed (%d seconds): %s\n",
7464 - ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7465 - ((rc == 0) ? "SUCCESS" : "FAILED")));
7466 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7467 + "HardResetHandler: completed (%d seconds): %s\n",
7468 + ioc->name, jiffies_to_msecs(jiffies - time_count)/1000,
7469 + ((rc == 0) ? "SUCCESS" : "FAILED")));
7470 return rc;
7471 }
7472
7473 @@ -7607,6 +7724,7 @@ mpt_display_event_info(MPT_ADAPTER *ioc,
7474 }
7475 #endif
7476
7477 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7478 /**
7479 * ProcessEventNotification - Route EventNotificationReply to all event handlers
7480 * @ioc: Pointer to MPT_ADAPTER structure
7481 @@ -7616,7 +7734,7 @@ mpt_display_event_info(MPT_ADAPTER *ioc,
7482 * Routes a received EventNotificationReply to all currently registered
7483 * event handlers.
7484 * Returns sum of event handlers return values.
7485 - **/
7486 + */
7487 static int
7488 ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply, int *evHandlers)
7489 {
7490 @@ -7695,12 +7813,12 @@ ProcessEventNotification(MPT_ADAPTER *io
7491 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
7492 if (MptEvHandlers[cb_idx]) {
7493 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7494 - "Routing Event to event handler #%d\n", ioc->name, cb_idx));
7495 + "Routing Event to event handler #%d\n",
7496 + ioc->name, cb_idx));
7497 r += (*(MptEvHandlers[cb_idx]))(ioc, pEventReply);
7498 handlers++;
7499 }
7500 }
7501 - /* FIXME? Examine results here? */
7502
7503 /*
7504 * If needed, send (a single) EventAck.
7505 @@ -7762,6 +7880,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 lo
7506 ioc->name, log_info, desc, (log_info & 0xFFFFFF));
7507 }
7508
7509 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7510 /**
7511 * mpt_spi_log_info - Log information returned from SCSI Parallel IOC.
7512 * @ioc: Pointer to MPT_ADAPTER structure
7513 @@ -7769,7 +7888,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 lo
7514 * @log_info: U32 LogInfo word from the IOC
7515 *
7516 * Refer to lsi/sp_log.h.
7517 - **/
7518 + */
7519 static void
7520 mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
7521 {
7522 @@ -8353,7 +8472,8 @@ mpt_iocstatus_info(MPT_ADAPTER *ioc, u32
7523 if (!desc)
7524 return;
7525
7526 - dreplyprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IOCStatus(0x%04X): %s\n", ioc->name, status, desc));
7527 + dreplyprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7528 + "IOCStatus(0x%04X): %s\n", ioc->name, status, desc));
7529 }
7530
7531 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7532 @@ -8364,7 +8484,6 @@ EXPORT_SYMBOL(mpt_resume);
7533 EXPORT_SYMBOL(mpt_suspend);
7534 #endif
7535 EXPORT_SYMBOL(ioc_list);
7536 -EXPORT_SYMBOL(mpt_proc_root_dir);
7537 EXPORT_SYMBOL(mpt_register);
7538 EXPORT_SYMBOL(mpt_deregister);
7539 EXPORT_SYMBOL(mpt_event_register);
7540 @@ -8395,11 +8514,12 @@ EXPORT_SYMBOL(mpt_set_taskmgmt_in_progre
7541 EXPORT_SYMBOL(mpt_clear_taskmgmt_in_progress_flag);
7542 EXPORT_SYMBOL(mpt_halt_firmware);
7543
7544 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7545 /**
7546 * fusion_init - Fusion MPT base driver initialization routine.
7547 *
7548 * Returns 0 for success, non-zero for failure.
7549 - **/
7550 + */
7551 static int __init
7552 fusion_init(void)
7553 {
7554 @@ -8430,12 +8550,13 @@ fusion_init(void)
7555 return 0;
7556 }
7557
7558 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7559 /**
7560 * fusion_exit - Perform driver unload cleanup.
7561 *
7562 * This routine frees all resources associated with each MPT adapter
7563 * and removes all %MPT_PROCFS_MPTBASEDIR entries.
7564 - **/
7565 + */
7566 static void __exit
7567 fusion_exit(void)
7568 {
7569 --- a/drivers/message/fusion/mptbase.h
7570 +++ b/drivers/message/fusion/mptbase.h
7571 @@ -72,8 +72,8 @@
7572 #define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR
7573 #endif
7574
7575 -#define MPT_LINUX_VERSION_COMMON "4.00.43.00"
7576 -#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-4.00.43.00"
7577 +#define MPT_LINUX_VERSION_COMMON "4.00.43.00suse"
7578 +#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-4.00.43.00suse"
7579 #define WHAT_MAGIC_STRING "@" "(" "#" ")"
7580 #define MPT_LINUX_MAJOR_VERSION 4
7581 #define MPT_LINUX_MINOR_VERSION 00
7582 @@ -177,10 +177,10 @@
7583 #define MPT_SCSI_SG_DEPTH 40
7584 #endif
7585
7586 -#ifdef CONFIG_FUSION_MAX_FC_SGE
7587 -#if CONFIG_FUSION_MAX_FC_SGE < 16
7588 +#ifdef CONFIG_FUSION_MAX_FC_SGE
7589 +#if CONFIG_FUSION_MAX_FC_SGE < 16
7590 #define MPT_SCSI_FC_SG_DEPTH 16
7591 -#elif CONFIG_FUSION_MAX_FC_SGE > 256
7592 +#elif CONFIG_FUSION_MAX_FC_SGE > 256
7593 #define MPT_SCSI_FC_SG_DEPTH 256
7594 #else
7595 #define MPT_SCSI_FC_SG_DEPTH CONFIG_FUSION_MAX_FC_SGE
7596 @@ -444,10 +444,10 @@ do { \
7597 #define MPT_MGMT_STATUS_RF_VALID 0x01 /* The Reply Frame is VALID */
7598 #define MPT_MGMT_STATUS_COMMAND_GOOD 0x02 /* Command Status GOOD */
7599 #define MPT_MGMT_STATUS_PENDING 0x04 /* command is pending */
7600 -#define MPT_MGMT_STATUS_DID_IOCRESET 0x08 /* IOC Reset occurred on the current*/
7601 +#define MPT_MGMT_STATUS_DID_IOCRESET 0x08 /* IOC Reset occurred */
7602 #define MPT_MGMT_STATUS_SENSE_VALID 0x10 /* valid sense info */
7603 #define MPT_MGMT_STATUS_TIMER_ACTIVE 0x20 /* obsolete */
7604 -#define MPT_MGMT_STATUS_FREE_MF 0x40 /* free the mf from complete routine */
7605 +#define MPT_MGMT_STATUS_FREE_MF 0x40 /* free the mf */
7606
7607
7608 #define INITIALIZE_MGMT_STATUS(status) \
7609 @@ -467,7 +467,7 @@ typedef struct _MPT_MGMT {
7610 u8 status; /* current command status */
7611 int completion_code;
7612 u32 msg_context;
7613 -}MPT_MGMT;
7614 +} MPT_MGMT;
7615
7616 /*
7617 * Event Structure and define
7618 @@ -540,7 +540,7 @@ typedef struct _RaidCfgData {
7619 IOCPage2_t *pIocPg2; /* table of Raid Volumes */
7620 IOCPage3_t *pIocPg3; /* table of physical disks */
7621 IOCPage6_t *pIocPg6; /* table of IR static data */
7622 - struct semaphore inactive_list_mutex;
7623 + struct mutex inactive_list_mutex;
7624 struct list_head inactive_list; /* link list for physical
7625 disk that belong in
7626 inactive volumes */
7627 @@ -571,7 +571,8 @@ struct mptfc_rport_info
7628 };
7629
7630 typedef void (*MPT_ADD_SGE)(char *pAddr, u32 flagslength, dma_addr_t dma_addr);
7631 -typedef void (*MPT_ADD_CHAIN)(char *pAddr, u8 next, u16 length, dma_addr_t dma_addr);
7632 +typedef void (*MPT_ADD_CHAIN)
7633 + (char *pAddr, u8 next, u16 length, dma_addr_t dma_addr);
7634
7635 /*
7636 * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS
7637 @@ -583,7 +584,8 @@ typedef struct _MPT_ADAPTER
7638 char name[MPT_NAME_LENGTH]; /* "iocN" */
7639 char prod_name[MPT_NAME_LENGTH]; /* "LSIFC9x9" */
7640 #ifdef CONFIG_FUSION_LOGGING
7641 - char evStr[EVENT_DESCR_STR_SZ]; /* used in mpt_display_event_info */
7642 + /* used in mpt_display_event_info */
7643 + char evStr[EVENT_DESCR_STR_SZ];
7644 #endif
7645 char board_name[16];
7646 char board_assembly[16];
7647 @@ -597,7 +599,8 @@ typedef struct _MPT_ADAPTER
7648 SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */
7649 u8 bus_type;
7650 unsigned long mem_phys; /* == f4020000 (mmap) */
7651 - unsigned long pio_mem_phys; /* Programmed IO (downloadboot) */
7652 + /* Programmed IO (downloadboot) */
7653 + unsigned long pio_mem_phys;
7654 int mem_size; /* mmap memory size */
7655 int number_of_buses;
7656 int devices_per_bus;
7657 @@ -612,8 +615,10 @@ typedef struct _MPT_ADAPTER
7658 int reply_depth; /* Num Allocated reply frames */
7659 int reply_sz; /* Reply frame size */
7660 int num_chain; /* Number of chain buffers */
7661 - MPT_ADD_SGE add_sge; /* Pointer to add_sge function */
7662 - MPT_ADD_CHAIN add_chain; /* Pointer to add_chain function */
7663 + /* Pointer to add_sge function */
7664 + MPT_ADD_SGE add_sge;
7665 + /* Pointer to add_chain function */
7666 + MPT_ADD_CHAIN add_chain;
7667 /* Pool of buffers for chaining. ReqToChain
7668 * and ChainToChain track index of chain buffers.
7669 * ChainBuffer (DMA) virt/phys addresses.
7670 @@ -646,7 +651,8 @@ typedef struct _MPT_ADAPTER
7671 dma_addr_t HostPageBuffer_dma;
7672 int mtrr_reg;
7673 struct pci_dev *pcidev; /* struct pci_dev pointer */
7674 - int bars; /* bitmask of BAR's that must be configured */
7675 + /* bitmask of BAR's that must be configured */
7676 + int bars;
7677 int msi_enable;
7678 u8 __iomem *memmap; /* mmap address */
7679 struct Scsi_Host *sh; /* Scsi Host pointer */
7680 @@ -680,7 +686,8 @@ typedef struct _MPT_ADAPTER
7681 #if defined(CPQ_CIM)
7682 u32 csmi_change_count; /* count to track all IR
7683 events for CSMI */
7684 - u8 pci_slot_number; /* ioc page 1 - pci slot number */
7685 + /* ioc page 1 - pci slot number */
7686 + u8 pci_slot_number;
7687 #endif
7688
7689 u8 ir_firmware; /* =1 if IR firmware detected */
7690 @@ -711,11 +718,12 @@ typedef struct _MPT_ADAPTER
7691 u8 fw_events_off; /* if '1', then ignore events */
7692 char fw_event_q_name[20];
7693
7694 - struct mptsas_portinfo *hba_port_info; /* port_info object for the host */
7695 + /* port_info object for the host */
7696 + struct mptsas_portinfo *hba_port_info;
7697 u64 hba_port_sas_addr;
7698 u16 hba_port_num_phy;
7699 struct list_head sas_device_info_list;
7700 - struct semaphore sas_device_info_mutex;
7701 + struct mutex sas_device_info_mutex;
7702 u8 old_sas_discovery_protocal;
7703 u8 sas_discovery_quiesce_io;
7704 int sas_index; /* index refrencing */
7705 @@ -735,6 +743,7 @@ typedef struct _MPT_ADAPTER
7706 char reset_work_q_name[20];
7707 struct workqueue_struct *reset_work_q;
7708 struct delayed_work fault_reset_work;
7709 + spinlock_t fault_reset_work_lock;
7710 struct work_struct fc_setup_reset_work;
7711 struct list_head fc_rports;
7712 struct work_struct fc_lsc_work;
7713 @@ -743,9 +752,12 @@ typedef struct _MPT_ADAPTER
7714 struct work_struct fc_rescan_work;
7715 char fc_rescan_work_q_name[20];
7716 struct workqueue_struct *fc_rescan_work_q;
7717 - unsigned long hard_resets; /* driver forced bus resets count */
7718 - unsigned long soft_resets; /* fw/external bus resets count */
7719 - unsigned long timeouts; /* cmd timeouts */
7720 + /* driver forced bus resets count */
7721 + unsigned long hard_resets;
7722 + /* fw/external bus resets count */
7723 + unsigned long soft_resets;
7724 + /* cmd timeouts */
7725 + unsigned long timeouts;
7726 struct scsi_cmnd **ScsiLookup;
7727 spinlock_t scsi_lookup_lock;
7728 int sdev_queue_depth; /* sdev queue depth */
7729 @@ -907,10 +919,14 @@ extern int mpt_config(MPT_ADAPTER *ioc,
7730 extern int mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size);
7731 extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
7732 extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
7733 -extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
7734 -extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk);
7735 -extern int mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage1_t phys_disk);
7736 -extern int mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc, u8 phys_disk_num);
7737 +extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc,
7738 + u8 persist_opcode);
7739 +extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num,
7740 + pRaidPhysDiskPage0_t phys_disk);
7741 +extern int mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num,
7742 + pRaidPhysDiskPage1_t phys_disk);
7743 +extern int mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc,
7744 + u8 phys_disk_num);
7745
7746 extern int mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc);
7747 extern void mpt_clear_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc);
7748 @@ -920,7 +936,6 @@ extern void mpt_halt_firmware(MPT_ADAPT
7749 * Public data decl's...
7750 */
7751 extern struct list_head ioc_list;
7752 -extern struct proc_dir_entry *mpt_proc_root_dir;
7753 extern int mpt_debug_level;
7754 extern int mpt_fwfault_debug;
7755
7756 --- a/drivers/message/fusion/mptctl.c
7757 +++ b/drivers/message/fusion/mptctl.c
7758 @@ -75,7 +75,7 @@
7759 #if defined(CPQ_CIM)
7760 #include "mptsas.h"
7761 #include "csmi/csmisas.h"
7762 -#endif // CPQ_CIM
7763 +#endif
7764
7765 #if defined(DIAG_BUFFER_SUPPORT)
7766 #include "rejected_ioctls/diag_buffer.h"
7767 @@ -148,7 +148,7 @@ static int csmisas_task_managment(unsign
7768 static int csmisas_phy_control(unsigned long arg);
7769 static int csmisas_get_connector_info(unsigned long arg);
7770 static int csmisas_get_location(unsigned long arg);
7771 -#endif // CPQ_CIM
7772 +#endif
7773
7774 #if defined(DIAG_BUFFER_SUPPORT)
7775 /* diag_buffer proto's */
7776 @@ -157,7 +157,7 @@ static int mptctl_release_diag_buffer(un
7777 static int mptctl_unregister_diag_buffer(unsigned long arg);
7778 static int mptctl_query_diag_buffer(unsigned long arg);
7779 static int mptctl_read_diag_buffer(unsigned long arg);
7780 -#endif // DIAG_BUFFER_SUPPORT
7781 +#endif
7782
7783 static int mptctl_probe(struct pci_dev *, const struct pci_device_id *);
7784 static void mptctl_remove(struct pci_dev *);
7785 @@ -279,7 +279,8 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME
7786 le32_to_cpu(reply->u.reply.IOCLogInfo)));
7787
7788 if ((req->u.hdr.Function == MPI_FUNCTION_SCSI_IO_REQUEST) ||
7789 - (req->u.hdr.Function == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
7790 + (req->u.hdr.Function
7791 + == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
7792
7793 if (reply->u.sreply.SCSIStatus || reply->u.sreply.SCSIState)
7794 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7795 @@ -290,7 +291,8 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME
7796 le16_to_cpu(reply->u.sreply.TaskTag),
7797 le32_to_cpu(reply->u.sreply.TransferCount)));
7798
7799 - if (reply->u.sreply.SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
7800 + if (reply->u.sreply.SCSIState
7801 + & MPI_SCSI_STATE_AUTOSENSE_VALID) {
7802 sz = req->u.scsireq.SenseBufferLength;
7803 req_index =
7804 le16_to_cpu(req->u.frame.hwhdr.msgctxu.fld.req_idx);
7805 @@ -324,7 +326,8 @@ mptctl_taskmgmt_reply(MPT_ADAPTER *ioc,
7806 if (!mf)
7807 return 0;
7808
7809 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed (mf=%p, mr=%p)\n",
7810 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7811 + "TaskMgmt completed (mf=%p, mr=%p)\n",
7812 ioc->name, mf, mr));
7813
7814 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
7815 @@ -365,8 +368,8 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7816 /* bus reset is only good for SCSI IO, RAID PASSTHRU */
7817 if (!(function == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) ||
7818 (function == MPI_FUNCTION_SCSI_IO_REQUEST)) {
7819 - dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt, not SCSI_IO!!\n",
7820 - ioc->name));
7821 + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
7822 + "TaskMgmt, not SCSI_IO!!\n", ioc->name));
7823 return -EPERM;
7824 }
7825
7826 @@ -381,8 +384,8 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7827 /* Send request
7828 */
7829 if ((mf = mpt_get_msg_frame(mptctl_taskmgmt_id, ioc)) == NULL) {
7830 - dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt, no msg frames!!\n",
7831 - ioc->name));
7832 + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
7833 + "TaskMgmt, no msg frames!!\n", ioc->name));
7834 mpt_clear_taskmgmt_in_progress_flag(ioc);
7835 retval = -ENOMEM;
7836 goto mptctl_bus_reset_done;
7837 @@ -408,20 +411,21 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7838 pScsiTm->Reserved2[ii] = 0;
7839
7840 switch (ioc->bus_type) {
7841 - case FC:
7842 - timeout = 40;
7843 - break;
7844 - case SAS:
7845 - timeout = 30;
7846 - break;
7847 - case SPI:
7848 - default:
7849 - timeout = 2;
7850 - break;
7851 + case FC:
7852 + timeout = 40;
7853 + break;
7854 + case SAS:
7855 + timeout = 30;
7856 + break;
7857 + case SPI:
7858 + default:
7859 + timeout = 10;
7860 + break;
7861 }
7862
7863 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt type=%d timeout=%ld\n",
7864 - ioc->name, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
7865 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7866 + "TaskMgmt type=%d timeout=%ld\n", ioc->name,
7867 + MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
7868
7869 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
7870 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status)
7871 @@ -431,9 +435,10 @@ mptctl_bus_reset(MPT_ADAPTER *ioc, u8 fu
7872 mpt_put_msg_frame_hi_pri(mptctl_taskmgmt_id, ioc, mf);
7873 else {
7874 retval = mpt_send_handshake_request(mptctl_taskmgmt_id, ioc,
7875 - sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
7876 + sizeof(SCSITaskMgmt_t), (u32 *)pScsiTm, CAN_SLEEP);
7877 if (retval != 0) {
7878 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt send_handshake FAILED!"
7879 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
7880 + "TaskMgmt send_handshake FAILED!"
7881 " (ioc %p, mf %p, rc=%d) \n", ioc->name,
7882 ioc, mf, retval));
7883 mpt_clear_taskmgmt_in_progress_flag(ioc);
7884 @@ -498,11 +503,10 @@ mptctl_timeout_expired(MPT_ADAPTER *ioc,
7885 unsigned long flags;
7886
7887 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": %s\n",
7888 - ioc->name, __FUNCTION__));
7889 + ioc->name, __func__));
7890
7891 - if(mpt_fwfault_debug)
7892 + if (mpt_fwfault_debug)
7893 mpt_halt_firmware(ioc);
7894 -
7895 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
7896 if (ioc->ioc_reset_in_progress) {
7897 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7898 @@ -540,15 +544,15 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int r
7899 switch(reset_phase) {
7900 case MPT_IOC_SETUP_RESET:
7901 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7902 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
7903 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
7904 break;
7905 case MPT_IOC_PRE_RESET:
7906 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7907 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
7908 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
7909 break;
7910 case MPT_IOC_POST_RESET:
7911 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
7912 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
7913 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
7914 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_PENDING) {
7915 ioc->ioctl_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
7916 complete(&ioc->ioctl_cmds.done);
7917 @@ -571,13 +575,11 @@ mptctl_event_process(MPT_ADAPTER *ioc, E
7918 event = le32_to_cpu(pEvReply->Event) & 0xFF;
7919
7920 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s() called\n",
7921 - ioc->name, __FUNCTION__));
7922 + ioc->name, __func__));
7923 if(async_queue == NULL)
7924 return 1;
7925
7926 /* Raise SIGIO for persistent events.
7927 - * TODO - this define is not in MPI spec yet,
7928 - * but they plan to set it to 0x21
7929 */
7930 if (event == 0x21 ) {
7931 ioc->aen_event_read_flag=1;
7932 @@ -660,8 +662,9 @@ __mptctl_ioctl(struct file *file, unsign
7933 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
7934 (iocp == NULL)) {
7935 if (mpt_debug_level & MPT_DEBUG_IOCTL)
7936 - printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
7937 - __FILE__, __LINE__, iocnumX);
7938 + printk(KERN_DEBUG MYNAM
7939 + "%s::%s @%d - ioc%d not found!\n",
7940 + __FILE__, __func__, __LINE__, iocnumX);
7941 return -ENODEV;
7942 }
7943
7944 @@ -700,9 +703,9 @@ __mptctl_ioctl(struct file *file, unsign
7945 return csmisas_get_cntlr_status(arg);
7946 } else if (cmd == CC_CSMI_SAS_GET_SCSI_ADDRESS) {
7947 return csmisas_get_scsi_address(arg);
7948 - } else if (cmd == CC_CSMI_SAS_GET_DEVICE_ADDRESS){
7949 + } else if (cmd == CC_CSMI_SAS_GET_DEVICE_ADDRESS) {
7950 return csmisas_get_device_address(arg);
7951 -#endif // CPQ_CIM
7952 +#endif
7953 }
7954
7955 /* All of these commands require an interrupt or
7956 @@ -711,8 +714,6 @@ __mptctl_ioctl(struct file *file, unsign
7957 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
7958 return ret;
7959
7960 -// dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT ": mptctl_ioctl()\n", iocp->name));
7961 -
7962 if (cmd == MPTFWDOWNLOAD)
7963 ret = mptctl_fw_download(arg);
7964 else if (cmd == MPTCOMMAND)
7965 @@ -763,7 +764,7 @@ __mptctl_ioctl(struct file *file, unsign
7966 ret = csmisas_get_connector_info(arg);
7967 else if (cmd == CC_CSMI_SAS_GET_LOCATION)
7968 ret = csmisas_get_location(arg);
7969 -#endif // CPQ_CIM
7970 +#endif
7971
7972 #if defined(DIAG_BUFFER_SUPPORT)
7973 /* diag_buffer requiring fw calls*/
7974 @@ -773,7 +774,7 @@ __mptctl_ioctl(struct file *file, unsign
7975 ret = mptctl_release_diag_buffer(arg);
7976 else if (cmd == MPTDIAGREADBUFFER)
7977 ret = mptctl_read_diag_buffer(arg);
7978 -#endif // DIAG_BUFFER_SUPPORT
7979 +#endif
7980 else
7981 ret = -EINVAL;
7982
7983 @@ -807,8 +808,9 @@ static int mptctl_do_reset(unsigned long
7984
7985 if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
7986 if (mpt_debug_level & MPT_DEBUG_IOCTL)
7987 - printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
7988 - __FILE__, __LINE__, krinfo.hdr.iocnum);
7989 + printk(KERN_DEBUG MYNAM
7990 + "%s@%d::%s - ioc%d not found!\n",
7991 + __FILE__, __LINE__, __func__, krinfo.hdr.iocnum);
7992 return -ENODEV; /* (-6) No such device or address */
7993 }
7994
7995 @@ -898,7 +900,8 @@ mptctl_do_fw_download(int ioc, char __us
7996
7997 if (mpt_verify_adapter(ioc, &iocp) < 0) {
7998 if (mpt_debug_level & MPT_DEBUG_IOCTL)
7999 - printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", ioc);
8000 + printk(KERN_DEBUG MYNAM
8001 + "ioctl_fwdl - ioc%d not found!\n", ioc);
8002 return -ENODEV; /* (-6) No such device or address */
8003 } else {
8004
8005 @@ -1036,7 +1039,7 @@ mptctl_do_fw_download(int ioc, char __us
8006 timeleft = wait_for_completion_timeout(&iocp->ioctl_cmds.done, HZ*60);
8007 if (!(iocp->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
8008 ret = -ETIME;
8009 - printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __FUNCTION__);
8010 + printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __func__);
8011 if (iocp->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
8012 mpt_free_msg_frame(iocp, mf);
8013 goto fwdl_out;
8014 @@ -1047,7 +1050,7 @@ mptctl_do_fw_download(int ioc, char __us
8015 }
8016
8017 if (!(iocp->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID)) {
8018 - printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __FUNCTION__);
8019 + printk(MYIOC_s_WARN_FMT "%s: failed\n", iocp->name, __func__);
8020 mpt_free_msg_frame(iocp, mf);
8021 ret = -ENODATA;
8022 goto fwdl_out;
8023 @@ -1059,10 +1062,12 @@ mptctl_do_fw_download(int ioc, char __us
8024 ReplyMsg = (pFWDownloadReply_t)iocp->ioctl_cmds.reply;
8025 iocstat = le16_to_cpu(ReplyMsg->IOCStatus) & MPI_IOCSTATUS_MASK;
8026 if (iocstat == MPI_IOCSTATUS_SUCCESS) {
8027 - printk(MYIOC_s_INFO_FMT ": F/W update successfully sent!\n", iocp->name);
8028 + printk(MYIOC_s_INFO_FMT
8029 + ": F/W update successfully sent!\n", iocp->name);
8030 return 0;
8031 } else if (iocstat == MPI_IOCSTATUS_INVALID_FUNCTION) {
8032 - printk(MYIOC_s_WARN_FMT "Hmmm... doesn't support F/W download?\n",
8033 + printk(MYIOC_s_WARN_FMT
8034 + "Hmmm... doesn't support F/W download?\n",
8035 iocp->name);
8036 printk(MYIOC_s_WARN_FMT "(time to go bang on somebodies door)\n",
8037 iocp->name);
8038 @@ -1177,7 +1182,8 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, i
8039 bytes_allocd += this_alloc;
8040 sgl->FlagsLength = (0x10000000|sgdir|this_alloc);
8041 if (ioc->sg_addr_size == sizeof(u64))
8042 - sgl->FlagsLength |= MPT_SGE_FLAGS_64_BIT_ADDRESSING;
8043 + sgl->FlagsLength
8044 + |= MPT_SGE_FLAGS_64_BIT_ADDRESSING;
8045 dma_addr = pci_map_single(ioc->pcidev, buflist[buflist_ent].kptr, this_alloc, dir);
8046 sgl->Address = dma_addr;
8047
8048 @@ -1362,8 +1368,9 @@ mptctl_getiocinfo (unsigned long arg, un
8049 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
8050 (ioc == NULL)) {
8051 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8052 - printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
8053 - __FILE__, __LINE__, iocnum);
8054 + printk(KERN_DEBUG MYNAM
8055 + "%s::%s @%d - ioc%d not found!\n",
8056 + __FILE__, __func__, __LINE__, iocnum);
8057 kfree(karg);
8058 return -ENODEV;
8059 }
8060 @@ -1498,8 +1505,9 @@ mptctl_gettargetinfo (unsigned long arg)
8061 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8062 (ioc == NULL)) {
8063 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8064 - printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
8065 - __FILE__, __LINE__, iocnum);
8066 + printk(KERN_DEBUG MYNAM
8067 + "%s::%s @%d - ioc%d not found!\n",
8068 + __FILE__, __func__, __LINE__, iocnum);
8069 return -ENODEV;
8070 }
8071
8072 @@ -1514,7 +1522,8 @@ mptctl_gettargetinfo (unsigned long arg)
8073 port = karg.hdr.port;
8074
8075 if (maxWordsLeft <= 0) {
8076 - printk(MYIOC_s_ERR_FMT "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8077 + printk(MYIOC_s_ERR_FMT
8078 + "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8079 ioc->name, __FILE__, __LINE__);
8080 return -ENOMEM;
8081 }
8082 @@ -1535,7 +1544,8 @@ mptctl_gettargetinfo (unsigned long arg)
8083 */
8084 pmem = kzalloc(numBytes, GFP_KERNEL);
8085 if (!pmem) {
8086 - printk(MYIOC_s_ERR_FMT "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8087 + printk(MYIOC_s_ERR_FMT
8088 + "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
8089 ioc->name, __FILE__, __LINE__);
8090 return -ENOMEM;
8091 }
8092 @@ -1615,8 +1625,9 @@ mptctl_readtest (unsigned long arg)
8093 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8094 (ioc == NULL)) {
8095 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8096 - printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n",
8097 - __FILE__, __LINE__, iocnum);
8098 + printk(KERN_DEBUG MYNAM
8099 + "%s::%s @%d - ioc%d not found!\n",
8100 + __FILE__, __func__, __LINE__, iocnum);
8101 return -ENODEV;
8102 }
8103
8104 @@ -1677,8 +1688,9 @@ mptctl_eventquery (unsigned long arg)
8105 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8106 (ioc == NULL)) {
8107 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8108 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
8109 - __FILE__, __LINE__, iocnum);
8110 + printk(KERN_DEBUG MYNAM
8111 + "%s::%s @%d - ioc%d not found!\n",
8112 + __FILE__, __func__, __LINE__, iocnum);
8113 return -ENODEV;
8114 }
8115
8116 @@ -1717,8 +1729,9 @@ mptctl_eventenable (unsigned long arg)
8117 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8118 (ioc == NULL)) {
8119 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8120 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
8121 - __FILE__, __LINE__, iocnum);
8122 + printk(KERN_DEBUG MYNAM
8123 + "%s::%s @%d - ioc%d not found!\n",
8124 + __FILE__, __func__, __LINE__, iocnum);
8125 return -ENODEV;
8126 }
8127
8128 @@ -1730,7 +1743,8 @@ mptctl_eventenable (unsigned long arg)
8129 int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS);
8130 ioc->events = kzalloc(sz, GFP_KERNEL);
8131 if (!ioc->events) {
8132 - printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
8133 + printk(MYIOC_s_ERR_FMT
8134 + "Insufficient memory to add adapter!\n",
8135 ioc->name);
8136 return -ENOMEM;
8137 }
8138 @@ -1766,8 +1780,9 @@ mptctl_eventreport (unsigned long arg)
8139 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8140 (ioc == NULL)) {
8141 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8142 - printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
8143 - __FILE__, __LINE__, iocnum);
8144 + printk(KERN_DEBUG MYNAM
8145 + "%s::%s @%d - ioc%d not found!\n",
8146 + __FILE__, __func__, __LINE__, iocnum);
8147 return -ENODEV;
8148 }
8149
8150 @@ -1821,8 +1836,9 @@ mptctl_replace_fw (unsigned long arg)
8151 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8152 (ioc == NULL)) {
8153 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8154 - printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
8155 - __FILE__, __LINE__, iocnum);
8156 + printk(KERN_DEBUG MYNAM
8157 + "%s::%s @%d - ioc%d not found!\n",
8158 + __FILE__, __func__, __LINE__, iocnum);
8159 return -ENODEV;
8160 }
8161
8162 @@ -1870,7 +1886,8 @@ mptctl_replace_fw (unsigned long arg)
8163 *
8164 * Outputs: None.
8165 * Return: 0 if successful
8166 - * -EBUSY if previous command timout and IOC reset is not complete.
8167 + * -EBUSY if previous command timout and IOC reset is
8168 + * not complete.
8169 * -EFAULT if data unavailable
8170 * -ENODEV if no such device/adapter
8171 * -ETIME if timer expires
8172 @@ -1896,8 +1913,9 @@ mptctl_mpt_command (unsigned long arg)
8173 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8174 (ioc == NULL)) {
8175 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8176 - printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
8177 - __FILE__, __LINE__, iocnum);
8178 + printk(KERN_DEBUG MYNAM
8179 + "%s::%s @%d - ioc%d not found!\n",
8180 + __FILE__, __func__, __LINE__, iocnum);
8181 return -ENODEV;
8182 }
8183
8184 @@ -1911,7 +1929,8 @@ mptctl_mpt_command (unsigned long arg)
8185 *
8186 * Outputs: None.
8187 * Return: 0 if successful
8188 - * -EBUSY if previous command timout and IOC reset is not complete.
8189 + * -EBUSY if previous command timout and IOC reset is
8190 + * not complete.
8191 * -EFAULT if data unavailable
8192 * -ENODEV if no such device/adapter
8193 * -ETIME if timer expires
8194 @@ -1948,8 +1967,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8195 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8196 (ioc == NULL)) {
8197 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8198 - printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
8199 - __FILE__, __LINE__, iocnum);
8200 + printk(KERN_DEBUG MYNAM
8201 + "%s::%s @%d - ioc%d not found!\n",
8202 + __FILE__, __func__, __LINE__, iocnum);
8203 return -ENODEV;
8204 }
8205
8206 @@ -2194,10 +2214,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8207 {
8208 SCSITaskMgmt_t *pScsiTm;
8209 pScsiTm = (SCSITaskMgmt_t *)mf;
8210 - dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tTaskType=0x%x MsgFlags=0x%x "
8211 - "TaskMsgContext=0x%x id=%d channel=%d\n", ioc->name, pScsiTm->TaskType,
8212 - le32_to_cpu(pScsiTm->TaskMsgContext), pScsiTm->MsgFlags,
8213 - pScsiTm->TargetID, pScsiTm->Bus));
8214 + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8215 + "\tTaskType=0x%x MsgFlags=0x%x "
8216 + "TaskMsgContext=0x%x id=%d channel=%d\n",
8217 + ioc->name, pScsiTm->TaskType,
8218 + le32_to_cpu(pScsiTm->TaskMsgContext),
8219 + pScsiTm->MsgFlags, pScsiTm->TargetID, pScsiTm->Bus));
8220 break;
8221 }
8222
8223 @@ -2286,9 +2308,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8224 /* Set up the dataOut memory allocation */
8225 if (karg.dataOutSize > 0) {
8226 if (karg.dataInSize > 0) {
8227 - flagsLength = ( MPI_SGE_FLAGS_SIMPLE_ELEMENT |
8228 + flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
8229 MPI_SGE_FLAGS_END_OF_BUFFER |
8230 - MPI_SGE_FLAGS_DIRECTION )
8231 + MPI_SGE_FLAGS_DIRECTION)
8232 << MPI_SGE_FLAGS_SHIFT;
8233 } else {
8234 flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE;
8235 @@ -2365,7 +2387,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8236 mpt_put_msg_frame_hi_pri(mptctl_id, ioc, mf);
8237 else {
8238 rc = mpt_send_handshake_request(mptctl_id, ioc,
8239 - sizeof(SCSITaskMgmt_t), (u32*)mf, CAN_SLEEP);
8240 + sizeof(SCSITaskMgmt_t), (u32 *)mf, CAN_SLEEP);
8241 if (rc != 0) {
8242 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
8243 "send_handshake FAILED! (ioc %p, mf %p)\n",
8244 @@ -2381,16 +2403,16 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8245
8246 /* Now wait for the command to complete */
8247 timeout = (karg.timeout > 0) ? karg.timeout : MPT_IOCTL_DEFAULT_TIMEOUT;
8248 - timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*timeout);
8249 + timeleft =
8250 + wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*timeout);
8251 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
8252 rc = -ETIME;
8253 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "%s: TIMED OUT!\n",
8254 - ioc->name, __FUNCTION__));
8255 + ioc->name, __func__));
8256 if (function == MPI_FUNCTION_SCSI_TASK_MGMT)
8257 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
8258 - if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
8259 + if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
8260 goto done_free_mem;
8261 - }
8262 if (!timeleft) {
8263 mptctl_timeout_expired(ioc, mf);
8264 mf = NULL;
8265 @@ -2408,7 +2430,8 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8266 */
8267 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) {
8268 if (karg.maxReplyBytes < ioc->reply_sz) {
8269 - sz = min(karg.maxReplyBytes, 4*ioc->ioctl_cmds.reply[2]);
8270 + sz = min(karg.maxReplyBytes,
8271 + 4*ioc->ioctl_cmds.reply[2]);
8272 } else {
8273 sz = min(ioc->reply_sz, 4*ioc->ioctl_cmds.reply[2]);
8274 }
8275 @@ -2430,7 +2453,8 @@ mptctl_do_mpt_command (struct mpt_ioctl_
8276 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_SENSE_VALID) {
8277 sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
8278 if (sz > 0) {
8279 - if (copy_to_user(karg.senseDataPtr, ioc->ioctl_cmds.sense, sz)) {
8280 + if (copy_to_user(karg.senseDataPtr,
8281 + ioc->ioctl_cmds.sense, sz)) {
8282 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
8283 "Unable to write sense data to user %p\n",
8284 ioc->name, __FILE__, __LINE__,
8285 @@ -2488,7 +2512,8 @@ done_free_mem:
8286 * Outputs: None.
8287 * Return: 0 if successful
8288 * -EFAULT if data unavailable
8289 - * -EBUSY if previous command timout and IOC reset is not complete.
8290 + * -EBUSY if previous command timout and IOC reset is
8291 + * not complete.
8292 * -ENODEV if no such device/adapter
8293 * -ETIME if timer expires
8294 * -ENOMEM if memory allocation error
8295 @@ -2499,7 +2524,7 @@ mptctl_hp_hostinfo(unsigned long arg, un
8296 hp_host_info_t __user *uarg = (void __user *) arg;
8297 MPT_ADAPTER *ioc;
8298 struct pci_dev *pdev;
8299 - char *pbuf=NULL;
8300 + char *pbuf = NULL;
8301 dma_addr_t buf_dma;
8302 hp_host_info_t karg;
8303 int iocnum;
8304 @@ -2530,8 +2555,9 @@ mptctl_hp_hostinfo(unsigned long arg, un
8305 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8306 (ioc == NULL)) {
8307 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8308 - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
8309 - __FILE__, __LINE__, iocnum);
8310 + printk(KERN_DEBUG MYNAM
8311 + "%s::%s @%d - ioc%d not found!\n",
8312 + __FILE__, __func__, __LINE__, iocnum);
8313 return -ENODEV;
8314 }
8315
8316 @@ -2619,7 +2645,7 @@ mptctl_hp_hostinfo(unsigned long arg, un
8317 */
8318 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
8319 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
8320 - ioc->name,__FUNCTION__));
8321 + ioc->name,__func__));
8322 retval = -ENOMEM;
8323 goto out;
8324 }
8325 @@ -2644,16 +2670,19 @@ mptctl_hp_hostinfo(unsigned long arg, un
8326 retval = -ENOMEM;
8327 goto out;
8328 }
8329 - ioc->add_sge((char *)&IstwiRWRequest->SGL, (MPT_SGE_FLAGS_SSIMPLE_READ|4),buf_dma);
8330 + ioc->add_sge((char *)&IstwiRWRequest->SGL,
8331 + (MPT_SGE_FLAGS_SSIMPLE_READ|4), buf_dma);
8332
8333 retval = 0;
8334 - SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, IstwiRWRequest->MsgContext);
8335 + SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context,
8336 + IstwiRWRequest->MsgContext);
8337 INITIALIZE_MGMT_STATUS(ioc->ioctl_cmds.status)
8338 mpt_put_msg_frame(mptctl_id, ioc, mf);
8339 - timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done, HZ*MPT_IOCTL_DEFAULT_TIMEOUT);
8340 + timeleft = wait_for_completion_timeout(&ioc->ioctl_cmds.done,
8341 + HZ*MPT_IOCTL_DEFAULT_TIMEOUT);
8342 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
8343 retval = -ETIME;
8344 - printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name, __FUNCTION__);
8345 + printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name, __func__);
8346 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
8347 mpt_free_msg_frame(ioc, mf);
8348 goto out;
8349 @@ -2701,7 +2730,8 @@ mptctl_hp_hostinfo(unsigned long arg, un
8350 * Outputs: None.
8351 * Return: 0 if successful
8352 * -EFAULT if data unavailable
8353 - * -EBUSY if previous command timout and IOC reset is not complete.
8354 + * -EBUSY if previous command timout and IOC reset is
8355 + * not complete.
8356 * -ENODEV if no such device/adapter
8357 * -ETIME if timer expires
8358 * -ENOMEM if memory allocation error
8359 @@ -2732,12 +2762,14 @@ mptctl_hp_targetinfo(unsigned long arg)
8360 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
8361 (ioc == NULL)) {
8362 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8363 - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
8364 - __FILE__, __LINE__, iocnum);
8365 + printk(KERN_DEBUG MYNAM
8366 + "%s::%s @%d - ioc%d not found!\n",
8367 + __FILE__, __func__, __LINE__, iocnum);
8368 return -ENODEV;
8369 }
8370
8371 - dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_targetinfo called.\n",
8372 + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8373 + ": mptctl_hp_targetinfo called.\n",
8374 ioc->name));
8375 /* There is nothing to do for FCP parts.
8376 */
8377 @@ -2889,8 +2921,9 @@ compat_mptfwxfer_ioctl(struct file *filp
8378 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
8379 (iocp == NULL)) {
8380 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8381 - printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
8382 - __LINE__, iocnumX);
8383 + printk(KERN_DEBUG MYNAM
8384 + "::%s @%d - ioc%d not found!\n", __func__,
8385 + __LINE__, iocnumX);
8386 return -ENODEV;
8387 }
8388
8389 @@ -2930,8 +2963,9 @@ compat_mpt_command(struct file *filp, un
8390 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
8391 (iocp == NULL)) {
8392 if (mpt_debug_level & MPT_DEBUG_IOCTL)
8393 - printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
8394 - __LINE__, iocnumX);
8395 + printk(KERN_DEBUG MYNAM
8396 + "::%s @%d - ioc%d not found!\n",
8397 + __func__, __LINE__, iocnumX);
8398 return -ENODEV;
8399 }
8400
8401 @@ -3144,7 +3178,7 @@ static void mptctl_exit(void)
8402
8403 #if defined(CPQ_CIM)
8404 #include "csmi/csmisas.c"
8405 -#endif // CPQ_CIM
8406 +#endif
8407
8408 #if defined(DIAG_BUFFER_SUPPORT)
8409 #include "rejected_ioctls/diag_buffer.c"
8410 --- a/drivers/message/fusion/mptfc.c
8411 +++ b/drivers/message/fusion/mptfc.c
8412 @@ -270,28 +270,28 @@ static int
8413 mptfc_abort(struct scsi_cmnd *SCpnt)
8414 {
8415 return
8416 - mptfc_block_error_handler(SCpnt, mptscsih_abort, __FUNCTION__);
8417 + mptfc_block_error_handler(SCpnt, mptscsih_abort, __func__);
8418 }
8419
8420 static int
8421 mptfc_dev_reset(struct scsi_cmnd *SCpnt)
8422 {
8423 return
8424 - mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __FUNCTION__);
8425 + mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __func__);
8426 }
8427
8428 static int
8429 mptfc_bus_reset(struct scsi_cmnd *SCpnt)
8430 {
8431 return
8432 - mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __FUNCTION__);
8433 + mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __func__);
8434 }
8435
8436 static int
8437 mptfc_host_reset(struct scsi_cmnd *SCpnt)
8438 {
8439 return
8440 - mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __FUNCTION__);
8441 + mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __func__);
8442 }
8443
8444 static void
8445 @@ -553,7 +553,6 @@ mptfc_target_destroy(struct scsi_target
8446 struct fc_rport *rport;
8447 struct mptfc_rport_info *ri;
8448
8449 - printk("%s - starget=%p\n", __FUNCTION__, starget);
8450 rport = starget_to_rport(starget);
8451 if (rport) {
8452 ri = *((struct mptfc_rport_info **)rport->dd_data);
8453 @@ -994,7 +993,8 @@ mptfc_SetFcPortPage1_defaults(MPT_ADAPTE
8454 #define OFF_FLAGS (MPI_FCPORTPAGE1_FLAGS_VERBOSE_RESCAN_EVENTS)
8455
8456 for (ii=0; ii<ioc->facts.NumberOfPorts; ii++) {
8457 - if ((rc = mptfc_GetFcPortPage1(ioc, ii)) < 0)
8458 + rc = mptfc_GetFcPortPage1(ioc, ii);
8459 + if (rc < 0)
8460 return rc;
8461 pp1 = ioc->fc_data.fc_port_page1[ii].data;
8462 if ((pp1->InitiatorDeviceTimeout == MPTFC_FW_DEVICE_TIMEOUT)
8463 @@ -1006,7 +1006,8 @@ mptfc_SetFcPortPage1_defaults(MPT_ADAPTE
8464 pp1->InitiatorIoPendTimeout = MPTFC_FW_IO_PEND_TIMEOUT;
8465 pp1->Flags &= ~OFF_FLAGS;
8466 pp1->Flags |= ON_FLAGS;
8467 - if ((rc = mptfc_WriteFcPortPage1(ioc, ii)) < 0)
8468 + rc = mptfc_WriteFcPortPage1(ioc, ii);
8469 + if (rc < 0)
8470 return rc;
8471 }
8472 return 0;
8473 @@ -1170,8 +1171,9 @@ mptfc_rescan_devices(struct work_struct
8474 * if cannot set defaults, something's really wrong, bail out
8475 */
8476
8477 - if ((rc = mptfc_SetFcPortPage1_defaults(ioc)) < 0) {
8478 - dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
8479 + rc = mptfc_SetFcPortPage1_defaults(ioc);
8480 + if (rc < 0) {
8481 + dfcprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8482 "mptfc_rescan.%d: unable to set PP1 defaults, rc %d.\n",
8483 ioc->name, ioc->sh->host_no, rc));
8484 return;
8485 @@ -1373,8 +1375,9 @@ mptfc_probe(struct pci_dev *pdev, const
8486
8487 /* initialize workqueue */
8488
8489 - snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name), "mptfc_wq_%d",
8490 - sh->host_no);
8491 + snprintf(ioc->fc_rescan_work_q_name,
8492 + sizeof(ioc->fc_rescan_work_q_name), "mptfc_wq_%d",
8493 + sh->host_no);
8494 ioc->fc_rescan_work_q =
8495 create_singlethread_workqueue(ioc->fc_rescan_work_q_name);
8496 if (!ioc->fc_rescan_work_q)
8497 @@ -1462,10 +1465,10 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int re
8498 if ((ioc->bus_type != FC) || (!rc))
8499 return rc;
8500
8501 - switch(reset_phase) {
8502 + switch (reset_phase) {
8503 case MPT_IOC_SETUP_RESET:
8504 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8505 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
8506 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
8507 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
8508 if (ioc->fc_rescan_work_q) {
8509 queue_work(ioc->fc_rescan_work_q,
8510 @@ -1475,11 +1478,11 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int re
8511 break;
8512 case MPT_IOC_PRE_RESET:
8513 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8514 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
8515 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
8516 break;
8517 case MPT_IOC_POST_RESET:
8518 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8519 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
8520 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
8521 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
8522 if (ioc->fc_rescan_work_q) {
8523 queue_work(ioc->fc_rescan_work_q,
8524 @@ -1493,11 +1496,12 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int re
8525 return 1;
8526 }
8527
8528 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
8529 /**
8530 * mptfc_init - Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
8531 *
8532 * Returns 0 for success, non-zero for failure.
8533 - **/
8534 + */
8535 static int __init
8536 mptfc_init(void)
8537 {
8538 @@ -1529,11 +1533,12 @@ mptfc_init(void)
8539 return error;
8540 }
8541
8542 +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
8543 /**
8544 * mptfc_remove - Remove fc infrastructure for devices
8545 * @pdev: Pointer to pci_dev structure
8546 *
8547 - **/
8548 + */
8549 static void __devexit
8550 mptfc_remove(struct pci_dev *pdev)
8551 {
8552 @@ -1543,8 +1548,6 @@ mptfc_remove(struct pci_dev *pdev)
8553 unsigned long flags;
8554 int ii;
8555
8556 - printk("%s -pdev=%p\n", __FUNCTION__, pdev);
8557 -
8558 /* destroy workqueue */
8559 if ((work_q=ioc->fc_rescan_work_q)) {
8560 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
8561 --- a/drivers/message/fusion/mptlan.c
8562 +++ b/drivers/message/fusion/mptlan.c
8563 @@ -614,7 +614,7 @@ mpt_lan_send_turbo(struct net_device *de
8564
8565 dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
8566 IOC_AND_NETDEV_NAMES_s_s(dev),
8567 - __FUNCTION__, sent));
8568 + __func__, sent));
8569
8570 priv->SendCtl[ctx].skb = NULL;
8571 pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma,
8572 @@ -680,7 +680,7 @@ mpt_lan_send_reply(struct net_device *de
8573
8574 dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
8575 IOC_AND_NETDEV_NAMES_s_s(dev),
8576 - __FUNCTION__, sent));
8577 + __func__, sent));
8578
8579 priv->SendCtl[ctx].skb = NULL;
8580 pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma,
8581 @@ -719,7 +719,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, s
8582 u16 cur_naa = 0x1000;
8583
8584 dioprintk((KERN_INFO MYNAM ": %s called, skb_addr = %p\n",
8585 - __FUNCTION__, skb));
8586 + __func__, skb));
8587
8588 spin_lock_irqsave(&priv->txfidx_lock, flags);
8589 if (priv->mpt_txfidx_tail < 0) {
8590 @@ -727,7 +727,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, s
8591 spin_unlock_irqrestore(&priv->txfidx_lock, flags);
8592
8593 printk (KERN_ERR "%s: no tx context available: %u\n",
8594 - __FUNCTION__, priv->mpt_txfidx_tail);
8595 + __func__, priv->mpt_txfidx_tail);
8596 return 1;
8597 }
8598
8599 @@ -737,7 +737,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, s
8600 spin_unlock_irqrestore(&priv->txfidx_lock, flags);
8601
8602 printk (KERN_ERR "%s: Unable to alloc request frame\n",
8603 - __FUNCTION__);
8604 + __func__);
8605 return 1;
8606 }
8607
8608 @@ -1213,7 +1213,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8609
8610 dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, Start_buckets = %u, buckets_out = %u\n",
8611 IOC_AND_NETDEV_NAMES_s_s(dev),
8612 - __FUNCTION__, buckets, curr));
8613 + __func__, buckets, curr));
8614
8615 max = (mpt_dev->req_sz - MPT_LAN_RECEIVE_POST_REQUEST_SIZE) /
8616 (MPT_LAN_TRANSACTION32_SIZE + sizeof(SGESimple64_t));
8617 @@ -1222,9 +1222,9 @@ mpt_lan_post_receive_buckets(struct mpt_
8618 mf = mpt_get_msg_frame(LanCtx, mpt_dev);
8619 if (mf == NULL) {
8620 printk (KERN_ERR "%s: Unable to alloc request frame\n",
8621 - __FUNCTION__);
8622 + __func__);
8623 dioprintk((KERN_ERR "%s: %u buckets remaining\n",
8624 - __FUNCTION__, buckets));
8625 + __func__, buckets));
8626 goto out;
8627 }
8628 pRecvReq = (LANReceivePostRequest_t *) mf;
8629 @@ -1249,7 +1249,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8630 spin_lock_irqsave(&priv->rxfidx_lock, flags);
8631 if (priv->mpt_rxfidx_tail < 0) {
8632 printk (KERN_ERR "%s: Can't alloc context\n",
8633 - __FUNCTION__);
8634 + __func__);
8635 spin_unlock_irqrestore(&priv->rxfidx_lock,
8636 flags);
8637 break;
8638 @@ -1272,7 +1272,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8639 if (skb == NULL) {
8640 printk (KERN_WARNING
8641 MYNAM "/%s: Can't alloc skb\n",
8642 - __FUNCTION__);
8643 + __func__);
8644 priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
8645 spin_unlock_irqrestore(&priv->rxfidx_lock, flags);
8646 break;
8647 @@ -1310,7 +1310,7 @@ mpt_lan_post_receive_buckets(struct mpt_
8648
8649 if (pSimple == NULL) {
8650 /**/ printk (KERN_WARNING MYNAM "/%s: No buckets posted\n",
8651 -/**/ __FUNCTION__);
8652 +/**/ __func__);
8653 mpt_free_msg_frame(mpt_dev, mf);
8654 goto out;
8655 }
8656 @@ -1334,9 +1334,9 @@ mpt_lan_post_receive_buckets(struct mpt_
8657
8658 out:
8659 dioprintk((KERN_INFO MYNAM "/%s: End_buckets = %u, priv->buckets_out = %u\n",
8660 - __FUNCTION__, buckets, atomic_read(&priv->buckets_out)));
8661 + __func__, buckets, atomic_read(&priv->buckets_out)));
8662 dioprintk((KERN_INFO MYNAM "/%s: Posted %u buckets and received %u back\n",
8663 - __FUNCTION__, priv->total_posted, priv->total_received));
8664 + __func__, priv->total_posted, priv->total_received));
8665
8666 clear_bit(0, &priv->post_buckets_active);
8667 }
8668 --- a/drivers/message/fusion/mptsas.c
8669 +++ b/drivers/message/fusion/mptsas.c
8670 @@ -117,19 +117,23 @@ static u8 mptsasInternalCtx = MPT_MAX_PR
8671 static u8 mptsasMgmtCtx = MPT_MAX_PROTOCOL_DRIVERS;
8672 static u8 mptsasDeviceResetCtx = MPT_MAX_PROTOCOL_DRIVERS;
8673
8674 -static inline void mptsas_set_rphy(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy);
8675 -static struct mptsas_phyinfo * mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc,
8676 - u64 sas_address);
8677 -static int mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
8678 - u32 form, u32 form_specific);
8679 -static int mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
8680 - u32 form, u32 form_specific);
8681 -
8682 -static int mptsas_add_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info);
8683 -static void mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info);
8684 -static void mptsas_expander_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info);
8685 -static int mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
8686 - u32 form, u32 form_specific);
8687 +static inline void mptsas_set_rphy(MPT_ADAPTER *ioc,
8688 + struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy);
8689 +static struct mptsas_phyinfo *mptsas_find_phyinfo_by_sas_address(
8690 + MPT_ADAPTER *ioc, u64 sas_address);
8691 +static int mptsas_sas_device_pg0(MPT_ADAPTER *ioc,
8692 + struct mptsas_devinfo *device_info, u32 form, u32 form_specific);
8693 +static int mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc,
8694 + struct mptsas_enclosure *enclosure, u32 form, u32 form_specific);
8695 +
8696 +static int mptsas_add_end_device(MPT_ADAPTER *ioc,
8697 + struct mptsas_phyinfo *phy_info);
8698 +static void mptsas_del_end_device(MPT_ADAPTER *ioc,
8699 + struct mptsas_phyinfo *phy_info);
8700 +static void mptsas_expander_delete(MPT_ADAPTER *ioc,
8701 + struct mptsas_portinfo *port_info);
8702 +static int mptsas_sas_expander_pg0(MPT_ADAPTER *ioc,
8703 + struct mptsas_portinfo *port_info, u32 form, u32 form_specific);
8704 static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
8705 static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
8706
8707 @@ -323,7 +327,7 @@ mptsas_add_fw_event(MPT_ADAPTER *ioc, st
8708 list_add_tail(&fw_event->list, &ioc->fw_event_list);
8709 INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work);
8710 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: add (fw_event=0x%p)\n",
8711 - ioc->name,__FUNCTION__, fw_event));
8712 + ioc->name, __func__, fw_event));
8713 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
8714 msecs_to_jiffies(delay));
8715 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
8716 @@ -337,7 +341,7 @@ mptsas_requeue_fw_event(MPT_ADAPTER *ioc
8717 unsigned long flags;
8718 spin_lock_irqsave(&ioc->fw_event_lock, flags);
8719 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: reschedule task "
8720 - "(fw_event=0x%p)\n", ioc->name,__FUNCTION__, fw_event));
8721 + "(fw_event=0x%p)\n", ioc->name, __func__, fw_event));
8722 fw_event->retries++;
8723 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
8724 msecs_to_jiffies(delay));
8725 @@ -352,13 +356,14 @@ mptsas_free_fw_event(MPT_ADAPTER *ioc, s
8726
8727 spin_lock_irqsave(&ioc->fw_event_lock, flags);
8728 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: kfree (fw_event=0x%p)\n",
8729 - ioc->name,__FUNCTION__, fw_event));
8730 + ioc->name, __func__, fw_event));
8731 list_del(&fw_event->list);
8732 kfree(fw_event);
8733 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
8734 }
8735
8736 -/* walk the firmware event queue, and either stop or wait for outstanding events to complete */
8737 +/* walk the firmware event queue, and either stop or wait for
8738 + * outstanding events to complete */
8739 static void
8740 mptsas_cleanup_fw_event_q(MPT_ADAPTER *ioc)
8741 {
8742 @@ -373,7 +378,7 @@ mptsas_cleanup_fw_event_q(MPT_ADAPTER *i
8743 &hd->target_reset_list, list) {
8744 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8745 "%s: removing target reset for id=%d\n",
8746 - ioc->name, __FUNCTION__,
8747 + ioc->name, __func__,
8748 target_reset_list->sas_event_data.TargetID));
8749 list_del(&target_reset_list->list);
8750 kfree(target_reset_list);
8751 @@ -433,7 +438,7 @@ rphy_to_ioc(struct sas_rphy *rphy)
8752 static struct mptsas_portinfo *
8753 mptsas_find_portinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
8754 {
8755 - struct mptsas_portinfo *port_info, *rc=NULL;
8756 + struct mptsas_portinfo *port_info, *rc = NULL;
8757 int i;
8758
8759 if (sas_address >= ioc->hba_port_sas_addr &&
8760 @@ -523,7 +528,7 @@ mptsas_port_delete(MPT_ADAPTER *ioc, str
8761 phy_info = port_info->phy_info;
8762
8763 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: [%p]: num_phys=%02d "
8764 - "bitmask=0x%016llX\n", ioc->name, __FUNCTION__, port_details,
8765 + "bitmask=0x%016llX\n", ioc->name, __func__, port_details,
8766 port_details->num_phys, (unsigned long long)
8767 port_details->phy_bitmask));
8768
8769 @@ -659,7 +664,7 @@ mptsas_add_device_component(MPT_ADAPTER
8770 /*
8771 * Delete all matching devices out of the list
8772 */
8773 - down(&ioc->sas_device_info_mutex);
8774 + mutex_lock(&ioc->sas_device_info_mutex);
8775 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
8776 list) {
8777 if (!sas_info->is_logical_volume &&
8778 @@ -700,7 +705,7 @@ mptsas_add_device_component(MPT_ADAPTER
8779 }
8780
8781 out:
8782 - up(&ioc->sas_device_info_mutex);
8783 + mutex_unlock(&ioc->sas_device_info_mutex);
8784 return;
8785 }
8786
8787 @@ -745,7 +750,8 @@ mptsas_add_device_component_by_fw(MPT_AD
8788 *
8789 **/
8790 static void
8791 -mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc, struct scsi_target *starget)
8792 +mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
8793 + struct scsi_target *starget)
8794 {
8795 CONFIGPARMS cfg;
8796 ConfigPageHeader_t hdr;
8797 @@ -790,14 +796,14 @@ mptsas_add_device_component_starget_ir(M
8798 */
8799 for (i = 0; i < buffer->NumPhysDisks; i++) {
8800
8801 - if(mpt_raid_phys_disk_pg0(ioc,
8802 + if (mpt_raid_phys_disk_pg0(ioc,
8803 buffer->PhysDisk[i].PhysDiskNum, &phys_disk) != 0)
8804 continue;
8805
8806 mptsas_add_device_component_by_fw(ioc, phys_disk.PhysDiskBus,
8807 phys_disk.PhysDiskID);
8808
8809 - down(&ioc->sas_device_info_mutex);
8810 + mutex_lock(&ioc->sas_device_info_mutex);
8811 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
8812 list) {
8813 if (!sas_info->is_logical_volume &&
8814 @@ -807,13 +813,13 @@ mptsas_add_device_component_starget_ir(M
8815 sas_info->volume_id = starget->id;
8816 }
8817 }
8818 - up(&ioc->sas_device_info_mutex);
8819 + mutex_unlock(&ioc->sas_device_info_mutex);
8820 }
8821
8822 /*
8823 * Delete all matching devices out of the list
8824 */
8825 - down(&ioc->sas_device_info_mutex);
8826 + mutex_lock(&ioc->sas_device_info_mutex);
8827 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
8828 list) {
8829 if (sas_info->is_logical_volume && sas_info->fw.id ==
8830 @@ -832,7 +838,7 @@ mptsas_add_device_component_starget_ir(M
8831 INIT_LIST_HEAD(&sas_info->list);
8832 list_add_tail(&sas_info->list, &ioc->sas_device_info_list);
8833 }
8834 - up(&ioc->sas_device_info_mutex);
8835 + mutex_unlock(&ioc->sas_device_info_mutex);
8836
8837 out:
8838 if (buffer)
8839 @@ -847,7 +853,8 @@ mptsas_add_device_component_starget_ir(M
8840 *
8841 **/
8842 static void
8843 -mptsas_add_device_component_starget(MPT_ADAPTER *ioc, struct scsi_target *starget)
8844 +mptsas_add_device_component_starget(MPT_ADAPTER *ioc,
8845 + struct scsi_target *starget)
8846 {
8847 VirtTarget *vtarget;
8848 struct sas_rphy *rphy;
8849 @@ -906,13 +913,13 @@ mptsas_del_device_components(MPT_ADAPTER
8850 {
8851 struct sas_device_info *sas_info, *next;
8852
8853 - down(&ioc->sas_device_info_mutex);
8854 + mutex_lock(&ioc->sas_device_info_mutex);
8855 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
8856 list) {
8857 list_del(&sas_info->list);
8858 kfree(sas_info);
8859 }
8860 - up(&ioc->sas_device_info_mutex);
8861 + mutex_unlock(&ioc->sas_device_info_mutex);
8862 }
8863
8864 /**
8865 @@ -926,7 +933,7 @@ mptsas_del_device_components(MPT_ADAPTER
8866 static void
8867 mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
8868 {
8869 - struct mptsas_portinfo_details * port_details;
8870 + struct mptsas_portinfo_details *port_details;
8871 struct mptsas_phyinfo *phy_info, *phy_info_cmp;
8872 u64 sas_address;
8873 int i, j;
8874 @@ -949,9 +956,9 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8875 */
8876 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8877 "%s: [%p]: deleting phy = %d\n",
8878 - ioc->name, __FUNCTION__, port_details, i));
8879 + ioc->name, __func__, port_details, i));
8880 port_details->num_phys--;
8881 - port_details->phy_bitmask &= ~ (1 << phy_info->phy_id);
8882 + port_details->phy_bitmask &= ~(1 << phy_info->phy_id);
8883 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo));
8884 devtprintk(ioc, dev_printk(KERN_DEBUG, &phy_info->phy->dev,
8885 MYIOC_s_FMT "delete phy %d, phy-obj (0x%p)\n", ioc->name,
8886 @@ -966,8 +973,9 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8887 phy_info = port_info->phy_info;
8888 for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) {
8889 sas_address = phy_info->attached.sas_address;
8890 - dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "phy_id=%d sas_address=0x%018llX\n",
8891 - ioc->name, i, (unsigned long long)sas_address));
8892 + dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8893 + "phy_id=%d sas_address=0x%018llX\n",
8894 + ioc->name, i, (unsigned long long)sas_address));
8895 if (!sas_address)
8896 continue;
8897 port_details = phy_info->port_details;
8898 @@ -981,13 +989,14 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8899 goto out;
8900 port_details->num_phys = 1;
8901 port_details->port_info = port_info;
8902 - if (phy_info->phy_id < 64 )
8903 + if (phy_info->phy_id < 64)
8904 port_details->phy_bitmask |=
8905 (1 << phy_info->phy_id);
8906 - phy_info->sas_port_add_phy=1;
8907 - dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tForming port\n\t\t"
8908 - "phy_id=%d sas_address=0x%018llX\n", ioc->name, i,
8909 - (unsigned long long) sas_address));
8910 + phy_info->sas_port_add_phy = 1;
8911 + dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8912 + "\t\tForming port\n\t\t"
8913 + "phy_id=%d sas_address=0x%018llX\n", ioc->name,
8914 + i, (unsigned long long) sas_address));
8915 phy_info->port_details = port_details;
8916 }
8917
8918 @@ -1000,7 +1009,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8919 continue;
8920 if (sas_address != phy_info_cmp->attached.sas_address)
8921 continue;
8922 - if (phy_info_cmp->port_details == port_details )
8923 + if (phy_info_cmp->port_details == port_details)
8924 continue;
8925 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8926 "\t\tphy_id=%d sas_address=0x%018llX\n",
8927 @@ -1018,12 +1027,12 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8928 if (!phy_info_cmp->port_details->num_phys)
8929 kfree(phy_info_cmp->port_details);
8930 } else
8931 - phy_info_cmp->sas_port_add_phy=1;
8932 + phy_info_cmp->sas_port_add_phy = 1;
8933 /*
8934 * Adding a phy to a port
8935 */
8936 phy_info_cmp->port_details = port_details;
8937 - if (phy_info_cmp->phy_id < 64 )
8938 + if (phy_info_cmp->phy_id < 64)
8939 port_details->phy_bitmask |=
8940 (1 << phy_info_cmp->phy_id);
8941 port_details->num_phys++;
8942 @@ -1038,11 +1047,12 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc
8943 continue;
8944 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8945 "%s: [%p]: phy_id=%02d num_phys=%02d "
8946 - "bitmask=0x%016llX\n", ioc->name, __FUNCTION__,
8947 + "bitmask=0x%016llX\n", ioc->name, __func__,
8948 port_details, i, port_details->num_phys,
8949 (unsigned long long)port_details->phy_bitmask));
8950 - dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tport = %p rphy=%p\n",
8951 - ioc->name, port_details->port, port_details->rphy));
8952 + dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
8953 + "\t\tport = %p rphy=%p\n",
8954 + ioc->name, port_details->port, port_details->rphy));
8955 }
8956 dsaswideprintk(ioc, printk("\n"));
8957 mutex_unlock(&ioc->sas_topology_mutex);
8958 @@ -1089,7 +1099,7 @@ mptsas_queue_device_delete(MPT_ADAPTER *
8959 fw_event = kzalloc(sz, GFP_ATOMIC);
8960 if (!fw_event) {
8961 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n",
8962 - ioc->name, __FUNCTION__, __LINE__);
8963 + ioc->name, __func__, __LINE__);
8964 return;
8965 }
8966 memcpy(fw_event->event_data, sas_event_data,
8967 @@ -1109,7 +1119,7 @@ mptsas_queue_rescan(MPT_ADAPTER *ioc)
8968 fw_event = kzalloc(sz, GFP_ATOMIC);
8969 if (!fw_event) {
8970 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n",
8971 - ioc->name, __FUNCTION__, __LINE__);
8972 + ioc->name, __func__, __LINE__);
8973 return;
8974 }
8975 fw_event->event = -1;
8976 @@ -1139,8 +1149,9 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8
8977 return 0;
8978
8979 if ((mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc)) == NULL) {
8980 - dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames @%d!!\n",
8981 - ioc->name,__FUNCTION__, __LINE__));
8982 + dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
8983 + "%s, no msg frames @%d!!\n",
8984 + ioc->name, __func__, __LINE__));
8985 goto out_fail;
8986 }
8987
8988 @@ -1150,7 +1161,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8
8989 /* Format the Request
8990 */
8991 pScsiTm = (SCSITaskMgmt_t *) mf;
8992 - memset (pScsiTm, 0, sizeof(SCSITaskMgmt_t));
8993 + memset(pScsiTm, 0, sizeof(SCSITaskMgmt_t));
8994 pScsiTm->TargetID = id;
8995 pScsiTm->Bus = channel;
8996 pScsiTm->Function = MPI_FUNCTION_SCSI_TASK_MGMT;
8997 @@ -1201,8 +1212,9 @@ mptsas_target_reset_queue(MPT_ADAPTER *i
8998 target_reset_list = kzalloc(sizeof(struct mptsas_target_reset_event),
8999 GFP_ATOMIC);
9000 if (!target_reset_list) {
9001 - dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
9002 - ioc->name,__FUNCTION__, __LINE__));
9003 + dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
9004 + "%s, failed to allocate mem @%d..!!\n",
9005 + ioc->name, __func__, __LINE__));
9006 return;
9007 }
9008
9009 @@ -1227,7 +1239,7 @@ static int
9010 mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
9011 {
9012 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
9013 - struct list_head *head = &hd->target_reset_list;
9014 + struct list_head *head = &hd->target_reset_list;
9015 struct mptsas_target_reset_event *target_reset_list;
9016 u8 id, channel;
9017 SCSITaskMgmtReply_t *pScsiTmReply;
9018 @@ -1300,7 +1312,8 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
9019 */
9020 list_del(&target_reset_list->list);
9021 if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
9022 - mptsas_queue_device_delete(ioc, &target_reset_list->sas_event_data);
9023 + mptsas_queue_device_delete(ioc,
9024 + &target_reset_list->sas_event_data);
9025
9026
9027 /*
9028 @@ -1311,8 +1324,8 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
9029 if (list_empty(head))
9030 return 1;
9031
9032 - target_reset_list = list_entry(head->next, struct mptsas_target_reset_event,
9033 - list);
9034 + target_reset_list = list_entry(head->next,
9035 + struct mptsas_target_reset_event, list);
9036
9037 id = target_reset_list->sas_event_data.TargetID;
9038 channel = target_reset_list->sas_event_data.Bus;
9039 @@ -1344,19 +1357,19 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int r
9040 if (!hd->ioc)
9041 goto out;
9042
9043 - switch(reset_phase) {
9044 + switch (reset_phase) {
9045 case MPT_IOC_SETUP_RESET:
9046 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9047 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
9048 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
9049 mptsas_fw_event_off(ioc);
9050 break;
9051 case MPT_IOC_PRE_RESET:
9052 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9053 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
9054 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
9055 break;
9056 case MPT_IOC_POST_RESET:
9057 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9058 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
9059 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
9060 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_PENDING) {
9061 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_DID_IOCRESET;
9062 complete(&ioc->sas_mgmt.done);
9063 @@ -1473,7 +1486,7 @@ mptsas_get_lun_number(MPT_ADAPTER *ioc,
9064 &lun_data_dma);
9065 if (!lun_data) {
9066 printk(MYIOC_s_ERR_FMT "%s: pci_alloc_consistent(%d) FAILED!\n",
9067 - ioc->name, __FUNCTION__, lun_data_len);
9068 + ioc->name, __func__, lun_data_len);
9069 rc = -ENOMEM;
9070 goto out;
9071 }
9072 @@ -1481,7 +1494,7 @@ mptsas_get_lun_number(MPT_ADAPTER *ioc,
9073 iocmd = kzalloc(sizeof(INTERNAL_CMD), GFP_KERNEL);
9074 if (!iocmd) {
9075 printk(MYIOC_s_ERR_FMT "%s: kzalloc(%zd) FAILED!\n",
9076 - ioc->name, __FUNCTION__, sizeof(INTERNAL_CMD));
9077 + ioc->name, __func__, sizeof(INTERNAL_CMD));
9078 rc = -ENOMEM;
9079 goto out;
9080 }
9081 @@ -1499,14 +1512,14 @@ mptsas_get_lun_number(MPT_ADAPTER *ioc,
9082 if ((rc = mptscsih_do_cmd(hd, iocmd)) < 0) {
9083 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9084 "report_luns failed due to rc=0x%x\n", ioc->name,
9085 - __FUNCTION__, channel, id, rc);
9086 + __func__, channel, id, rc);
9087 goto out;
9088 }
9089
9090 if (rc != MPT_SCANDV_GOOD) {
9091 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9092 "report_luns failed due to rc=0x%x\n", ioc->name,
9093 - __FUNCTION__, channel, id, rc);
9094 + __func__, channel, id, rc);
9095 rc = -rc;
9096 goto out;
9097 }
9098 @@ -1576,7 +1589,7 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9099 iocmd = kzalloc(sizeof(INTERNAL_CMD), GFP_KERNEL);
9100 if (!iocmd) {
9101 printk(MYIOC_s_ERR_FMT "%s: kzalloc(%zd) FAILED!\n",
9102 - __FUNCTION__, ioc->name, sizeof(INTERNAL_CMD));
9103 + __func__, ioc->name, sizeof(INTERNAL_CMD));
9104 return DEVICE_ERROR;
9105 }
9106
9107 @@ -1595,31 +1608,31 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9108
9109 retry:
9110 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: fw_channel=%d "
9111 - "fw_id=%d retry=%d\n", ioc->name, __FUNCTION__, channel, id, count));
9112 + "fw_id=%d retry=%d\n", ioc->name, __func__, channel, id, count));
9113 rc = mptscsih_do_cmd(hd, iocmd);
9114 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: rc=0x%02x\n",
9115 - ioc->name, __FUNCTION__, rc));
9116 + ioc->name, __func__, rc));
9117 if (rc < 0) {
9118 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9119 "tur failed due to timeout\n", ioc->name,
9120 - __FUNCTION__, channel, id);
9121 + __func__, channel, id);
9122 goto tur_done;
9123 }
9124
9125 - switch(rc) {
9126 + switch (rc) {
9127 case MPT_SCANDV_GOOD:
9128 state = DEVICE_READY;
9129 goto tur_done;
9130 case MPT_SCANDV_BUSY:
9131 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: "
9132 "fw_channel=%d fw_id=%d : device busy\n",
9133 - ioc->name, __FUNCTION__, channel, id));
9134 + ioc->name, __func__, channel, id));
9135 state = DEVICE_RETRY;
9136 break;
9137 case MPT_SCANDV_DID_RESET:
9138 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: "
9139 "fw_channel=%d fw_id=%d : did reset\n",
9140 - ioc->name, __FUNCTION__, channel, id));
9141 + ioc->name, __func__, channel, id));
9142 state = DEVICE_RETRY;
9143 break;
9144 case MPT_SCANDV_SENSE:
9145 @@ -1630,7 +1643,7 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9146 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: "
9147 "fw_channel=%d fw_id=%d : [sense_key,asc,"
9148 "ascq]: [0x%02x,0x%02x,0x%02x]\n", ioc->name,
9149 - __FUNCTION__, channel, id, skey, asc, ascq));
9150 + __func__, channel, id, skey, asc, ascq));
9151
9152 if (skey == UNIT_ATTENTION) {
9153 if (!retry_ua) {
9154 @@ -1656,7 +1669,7 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9155 break;
9156 }
9157 } else if (skey == ILLEGAL_REQUEST) {
9158 - /* try sending a tur to a non-zero lun number */
9159 + /* try sending a tur to a non-zero lun number */
9160 if (!iocmd->lun && !mptsas_get_lun_number(ioc,
9161 channel, id, &iocmd->lun) && iocmd->lun)
9162 goto retry;
9163 @@ -1664,25 +1677,25 @@ mptsas_test_unit_ready(MPT_ADAPTER *ioc,
9164 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d : "
9165 "tur failed due to [sense_key,asc,ascq]: "
9166 "[0x%02x,0x%02x,0x%02x]\n", ioc->name,
9167 - __FUNCTION__, channel, id, skey, asc, ascq);
9168 + __func__, channel, id, skey, asc, ascq);
9169 goto tur_done;
9170 case MPT_SCANDV_SELECTION_TIMEOUT:
9171 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9172 "tur failed due to no device\n", ioc->name,
9173 - __FUNCTION__, channel,
9174 + __func__, channel,
9175 id);
9176 goto tur_done;
9177 case MPT_SCANDV_SOME_ERROR:
9178 printk(MYIOC_s_ERR_FMT "%s: fw_channel=%d fw_id=%d: "
9179 "tur failed due to some error\n", ioc->name,
9180 - __FUNCTION__,
9181 + __func__,
9182 channel, id);
9183 goto tur_done;
9184 default:
9185 printk(MYIOC_s_ERR_FMT
9186 "%s: fw_channel=%d fw_id=%d: tur failed due to "
9187 - "unknown rc=0x%02x\n", ioc->name, __FUNCTION__,
9188 - channel, id, rc );
9189 + "unknown rc=0x%02x\n", ioc->name, __func__,
9190 + channel, id, rc);
9191 goto tur_done;
9192 }
9193 tur_done:
9194 @@ -1705,19 +1718,19 @@ mptsas_issue_tlr(MPT_SCSI_HOST *hd, stru
9195 u8 rc;
9196 MPT_ADAPTER *ioc = hd->ioc;
9197
9198 - if ( sdev->inquiry[8] == 'H' &&
9199 + if (sdev->inquiry[8] == 'H' &&
9200 sdev->inquiry[9] == 'P' &&
9201 sdev->inquiry[10] == ' ' &&
9202 sdev->inquiry[11] == ' ' &&
9203 sdev->inquiry[12] == ' ' &&
9204 sdev->inquiry[13] == ' ' &&
9205 sdev->inquiry[14] == ' ' &&
9206 - sdev->inquiry[15] == ' ' ) {
9207 + sdev->inquiry[15] == ' ') {
9208
9209 iocmd = kzalloc(sizeof(INTERNAL_CMD), GFP_KERNEL);
9210 if (!iocmd) {
9211 printk(MYIOC_s_ERR_FMT "%s: kzalloc(%zd) FAILED!\n",
9212 - __FUNCTION__, ioc->name, sizeof(INTERNAL_CMD));
9213 + __func__, ioc->name, sizeof(INTERNAL_CMD));
9214 return;
9215 }
9216 iocmd->id = vdevice->vtarget->id;
9217 @@ -1773,7 +1786,7 @@ mptsas_slave_configure(struct scsi_devic
9218 mptsas_add_device_component_starget(ioc, scsi_target(sdev));
9219
9220 if (sdev->type == TYPE_TAPE &&
9221 - (ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_TLR ))
9222 + (ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_TLR))
9223 mptsas_issue_tlr(hd, sdev);
9224 out:
9225
9226 @@ -1815,7 +1828,7 @@ mptsas_target_alloc(struct scsi_target *
9227 kfree(vtarget);
9228 return -ENXIO;
9229 }
9230 - for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
9231 + for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
9232 if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID)
9233 channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus;
9234 vtarget->raidVolume = 1;
9235 @@ -1834,9 +1847,11 @@ mptsas_target_alloc(struct scsi_target *
9236 mptsas_set_starget(&p->phy_info[i], starget);
9237
9238 starget_printk(KERN_INFO, starget, MYIOC_s_FMT
9239 - "add device: fw_channel %d, fw_id %d, phy %d, sas_addr 0x%llx\n",
9240 + "add device: fw_channel %d, fw_id %d, phy %d,"
9241 + " sas_addr 0x%llx\n",
9242 ioc->name, p->phy_info[i].attached.channel,
9243 - p->phy_info[i].attached.id, p->phy_info[i].attached.phy_id,
9244 + p->phy_info[i].attached.id,
9245 + p->phy_info[i].attached.phy_id,
9246 (unsigned long long)p->phy_info[i].attached.sas_address);
9247
9248 /*
9249 @@ -2000,8 +2015,7 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, voi
9250 if (ioc->sas_discovery_quiesce_io)
9251 return SCSI_MLQUEUE_HOST_BUSY;
9252
9253 -// scsi_print_command(SCpnt);
9254 - return mptscsih_qcmd(SCpnt,done);
9255 + return mptscsih_qcmd(SCpnt, done);
9256 }
9257
9258
9259 @@ -2046,7 +2060,6 @@ static int mptsas_get_linkerrors(struct
9260 dma_addr_t dma_handle;
9261 int error;
9262
9263 - /* FIXME: only have link errors on local phys */
9264 if (!scsi_is_sas_phy_local(phy))
9265 return -EINVAL;
9266
9267 @@ -2140,7 +2153,6 @@ static int mptsas_phy_reset(struct sas_p
9268 unsigned long timeleft;
9269 int error = -ERESTARTSYS;
9270
9271 - /* FIXME: fusion doesn't allow non-local phy reset */
9272 if (!scsi_is_sas_phy_local(phy))
9273 return -EINVAL;
9274
9275 @@ -2192,7 +2204,7 @@ static int mptsas_phy_reset(struct sas_p
9276 reply = (SasIoUnitControlReply_t *)ioc->sas_mgmt.reply;
9277 if (reply->IOCStatus != MPI_IOCSTATUS_SUCCESS) {
9278 printk(MYIOC_s_INFO_FMT "%s: IOCStatus=0x%X IOCLogInfo=0x%X\n",
9279 - ioc->name, __FUNCTION__, reply->IOCStatus, reply->IOCLogInfo);
9280 + ioc->name, __func__, reply->IOCStatus, reply->IOCLogInfo);
9281 error = -ENXIO;
9282 goto out_unlock;
9283 }
9284 @@ -2275,11 +2287,160 @@ mptsas_get_bay_identifier(struct sas_rph
9285 return rc;
9286 }
9287
9288 +static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
9289 + struct request *req)
9290 +{
9291 + MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc;
9292 + MPT_FRAME_HDR *mf;
9293 + SmpPassthroughRequest_t *smpreq;
9294 + struct request *rsp = req->next_rq;
9295 + int ret;
9296 + int flagsLength;
9297 + unsigned long timeleft;
9298 + char *psge;
9299 + dma_addr_t dma_addr_in = 0;
9300 + dma_addr_t dma_addr_out = 0;
9301 + u64 sas_address = 0;
9302 +
9303 + if (!rsp) {
9304 + printk(MYIOC_s_ERR_FMT
9305 + "%s: the smp response space is missing\n",
9306 + ioc->name, __func__);
9307 + return -EINVAL;
9308 + }
9309 +
9310 + /* do we need to support multiple segments? */
9311 + if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) {
9312 + printk(MYIOC_s_ERR_FMT
9313 + "%s: multiple segments req %u %u, rsp %u %u\n",
9314 + ioc->name, __func__, req->bio->bi_vcnt, req->data_len,
9315 + rsp->bio->bi_vcnt, rsp->data_len);
9316 + return -EINVAL;
9317 + }
9318 +
9319 + ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
9320 + if (ret)
9321 + goto out;
9322 +
9323 + mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
9324 + if (!mf) {
9325 + ret = -ENOMEM;
9326 + goto out_unlock;
9327 + }
9328 +
9329 + smpreq = (SmpPassthroughRequest_t *)mf;
9330 + memset(smpreq, 0, sizeof(*smpreq));
9331 +
9332 + smpreq->RequestDataLength = cpu_to_le16(req->data_len - 4);
9333 + smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH;
9334 +
9335 + if (rphy)
9336 + sas_address = rphy->identify.sas_address;
9337 + else {
9338 + struct mptsas_portinfo *port_info;
9339 +
9340 + mutex_lock(&ioc->sas_topology_mutex);
9341 + port_info = ioc->hba_port_info;
9342 + if (port_info && port_info->phy_info)
9343 + sas_address =
9344 + port_info->phy_info[0].phy->identify.sas_address;
9345 + mutex_unlock(&ioc->sas_topology_mutex);
9346 + }
9347 +
9348 + *((u64 *)&smpreq->SASAddress) = cpu_to_le64(sas_address);
9349 +
9350 + psge = (char *)
9351 + (((int *) mf) + (offsetof(SmpPassthroughRequest_t, SGL) / 4));
9352 +
9353 + /* request */
9354 +
9355 + flagsLength = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
9356 + MPI_SGE_FLAGS_SYSTEM_ADDRESS |
9357 + MPI_SGE_FLAGS_HOST_TO_IOC |
9358 + MPI_SGE_FLAGS_END_OF_BUFFER;
9359 +
9360 + flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
9361 +
9362 + flagsLength |= (req->data_len - 4);
9363 +
9364 + dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
9365 + req->data_len, PCI_DMA_BIDIRECTIONAL);
9366 + if (!dma_addr_out)
9367 + goto put_mf;
9368 + ioc->add_sge(psge, flagsLength, dma_addr_out);
9369 + psge += ioc->SGE_size;
9370 +
9371 + /* response */
9372 + flagsLength = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
9373 + MPI_SGE_FLAGS_SYSTEM_ADDRESS |
9374 + MPI_SGE_FLAGS_IOC_TO_HOST |
9375 + MPI_SGE_FLAGS_END_OF_BUFFER;
9376 +
9377 + flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
9378 + flagsLength |= rsp->data_len + 4;
9379 + dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio),
9380 + rsp->data_len, PCI_DMA_BIDIRECTIONAL);
9381 + if (!dma_addr_in)
9382 + goto out_unmap;
9383 +
9384 + ioc->add_sge(psge, flagsLength, dma_addr_in);
9385 +
9386 + INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status)
9387 + mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
9388 +
9389 + timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
9390 + if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
9391 + ret = -ETIME;
9392 + mpt_free_msg_frame(ioc, mf);
9393 + mf = NULL;
9394 + if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
9395 + goto out_unmap;
9396 + if (!timeleft) {
9397 + if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
9398 + mpt_HardResetHandler(ioc, CAN_SLEEP);
9399 + }
9400 + goto out_unmap;
9401 + }
9402 +
9403 + mf = NULL;
9404 +
9405 + if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) {
9406 + SmpPassthroughReply_t *smprep;
9407 +
9408 + smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
9409 + memcpy(req->sense, smprep, sizeof(*smprep));
9410 + req->sense_len = sizeof(*smprep);
9411 + req->data_len = 0;
9412 + rsp->data_len -= smprep->ResponseDataLength;
9413 + } else {
9414 + printk(MYIOC_s_ERR_FMT
9415 + "%s: smp passthru reply failed to be returned\n",
9416 + ioc->name, __func__);
9417 + ret = -ENXIO;
9418 + }
9419 +out_unmap:
9420 + if (dma_addr_out)
9421 + pci_unmap_single(ioc->pcidev, dma_addr_out, req->data_len,
9422 + PCI_DMA_BIDIRECTIONAL);
9423 + if (dma_addr_in)
9424 + pci_unmap_single(ioc->pcidev, dma_addr_in, rsp->data_len,
9425 + PCI_DMA_BIDIRECTIONAL);
9426 +put_mf:
9427 + if (mf)
9428 + mpt_free_msg_frame(ioc, mf);
9429 +out_unlock:
9430 + CLEAR_MGMT_STATUS(ioc->sas_mgmt.status)
9431 + mutex_unlock(&ioc->sas_mgmt.mutex);
9432 +out:
9433 + return ret;
9434 +}
9435 +
9436 static struct sas_function_template mptsas_transport_functions = {
9437 .get_linkerrors = mptsas_get_linkerrors,
9438 .get_enclosure_identifier = mptsas_get_enclosure_identifier,
9439 .get_bay_identifier = mptsas_get_bay_identifier,
9440 .phy_reset = mptsas_phy_reset,
9441 + .smp_handler = mptsas_smp_handler,
9442 };
9443
9444 static struct scsi_transport_template *mptsas_transport_template;
9445 @@ -2338,7 +2499,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc,
9446
9447 port_info->num_phys = buffer->NumPhys;
9448 port_info->phy_info = kcalloc(port_info->num_phys,
9449 - sizeof(struct mptsas_phyinfo),GFP_KERNEL);
9450 + sizeof(struct mptsas_phyinfo), GFP_KERNEL);
9451 if (!port_info->phy_info) {
9452 error = -ENOMEM;
9453 goto out_free_consistent;
9454 @@ -2659,7 +2820,7 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc
9455 /* save config data */
9456 port_info->num_phys = (buffer->NumPhys) ? buffer->NumPhys : 1;
9457 port_info->phy_info = kcalloc(port_info->num_phys,
9458 - sizeof(struct mptsas_phyinfo),GFP_KERNEL);
9459 + sizeof(struct mptsas_phyinfo), GFP_KERNEL);
9460 if (!port_info->phy_info) {
9461 error = -ENOMEM;
9462 goto out_free_consistent;
9463 @@ -2970,7 +3131,7 @@ static int mptsas_probe_one_phy(struct d
9464 if (error) {
9465 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9466 "%s: exit at line=%d\n", ioc->name,
9467 - __FUNCTION__, __LINE__));
9468 + __func__, __LINE__));
9469 goto out;
9470 }
9471 mptsas_set_port(ioc, phy_info, port);
9472 @@ -3036,7 +3197,7 @@ static int mptsas_probe_one_phy(struct d
9473 if (!rphy) {
9474 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9475 "%s: exit at line=%d\n", ioc->name,
9476 - __FUNCTION__, __LINE__));
9477 + __func__, __LINE__));
9478 goto out;
9479 }
9480
9481 @@ -3045,7 +3206,7 @@ static int mptsas_probe_one_phy(struct d
9482 if (error) {
9483 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9484 "%s: exit at line=%d\n", ioc->name,
9485 - __FUNCTION__, __LINE__));
9486 + __func__, __LINE__));
9487 sas_rphy_free(rphy);
9488 goto out;
9489 }
9490 @@ -3069,7 +3230,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
9491 int error = -ENOMEM, i;
9492
9493 hba = kzalloc(sizeof(struct mptsas_portinfo), GFP_KERNEL);
9494 - if (! hba)
9495 + if (!hba)
9496 goto out;
9497
9498 error = mptsas_sas_io_unit_pg0(ioc, hba);
9499 @@ -3195,7 +3356,7 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT
9500 num_paths = mpt_raid_phys_disk_get_num_paths(ioc, phys_disk_num);
9501 if (!num_paths)
9502 goto out;
9503 - phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
9504 + phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
9505 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
9506 if (!phys_disk)
9507 goto out;
9508 @@ -3208,7 +3369,8 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT
9509 (channel == phys_disk->Path[i].PhysDiskBus)) {
9510 memcpy(&sas_address, &phys_disk->Path[i].WWID,
9511 sizeof(u64));
9512 - phy_info = mptsas_find_phyinfo_by_sas_address(ioc, sas_address);
9513 + phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
9514 + sas_address);
9515 goto out;
9516 }
9517 }
9518 @@ -3230,7 +3392,8 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT
9519 continue;
9520 if (port_info->phy_info[i].attached.phys_disk_num == ~0)
9521 continue;
9522 - if (port_info->phy_info[i].attached.phys_disk_num == phys_disk_num &&
9523 + if (port_info->phy_info[i].attached.phys_disk_num ==
9524 + phys_disk_num &&
9525 port_info->phy_info[i].attached.id == id &&
9526 port_info->phy_info[i].attached.channel == channel)
9527 phy_info = &port_info->phy_info[i];
9528 @@ -3275,7 +3438,6 @@ mptsas_reprobe_target(struct scsi_target
9529 * @id:
9530 *
9531 *
9532 - * TODO: check for hotspares
9533 **/
9534 static void
9535 mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id)
9536 @@ -3363,10 +3525,10 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9537 char *ds = NULL;
9538 u8 fw_id;
9539
9540 - if (!phy_info){
9541 + if (!phy_info) {
9542 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9543 "%s: exit at line=%d\n", ioc->name,
9544 - __FUNCTION__, __LINE__));
9545 + __func__, __LINE__));
9546 return 1;
9547 }
9548
9549 @@ -3375,7 +3537,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9550 if (mptsas_get_rphy(phy_info)) {
9551 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9552 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9553 - __FUNCTION__, fw_id, __LINE__));
9554 + __func__, fw_id, __LINE__));
9555 return 2;
9556 }
9557
9558 @@ -3383,7 +3545,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9559 if (!port) {
9560 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9561 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9562 - __FUNCTION__, fw_id, __LINE__));
9563 + __func__, fw_id, __LINE__));
9564 return 3;
9565 }
9566
9567 @@ -3408,7 +3570,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9568 if (!rphy) {
9569 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9570 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9571 - __FUNCTION__, fw_id, __LINE__));
9572 + __func__, fw_id, __LINE__));
9573 return 5; /* non-fatal: an rphy can be added later */
9574 }
9575
9576 @@ -3416,7 +3578,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc,
9577 if (sas_rphy_add(rphy)) {
9578 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9579 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9580 - __FUNCTION__, fw_id, __LINE__));
9581 + __func__, fw_id, __LINE__));
9582 sas_rphy_free(rphy);
9583 return 6;
9584 }
9585 @@ -3439,7 +3601,7 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9586 struct mptsas_portinfo *port_info;
9587 struct mptsas_phyinfo *phy_info_parent;
9588 int i;
9589 - struct scsi_target * starget;
9590 + struct scsi_target *starget;
9591 char *ds = NULL;
9592 u8 fw_id;
9593 u64 sas_address;
9594 @@ -3453,14 +3615,14 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9595 if (!phy_info->port_details) {
9596 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9597 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9598 - __FUNCTION__, fw_id, __LINE__));
9599 + __func__, fw_id, __LINE__));
9600 return;
9601 }
9602 rphy = mptsas_get_rphy(phy_info);
9603 if (!rphy) {
9604 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9605 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9606 - __FUNCTION__, fw_id, __LINE__));
9607 + __func__, fw_id, __LINE__));
9608 return;
9609 }
9610 if (phy_info->attached.device_info &
9611 @@ -3485,13 +3647,13 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9612 if (!port) {
9613 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9614 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9615 - __FUNCTION__, fw_id, __LINE__));
9616 + __func__, fw_id, __LINE__));
9617 return;
9618 }
9619 port_info = phy_info->portinfo;
9620 phy_info_parent = port_info->phy_info;
9621 for (i = 0; i < port_info->num_phys; i++, phy_info_parent++) {
9622 - if(!phy_info_parent->phy)
9623 + if (!phy_info_parent->phy)
9624 continue;
9625 if (phy_info_parent->attached.sas_address !=
9626 sas_address)
9627 @@ -3507,11 +3669,11 @@ mptsas_del_end_device(MPT_ADAPTER *ioc,
9628 "delete port %d, sas_addr (0x%llx)\n", ioc->name,
9629 port->port_identifier, (unsigned long long)sas_address);
9630 sas_port_delete(port);
9631 -// mptsas_port_delete(ioc, phy_info->port_details);
9632 }
9633
9634 struct mptsas_phyinfo *
9635 -mptsas_refreshing_device_handles(MPT_ADAPTER *ioc, struct mptsas_devinfo *sas_device)
9636 +mptsas_refreshing_device_handles(MPT_ADAPTER *ioc,
9637 + struct mptsas_devinfo *sas_device)
9638 {
9639 struct mptsas_phyinfo *phy_info;
9640 struct mptsas_portinfo *port_info;
9641 @@ -3526,7 +3688,7 @@ mptsas_refreshing_device_handles(MPT_ADA
9642 goto out;
9643 mutex_lock(&ioc->sas_topology_mutex);
9644 for (i = 0; i < port_info->num_phys; i++) {
9645 - if(port_info->phy_info[i].attached.sas_address !=
9646 + if (port_info->phy_info[i].attached.sas_address !=
9647 sas_device->sas_address)
9648 continue;
9649 port_info->phy_info[i].attached.channel = sas_device->channel;
9650 @@ -3555,7 +3717,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9651 struct mptsas_hotplug_event *hot_plug_info)
9652 {
9653 struct mptsas_phyinfo *phy_info;
9654 - struct scsi_target * starget;
9655 + struct scsi_target *starget;
9656 struct mptsas_devinfo sas_device;
9657 VirtTarget *vtarget;
9658 enum device_state state;
9659 @@ -3636,17 +3798,17 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9660 (hot_plug_info->channel << 8) + hot_plug_info->id)) {
9661 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9662 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9663 - __FUNCTION__, hot_plug_info->id, __LINE__));
9664 + __func__, hot_plug_info->id, __LINE__));
9665 break;
9666 }
9667
9668 phy_info = mptsas_find_phyinfo_by_sas_address(
9669 ioc, sas_device.sas_address);
9670
9671 - if (!phy_info){
9672 + if (!phy_info) {
9673 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9674 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9675 - __FUNCTION__, hot_plug_info->id, __LINE__));
9676 + __func__, hot_plug_info->id, __LINE__));
9677 break;
9678 }
9679
9680 @@ -3654,7 +3816,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9681 if (!starget) {
9682 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9683 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9684 - __FUNCTION__, hot_plug_info->id, __LINE__));
9685 + __func__, hot_plug_info->id, __LINE__));
9686 break;
9687 }
9688
9689 @@ -3662,7 +3824,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9690 if (!vtarget) {
9691 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9692 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9693 - __FUNCTION__, hot_plug_info->id, __LINE__));
9694 + __func__, hot_plug_info->id, __LINE__));
9695 break;
9696 }
9697
9698 @@ -3688,7 +3850,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9699 (hot_plug_info->channel << 8) + hot_plug_info->id)) {
9700 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9701 "%s: fw_id=%d exit at line=%d\n",
9702 - ioc->name, __FUNCTION__,
9703 + ioc->name, __func__,
9704 hot_plug_info->id, __LINE__));
9705 break;
9706 }
9707 @@ -3698,7 +3860,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9708 if (!phy_info) {
9709 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9710 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9711 - __FUNCTION__, hot_plug_info->id, __LINE__));
9712 + __func__, hot_plug_info->id, __LINE__));
9713 break;
9714 }
9715
9716 @@ -3706,7 +3868,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9717 if (!starget) {
9718 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9719 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9720 - __FUNCTION__, hot_plug_info->id, __LINE__));
9721 + __func__, hot_plug_info->id, __LINE__));
9722 break;
9723 }
9724
9725 @@ -3714,14 +3876,14 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, st
9726 if (!vtarget) {
9727 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9728 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9729 - __FUNCTION__, hot_plug_info->id, __LINE__));
9730 + __func__, hot_plug_info->id, __LINE__));
9731 break;
9732 }
9733
9734 if (!(vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT)) {
9735 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9736 "%s: fw_id=%d exit at line=%d\n", ioc->name,
9737 - __FUNCTION__, hot_plug_info->id, __LINE__));
9738 + __func__, hot_plug_info->id, __LINE__));
9739 break;
9740 }
9741
9742 @@ -3800,7 +3962,7 @@ mptsas_send_sas_event(struct fw_event_wo
9743 if ((device_info &
9744 (MPI_SAS_DEVICE_INFO_SSP_TARGET |
9745 MPI_SAS_DEVICE_INFO_STP_TARGET |
9746 - MPI_SAS_DEVICE_INFO_SATA_DEVICE )) == 0) {
9747 + MPI_SAS_DEVICE_INFO_SATA_DEVICE)) == 0) {
9748 mptsas_free_fw_event(ioc, fw_event);
9749 return;
9750 }
9751 @@ -3840,9 +4002,7 @@ mptsas_send_sas_event(struct fw_event_wo
9752 break;
9753
9754 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
9755 - /* TODO */
9756 case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET:
9757 - /* TODO */
9758 default:
9759 mptsas_free_fw_event(ioc, fw_event);
9760 break;
9761 @@ -3892,7 +4052,7 @@ mptsas_send_raid_event(struct fw_event_w
9762 }
9763
9764 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "Entering %s: "
9765 - "ReasonCode=%02x\n", ioc->name, __FUNCTION__,
9766 + "ReasonCode=%02x\n", ioc->name, __func__,
9767 raid_event_data->ReasonCode));
9768
9769 switch (raid_event_data->ReasonCode) {
9770 @@ -3988,8 +4148,8 @@ mptsas_send_raid_event(struct fw_event_w
9771 *
9772 **/
9773 static int
9774 -mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, int task_context, ulong timeout,
9775 - u8 *issue_reset)
9776 +mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun,
9777 + int task_context, ulong timeout, u8 *issue_reset)
9778 {
9779 MPT_FRAME_HDR *mf;
9780 SCSITaskMgmt_t *pScsiTm;
9781 @@ -4068,7 +4228,7 @@ mptsas_broadcast_primative_work(struct f
9782 VirtDevice *vdevice;
9783 int ii;
9784 struct scsi_cmnd *sc;
9785 - SCSITaskMgmtReply_t * pScsiTmReply;
9786 + SCSITaskMgmtReply_t *pScsiTmReply;
9787 u8 issue_reset;
9788 int task_context;
9789 u8 channel, id;
9790 @@ -4077,7 +4237,7 @@ mptsas_broadcast_primative_work(struct f
9791 u32 query_count;
9792
9793 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9794 - "%s - enter\n", ioc->name, __FUNCTION__));
9795 + "%s - enter\n", ioc->name, __func__));
9796
9797 mutex_lock(&ioc->taskmgmt_cmds.mutex);
9798 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
9799 @@ -4133,7 +4293,7 @@ mptsas_broadcast_primative_work(struct f
9800 out:
9801 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
9802 "%s - exit, query_count = %d termination_count = %d\n",
9803 - ioc->name, __FUNCTION__, query_count, termination_count));
9804 + ioc->name, __func__, query_count, termination_count));
9805
9806 ioc->broadcast_aen_busy = 0;
9807 mpt_clear_taskmgmt_in_progress_flag(ioc);
9808 @@ -4141,7 +4301,7 @@ mptsas_broadcast_primative_work(struct f
9809
9810 if (issue_reset) {
9811 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
9812 - ioc->name, __FUNCTION__);
9813 + ioc->name, __func__);
9814 if (mpt_SoftResetHandler(ioc, CAN_SLEEP))
9815 mpt_HardResetHandler(ioc, CAN_SLEEP);
9816 }
9817 @@ -4159,7 +4319,7 @@ mptsas_send_ir2_event(struct fw_event_wo
9818 {
9819 MPT_ADAPTER *ioc;
9820 struct mptsas_hotplug_event hot_plug_info;
9821 - MPI_EVENT_DATA_IR2 * ir2_data;
9822 + MPI_EVENT_DATA_IR2 *ir2_data;
9823 u8 reasonCode;
9824 RaidPhysDiskPage0_t phys_disk;
9825
9826 @@ -4168,7 +4328,7 @@ mptsas_send_ir2_event(struct fw_event_wo
9827 reasonCode = ir2_data->ReasonCode;
9828
9829 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "Entering %s: "
9830 - "ReasonCode=%02x\n", ioc->name,__FUNCTION__, reasonCode));
9831 + "ReasonCode=%02x\n", ioc->name, __func__, reasonCode));
9832
9833 memset(&hot_plug_info, 0, sizeof(struct mptsas_hotplug_event));
9834 hot_plug_info.id = ir2_data->TargetID;
9835 @@ -4255,7 +4415,7 @@ mptsas_expander_refresh(MPT_ADAPTER *ioc
9836
9837 static void
9838 mptsas_expander_event_add(MPT_ADAPTER *ioc,
9839 - MpiEventDataSasExpanderStatusChange_t* expander_data)
9840 + MpiEventDataSasExpanderStatusChange_t *expander_data)
9841 {
9842 struct mptsas_portinfo *port_info;
9843 int i;
9844 @@ -4267,7 +4427,7 @@ mptsas_expander_event_add(MPT_ADAPTER *i
9845 port_info->num_phys = (expander_data->NumPhys) ?
9846 expander_data->NumPhys : 1;
9847 port_info->phy_info = kcalloc(port_info->num_phys,
9848 - sizeof(struct mptsas_phyinfo),GFP_KERNEL);
9849 + sizeof(struct mptsas_phyinfo), GFP_KERNEL);
9850 if (!port_info->phy_info)
9851 BUG();
9852 memcpy(&sas_address, &expander_data->SASAddress, sizeof(__le64));
9853 @@ -4351,8 +4511,8 @@ mptsas_expander_delete(MPT_ADAPTER *ioc,
9854 u64 expander_sas_address;
9855 struct mptsas_phyinfo *phy_info;
9856 struct mptsas_portinfo buffer;
9857 - struct mptsas_portinfo_details * port_details;
9858 - struct sas_port * port;
9859 + struct mptsas_portinfo_details *port_details;
9860 + struct sas_port *port;
9861
9862 if (!port_info)
9863 return;
9864 @@ -4388,7 +4548,7 @@ mptsas_expander_delete(MPT_ADAPTER *ioc,
9865 phy_info = parent->phy_info;
9866 port = NULL;
9867 for (i = 0; i < parent->num_phys; i++, phy_info++) {
9868 - if(!phy_info->phy)
9869 + if (!phy_info->phy)
9870 continue;
9871 if (phy_info->attached.sas_address !=
9872 expander_sas_address)
9873 @@ -4438,7 +4598,7 @@ static void
9874 mptsas_send_expander_event(struct fw_event_work *fw_event)
9875 {
9876 MPT_ADAPTER *ioc;
9877 - MpiEventDataSasExpanderStatusChange_t* expander_data;
9878 + MpiEventDataSasExpanderStatusChange_t *expander_data;
9879 struct mptsas_portinfo *port_info;
9880 __le64 sas_address;
9881 int i;
9882 @@ -4492,7 +4652,7 @@ mptsas_expander_add(MPT_ADAPTER *ioc, u1
9883 if (!port_info) {
9884 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9885 "%s: exit at line=%d\n", ioc->name,
9886 - __FUNCTION__, __LINE__));
9887 + __func__, __LINE__));
9888 return NULL;
9889 }
9890 port_info->num_phys = buffer.num_phys;
9891 @@ -4589,7 +4749,7 @@ mptsas_handle_queue_full_event(struct fw
9892 current_depth = le16_to_cpu(qfull_data->CurrentDepth);
9893
9894 /* if hidden raid component, look for the volume id */
9895 - down(&ioc->sas_device_info_mutex);
9896 + mutex_lock(&ioc->sas_device_info_mutex);
9897 if (mptscsih_is_phys_disk(ioc, fw_channel, fw_id)) {
9898 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
9899 list) {
9900 @@ -4622,7 +4782,7 @@ mptsas_handle_queue_full_event(struct fw
9901 }
9902
9903 out:
9904 - up(&ioc->sas_device_info_mutex);
9905 + mutex_unlock(&ioc->sas_device_info_mutex);
9906
9907 if (id != -1) {
9908 shost_for_each_device(sdev, ioc->sh) {
9909 @@ -4643,8 +4803,8 @@ mptsas_handle_queue_full_event(struct fw
9910 depth);
9911 else if (depth < 0)
9912 sdev_printk(KERN_INFO, sdev,
9913 - "Tagged Command Queueing is being "
9914 - "disabled\n");
9915 + "Tagged Command Queueing is being "
9916 + "disabled\n");
9917 else if (depth == 0)
9918 sdev_printk(KERN_INFO, sdev,
9919 "Queue depth not changed yet\n");
9920 @@ -4671,7 +4831,7 @@ mptsas_firmware_event_work(struct work_s
9921 /* special rescan topology handling */
9922 if (fw_event->event == -1) {
9923 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: rescan after "
9924 - "reset\n", ioc->name,__FUNCTION__));
9925 + "reset\n", ioc->name, __func__));
9926 mptsas_not_responding_devices(ioc);
9927 mptsas_scan_sas_topology(ioc);
9928 mptsas_free_fw_event(ioc, fw_event);
9929 @@ -4685,7 +4845,7 @@ mptsas_firmware_event_work(struct work_s
9930 }
9931
9932 devtprintk(ioc, printk(MYIOC_s_INFO_FMT "%s: fw_event=(0x%p), "
9933 - "event = (0x%02x)\n", ioc->name,__FUNCTION__, fw_event,
9934 + "event = (0x%02x)\n", ioc->name, __func__, fw_event,
9935 (fw_event->event & 0xFF)));
9936
9937 switch (fw_event->event) {
9938 @@ -4805,7 +4965,7 @@ mptsas_event_process(MPT_ADAPTER *ioc, E
9939 fw_event = kzalloc(sz, GFP_ATOMIC);
9940 if (!fw_event) {
9941 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name,
9942 - __FUNCTION__, __LINE__);
9943 + __func__, __LINE__);
9944 return 0;
9945 }
9946 memcpy(fw_event->event_data, reply->Data, event_data_sz);
9947 @@ -4835,7 +4995,7 @@ static void mptsas_volume_delete(MPT_ADA
9948 goto release_sdev;
9949 out:
9950 printk(MYIOC_s_INFO_FMT "removing raid volume, channel %d, "
9951 - "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL,id);
9952 + "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, id);
9953 scsi_remove_device(sdev);
9954 release_sdev:
9955 scsi_device_put(sdev);
9956 @@ -4953,7 +5113,7 @@ mptsas_probe_expanders(MPT_ADAPTER *ioc)
9957 if (!port_info) {
9958 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
9959 "%s: exit at line=%d\n", ioc->name,
9960 - __FUNCTION__, __LINE__));
9961 + __func__, __LINE__));
9962 return;
9963 }
9964 port_info->num_phys = buffer.num_phys;
9965 @@ -5000,7 +5160,7 @@ mptsas_probe_devices(MPT_ADAPTER *ioc)
9966
9967 state = DEVICE_RETRY;
9968 retry_count = 0;
9969 - while(state == DEVICE_RETRY) {
9970 + while (state == DEVICE_RETRY) {
9971 state = mptsas_test_unit_ready(ioc, sas_device.channel,
9972 sas_device.id, retry_count++);
9973 ssleep(1);
9974 @@ -5032,7 +5192,7 @@ mptsas_scan_sas_topology(MPT_ADAPTER *io
9975 if (!ioc->ir_firmware || !ioc->raid_data.pIocPg2 ||
9976 !ioc->raid_data.pIocPg2->NumActiveVolumes)
9977 return;
9978 - for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
9979 + for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
9980 if ((sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
9981 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0))) {
9982 scsi_device_put(sdev);
9983 @@ -5196,11 +5356,12 @@ mptsas_probe(struct pci_dev *pdev, const
9984 hd->last_queue_full = 0;
9985 ioc->disable_hotplug_remove = mpt_disable_hotplug_remove;
9986 if (ioc->disable_hotplug_remove)
9987 - printk(MYIOC_s_INFO_FMT "disabling hotplug remove\n", ioc->name);
9988 + printk(MYIOC_s_INFO_FMT
9989 + "disabling hotplug remove\n", ioc->name);
9990
9991 INIT_LIST_HEAD(&hd->target_reset_list);
9992 INIT_LIST_HEAD(&ioc->sas_device_info_list);
9993 - init_MUTEX(&ioc->sas_device_info_mutex);
9994 + mutex_init(&ioc->sas_device_info_mutex);
9995
9996 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
9997
9998 --- a/drivers/message/fusion/mptsas.h
9999 +++ b/drivers/message/fusion/mptsas.h
10000 @@ -84,9 +84,12 @@ struct sas_device_info {
10001 u16 slot; /* enclosure slot id */
10002 u64 enclosure_logical_id; /*enclosure address */
10003 u8 is_logical_volume; /* is this logical volume */
10004 - u8 is_hidden_raid_component; /* this belongs to volume */
10005 - u8 volume_id; /* this valid when is_hidden_raid_component set */
10006 - u8 is_cached; /* cached data for a removed device */
10007 + /* this belongs to volume */
10008 + u8 is_hidden_raid_component;
10009 + /* this valid when is_hidden_raid_component set */
10010 + u8 volume_id;
10011 + /* cached data for a removed device */
10012 + u8 is_cached;
10013 };
10014
10015 struct mptsas_hotplug_event {
10016 --- a/drivers/message/fusion/mptscsih.c
10017 +++ b/drivers/message/fusion/mptscsih.c
10018 @@ -102,7 +102,8 @@ static void mptscsih_copy_sense_data(str
10019
10020 int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
10021 int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
10022 -static void mptscsih_synchronize_cache(struct scsi_device *sdev, MPT_SCSI_HOST *hd, VirtDevice *vdevice);
10023 +static void mptscsih_synchronize_cache(struct scsi_device *sdev,
10024 + MPT_SCSI_HOST *hd, VirtDevice *vdevice);
10025
10026 void mptscsih_remove(struct pci_dev *);
10027 void mptscsih_shutdown(struct pci_dev *);
10028 @@ -142,12 +143,16 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER
10029 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer;
10030 chain_idx = offset / ioc->req_sz;
10031 rc = SUCCESS;
10032 - dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n",
10033 - ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx));
10034 + dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10035 + "getFreeChainBuffer chainBuf=%p ChainBuffer=%p"
10036 + " offset=%d chain_idx=%d\n",
10037 + ioc->name, chainBuf, ioc->ChainBuffer, offset,
10038 + chain_idx));
10039 } else {
10040 rc = FAILED;
10041 chain_idx = MPT_HOST_NO_CHAIN;
10042 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "getFreeChainBuffer failed\n",
10043 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10044 + "getFreeChainBuffer failed\n",
10045 ioc->name));
10046 }
10047 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
10048 @@ -216,7 +221,7 @@ mptscsih_AddSGE(MPT_ADAPTER *ioc, struct
10049 */
10050
10051 nextSGEset:
10052 - numSgeSlots = ((frm_sz - sgeOffset) / ioc->SGE_size );
10053 + numSgeSlots = ((frm_sz - sgeOffset) / ioc->SGE_size);
10054 numSgeThisFrame = (sges_left < numSgeSlots) ? sges_left : numSgeSlots;
10055
10056 sgflags = MPT_SGE_FLAGS_SIMPLE_ELEMENT | sgdir;
10057 @@ -265,7 +270,8 @@ nextSGEset:
10058 * Update the chain element
10059 * Offset and Length fields.
10060 */
10061 - ioc->add_chain((char *)chainSge, 0, sgeOffset, ioc->ChainBufferDMA + chain_dma_off);
10062 + ioc->add_chain((char *)chainSge, 0, sgeOffset,
10063 + ioc->ChainBufferDMA + chain_dma_off);
10064 } else {
10065 /* The current buffer is the original MF
10066 * and there is no Chain buffer.
10067 @@ -313,7 +319,8 @@ nextSGEset:
10068 */
10069 u8 nextChain = (u8) (sgeOffset >> 2);
10070 sgeOffset += ioc->SGE_size;
10071 - ioc->add_chain((char *)chainSge, nextChain, sgeOffset, ioc->ChainBufferDMA + chain_dma_off);
10072 + ioc->add_chain((char *)chainSge, nextChain, sgeOffset,
10073 + ioc->ChainBufferDMA + chain_dma_off);
10074 } else {
10075 /* The original MF buffer requires a chain buffer -
10076 * set the offset.
10077 @@ -392,7 +399,7 @@ mptscsih_issue_sep_command(MPT_ADAPTER *
10078
10079 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
10080 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!!\n",
10081 - ioc->name,__FUNCTION__));
10082 + ioc->name,__func__));
10083 return;
10084 }
10085
10086 @@ -525,9 +532,11 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, s
10087 scsi_print_command(sc);
10088 printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %d\n",
10089 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun);
10090 - printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, resid = %d\n",
10091 + printk(MYIOC_s_DEBUG_FMT
10092 + "\trequest_len = %d, underflow = %d, resid = %d\n",
10093 ioc->name, scsi_bufflen(sc), sc->underflow, scsi_get_resid(sc));
10094 - printk(MYIOC_s_DEBUG_FMT "\ttag = %d, transfer_count = %d, sc->result = %08X\n",
10095 + printk(MYIOC_s_DEBUG_FMT
10096 + "\ttag = %d, transfer_count = %d, sc->result = %08X\n",
10097 ioc->name, le16_to_cpu(pScsiReply->TaskTag),
10098 le32_to_cpu(pScsiReply->TransferCount), sc->result);
10099
10100 @@ -590,7 +599,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
10101 (le32_to_cpu(mf->u.frame.linkage.arg1) == 0xdeadbeaf)) {
10102 printk(MYIOC_s_WARN_FMT
10103 "Received a mf that was already freed\n", ioc->name);
10104 - printk (MYIOC_s_WARN_FMT
10105 + printk(MYIOC_s_WARN_FMT
10106 "req_idx=%x req_idx_MR=%x mf=%p mr=%p sc=%p\n",
10107 ioc->name, req_idx, req_idx_MR, mf, mr,
10108 mptscsih_get_scsi_lookup(ioc, req_idx_MR));
10109 @@ -715,11 +724,12 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
10110 }
10111 }
10112 } else if (ioc->bus_type == FC) {
10113 - /* The FC IOC may kill a request for variety of reasons,
10114 - some of which may be recovered by a retry, some which
10115 - are unlikely to be recovered. Return DID_ERROR instead
10116 - of DID_RESET to permit retry of the command, just not
10117 - an infinite number of them */
10118 + /* The FC IOC may kill a request for variety
10119 + * of reasons, some of which may be recovered
10120 + * by a retry, some which are unlikely to be
10121 + * recovered. Return DID_ERROR instead of
10122 + * DID_RESET to permit retry of the command,
10123 + * just not an infinite number of them */
10124 sc->result = DID_ERROR << 16;
10125 break;
10126 }
10127 @@ -735,7 +745,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
10128 sc->result = DID_RESET << 16;
10129
10130 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
10131 - if ( ioc->bus_type == FC )
10132 + if (ioc->bus_type == FC)
10133 sc->result = DID_ERROR << 16;
10134 else
10135 sc->result = DID_RESET << 16;
10136 @@ -1421,8 +1431,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, v
10137 */
10138 if (datalen == 0) {
10139 /* Add a NULL SGE */
10140 - ioc->add_sge((char *)&pScsiReq->SGL, MPT_SGE_FLAGS_SSIMPLE_READ | 0,
10141 - (dma_addr_t) -1);
10142 + ioc->add_sge((char *)&pScsiReq->SGL,
10143 + MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
10144 } else {
10145 /* Add a 32 or 64 bit SGE */
10146 if (mptscsih_AddSGE(ioc, SCpnt, pScsiReq, my_idx) != SUCCESS)
10147 @@ -1523,8 +1533,8 @@ mptscsih_scandv_bus_reset(MPT_ADAPTER *i
10148 /* Send request
10149 */
10150 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
10151 - dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt, no msg frames!!\n",
10152 - ioc->name));
10153 + dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
10154 + "TaskMgmt, no msg frames!!\n", ioc->name));
10155 mpt_clear_taskmgmt_in_progress_flag(ioc);
10156 retval = -ENOMEM;
10157 goto out;
10158 @@ -1544,26 +1554,27 @@ mptscsih_scandv_bus_reset(MPT_ADAPTER *i
10159 pScsiTm->Reserved = 0;
10160 pScsiTm->Reserved1 = 0;
10161 pScsiTm->TaskMsgContext = 0;
10162 - for (ii= 0; ii < 8; ii++)
10163 + for (ii = 0; ii < 8; ii++)
10164 pScsiTm->LUN[ii] = 0;
10165 - for (ii=0; ii < 7; ii++)
10166 + for (ii = 0; ii < 7; ii++)
10167 pScsiTm->Reserved2[ii] = 0;
10168
10169 switch (ioc->bus_type) {
10170 - case FC:
10171 - timeout = 40;
10172 - break;
10173 - case SAS:
10174 - timeout = 30;
10175 - break;
10176 - case SPI:
10177 - default:
10178 - timeout = 2;
10179 - break;
10180 + case FC:
10181 + timeout = 40;
10182 + break;
10183 + case SAS:
10184 + timeout = 30;
10185 + break;
10186 + case SPI:
10187 + default:
10188 + timeout = 10;
10189 + break;
10190 }
10191
10192 - dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt type=%d timeout=%ld\n",
10193 - ioc->name, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
10194 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10195 + "TaskMgmt type=%d timeout=%ld\n", ioc->name,
10196 + MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, timeout));
10197
10198 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
10199 CLEAR_MGMT_STATUS(ioc->internal_cmds.status)
10200 @@ -1576,7 +1587,8 @@ mptscsih_scandv_bus_reset(MPT_ADAPTER *i
10201 retval = mpt_send_handshake_request(ioc->TaskCtx, ioc,
10202 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
10203 if (retval != 0) {
10204 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt send_handshake FAILED!"
10205 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10206 + "TaskMgmt send_handshake FAILED!"
10207 " (ioc %p, mf %p, rc=%d) \n", ioc->name,
10208 ioc, mf, retval));
10209 mpt_clear_taskmgmt_in_progress_flag(ioc);
10210 @@ -1642,19 +1654,20 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int
10211 switch (reset_phase) {
10212 case MPT_IOC_SETUP_RESET:
10213 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10214 - "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __FUNCTION__));
10215 + "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
10216 break;
10217 case MPT_IOC_PRE_RESET:
10218 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10219 - "%s: MPT_IOC_PRE_RESET\n", ioc->name, __FUNCTION__));
10220 + "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
10221 hd = shost_priv(ioc->sh);
10222 mptscsih_flush_running_cmds(hd);
10223 break;
10224 case MPT_IOC_POST_RESET:
10225 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10226 - "%s: MPT_IOC_POST_RESET\n", ioc->name, __FUNCTION__));
10227 + "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
10228 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_PENDING) {
10229 - ioc->internal_cmds.status |= MPT_MGMT_STATUS_DID_IOCRESET;
10230 + ioc->internal_cmds.status
10231 + |= MPT_MGMT_STATUS_DID_IOCRESET;
10232 complete(&ioc->internal_cmds.done);
10233 }
10234 break;
10235 @@ -1700,7 +1713,8 @@ mptscsih_taskmgmt_response_code(MPT_ADAP
10236 }
10237
10238 static int
10239 -mptscsih_taskmgmt_reply(MPT_ADAPTER *ioc, u8 type, SCSITaskMgmtReply_t *pScsiTmReply)
10240 +mptscsih_taskmgmt_reply(MPT_ADAPTER *ioc, u8 type,
10241 + SCSITaskMgmtReply_t *pScsiTmReply)
10242 {
10243 u16 iocstatus;
10244 u32 termination_count;
10245 @@ -1764,7 +1778,8 @@ mptscsih_taskmgmt_reply(MPT_ADAPTER *ioc
10246 * Returns 1 indicating alloc'd request frame ptr should be freed.
10247 **/
10248 int
10249 -mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
10250 +mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf,
10251 + MPT_FRAME_HDR *mr)
10252 {
10253 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed (mf=%p, mr=%p)\n",
10254 ioc->name, mf, mr));
10255 @@ -1807,7 +1822,8 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *
10256 *
10257 **/
10258 int
10259 -mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout)
10260 +mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun,
10261 + int ctx2abort, ulong timeout)
10262 {
10263 MPT_FRAME_HDR *mf = NULL;
10264 SCSITaskMgmt_t *pScsiTm;
10265 @@ -1827,7 +1843,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10266 "TaskMgmt type=%x: IOC Not operational (0x%x)!\n",
10267 ioc->name, type, ioc_raw_state);
10268 printk(MYIOC_s_WARN_FMT "Issuing HardReset from %s!!\n",
10269 - ioc->name, __FUNCTION__);
10270 + ioc->name, __func__);
10271 if (mpt_HardResetHandler(ioc, CAN_SLEEP) < 0)
10272 printk(MYIOC_s_WARN_FMT "TaskMgmt HardReset "
10273 "FAILED!!\n", ioc->name);
10274 @@ -1844,7 +1860,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10275
10276 mutex_lock(&ioc->taskmgmt_cmds.mutex);
10277 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
10278 - mutex_unlock(&ioc->taskmgmt_cmds.mutex);
10279 + mutex_unlock(&ioc->taskmgmt_cmds.mutex);
10280 retval = FAILED;
10281 goto out;
10282 }
10283 @@ -1852,8 +1868,9 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10284 /* Return Fail to calling function if no message frames available.
10285 */
10286 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
10287 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt no msg frames!!\n",
10288 - ioc->name));
10289 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10290 + "TaskMgmt no msg frames!!\n",
10291 + ioc->name));
10292 retval = FAILED;
10293 mpt_clear_taskmgmt_in_progress_flag(ioc);
10294 goto out;
10295 @@ -1873,11 +1890,11 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10296 pScsiTm->TaskType = type;
10297 pScsiTm->Reserved1 = 0;
10298 pScsiTm->MsgFlags = (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS)
10299 - ? MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION : 0;
10300 + ? MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION : 0;
10301
10302 int_to_scsilun(lun, (struct scsi_lun *)pScsiTm->LUN);
10303
10304 - for (ii=0; ii < 7; ii++)
10305 + for (ii = 0; ii < 7; ii++)
10306 pScsiTm->Reserved2[ii] = 0;
10307
10308 pScsiTm->TaskMsgContext = ctx2abort;
10309 @@ -1895,17 +1912,19 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10310 mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf);
10311 else {
10312 retval = mpt_send_handshake_request(ioc->TaskCtx, ioc,
10313 - sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
10314 + sizeof(SCSITaskMgmt_t), (u32 *)pScsiTm, CAN_SLEEP);
10315 if (retval) {
10316 - dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "TaskMgmt handshake FAILED!"
10317 - " (mf=%p, rc=%d) \n", ioc->name, mf, retval));
10318 + dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
10319 + "TaskMgmt handshake FAILED!"
10320 + " (mf=%p, rc=%d) \n", ioc->name, mf, retval));
10321 mpt_free_msg_frame(ioc, mf);
10322 mpt_clear_taskmgmt_in_progress_flag(ioc);
10323 goto out;
10324 }
10325 }
10326
10327 - timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, timeout*HZ);
10328 + timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done,
10329 + timeout*HZ);
10330 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10331 retval = FAILED;
10332 dtmprintk(ioc, printk(MYIOC_s_ERR_FMT
10333 @@ -1927,9 +1946,9 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
10334 out:
10335
10336 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status)
10337 - if(issue_hard_reset) {
10338 + if (issue_hard_reset) {
10339 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
10340 - ioc->name, __FUNCTION__);
10341 + ioc->name, __func__);
10342 if ((retval = mpt_SoftResetHandler(ioc, CAN_SLEEP)) != 0)
10343 retval = mpt_HardResetHandler(ioc, CAN_SLEEP);
10344 mpt_free_msg_frame(ioc, mf);
10345 @@ -2037,7 +2056,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
10346 goto out;
10347 }
10348
10349 - if(mpt_fwfault_debug)
10350 + if (mpt_fwfault_debug)
10351 mpt_halt_firmware(ioc);
10352
10353 if (ioc->timeouts < -1)
10354 @@ -2075,7 +2094,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
10355
10356 out:
10357 printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
10358 - ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED" ), SCpnt);
10359 + ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), SCpnt);
10360
10361 return retval;
10362 }
10363 @@ -2306,7 +2325,7 @@ mptscsih_is_phys_disk(MPT_ADAPTER *ioc,
10364 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum);
10365 if (num_paths < 2)
10366 continue;
10367 - phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
10368 + phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
10369 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
10370 if (!phys_disk)
10371 continue;
10372 @@ -2339,14 +2358,14 @@ mptscsih_is_phys_disk(MPT_ADAPTER *ioc,
10373 if (list_empty(&ioc->raid_data.inactive_list))
10374 goto out;
10375
10376 - down(&ioc->raid_data.inactive_list_mutex);
10377 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
10378 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
10379 list) {
10380 if ((component_info->d.PhysDiskID == id) &&
10381 (component_info->d.PhysDiskBus == channel))
10382 rc = 1;
10383 }
10384 - up(&ioc->raid_data.inactive_list_mutex);
10385 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
10386
10387 out:
10388 return rc;
10389 @@ -2357,7 +2376,7 @@ u8
10390 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id)
10391 {
10392 struct inactive_raid_component_info *component_info;
10393 - int i,j;
10394 + int i, j;
10395 RaidPhysDiskPage1_t *phys_disk;
10396 int rc = -ENXIO;
10397 u8 num_paths;
10398 @@ -2384,7 +2403,7 @@ mptscsih_raid_id_to_num(MPT_ADAPTER *ioc
10399 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum);
10400 if (num_paths < 2)
10401 continue;
10402 - phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t,Path) +
10403 + phys_disk = kzalloc(offsetof(RaidPhysDiskPage1_t, Path) +
10404 (num_paths * sizeof(RAID_PHYS_DISK1_PATH)), GFP_KERNEL);
10405 if (!phys_disk)
10406 continue;
10407 @@ -2417,14 +2436,14 @@ mptscsih_raid_id_to_num(MPT_ADAPTER *ioc
10408 if (list_empty(&ioc->raid_data.inactive_list))
10409 goto out;
10410
10411 - down(&ioc->raid_data.inactive_list_mutex);
10412 + mutex_lock(&ioc->raid_data.inactive_list_mutex);
10413 list_for_each_entry(component_info, &ioc->raid_data.inactive_list,
10414 list) {
10415 if ((component_info->d.PhysDiskID == id) &&
10416 (component_info->d.PhysDiskBus == channel))
10417 rc = component_info->d.PhysDiskNum;
10418 }
10419 - up(&ioc->raid_data.inactive_list_mutex);
10420 + mutex_unlock(&ioc->raid_data.inactive_list_mutex);
10421
10422 out:
10423 return rc;
10424 @@ -2595,9 +2614,11 @@ mptscsih_copy_sense_data(struct scsi_cmn
10425
10426 ioc->eventContext++;
10427 if (ioc->pcidev->vendor == PCI_VENDOR_ID_IBM) {
10428 - mptscsih_issue_sep_command(ioc, vdevice->vtarget,
10429 + mptscsih_issue_sep_command(ioc,
10430 + vdevice->vtarget,
10431 MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT);
10432 - vdevice->vtarget->tflags |= MPT_TARGET_FLAGS_LED_ON;
10433 + vdevice->vtarget->tflags |=
10434 + MPT_TARGET_FLAGS_LED_ON;
10435 }
10436 }
10437 }
10438 @@ -2736,8 +2757,9 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10439 /* Get and Populate a free Frame
10440 */
10441 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
10442 - dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!\n",
10443 - ioc->name, __FUNCTION__));
10444 + dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT
10445 + "%s: no msg frames!\n",
10446 + ioc->name, __func__));
10447 ret = -EAGAIN;
10448 goto out;
10449 }
10450 @@ -2759,8 +2781,9 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10451 ioc->add_sge((char *)&pReq->ActionDataSGE,
10452 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
10453
10454 - ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
10455 - ioc->name, pReq->Action, channel, id));
10456 + ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10457 + "RAID Volume action=%x channel=%d id=%d\n",
10458 + ioc->name, pReq->Action, channel, id));
10459
10460 INITIALIZE_MGMT_STATUS(ioc->internal_cmds.status)
10461 mpt_put_msg_frame(ioc->InternalCtx, ioc, mf);
10462 @@ -2768,12 +2791,12 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10463 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10464 ret = -ETIME;
10465 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: TIMED OUT!\n",
10466 - ioc->name, __FUNCTION__));
10467 + ioc->name, __func__));
10468 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
10469 goto out;
10470 if (!timeleft) {
10471 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
10472 - ioc->name, __FUNCTION__);
10473 + ioc->name, __func__);
10474 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
10475 mpt_HardResetHandler(ioc, CAN_SLEEP);
10476 mpt_free_msg_frame(ioc, mf);
10477 @@ -2797,7 +2820,8 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd,
10478 *
10479 **/
10480 static int
10481 -mptscsih_get_completion_code(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
10482 +mptscsih_get_completion_code(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
10483 + MPT_FRAME_HDR *reply)
10484 {
10485 SCSIIOReply_t *pReply;
10486 MpiRaidActionReply_t *pr;
10487 @@ -2810,10 +2834,12 @@ mptscsih_get_completion_code(MPT_ADAPTER
10488 scsi_status = pReply->SCSIStatus;
10489
10490 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10491 - "IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh, IOCLogInfo=%08xh\n",
10492 - ioc->name, status, pReply->SCSIState, scsi_status, le32_to_cpu(pReply->IOCLogInfo)));
10493 + "IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh,"
10494 + " IOCLogInfo=%08xh\n",
10495 + ioc->name, status, pReply->SCSIState, scsi_status,
10496 + le32_to_cpu(pReply->IOCLogInfo)));
10497
10498 - switch(status) {
10499 + switch (status) {
10500
10501 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
10502 completion_code = MPT_SCANDV_SELECTION_TIMEOUT;
10503 @@ -2836,9 +2862,11 @@ mptscsih_get_completion_code(MPT_ADAPTER
10504 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */
10505 if (pReply->Function == MPI_FUNCTION_CONFIG) {
10506 completion_code = MPT_SCANDV_GOOD;
10507 - } else if (pReply->Function == MPI_FUNCTION_RAID_ACTION) {
10508 + } else if (pReply->Function ==
10509 + MPI_FUNCTION_RAID_ACTION) {
10510 pr = (MpiRaidActionReply_t *)reply;
10511 - if (le16_to_cpu(pr->ActionStatus) == MPI_RAID_ACTION_ASTATUS_SUCCESS)
10512 + if (le16_to_cpu(pr->ActionStatus) ==
10513 + MPI_RAID_ACTION_ASTATUS_SUCCESS)
10514 completion_code = MPT_SCANDV_GOOD;
10515 else
10516 completion_code = MPT_SCANDV_SOME_ERROR;
10517 @@ -2849,8 +2877,7 @@ mptscsih_get_completion_code(MPT_ADAPTER
10518 completion_code = MPT_SCANDV_ISSUE_SENSE;
10519 else
10520 completion_code = MPT_SCANDV_DID_RESET;
10521 - }
10522 - else if (pReply->SCSIState & MPI_SCSI_STATE_NO_SCSI_STATUS)
10523 + } else if (pReply->SCSIState & MPI_SCSI_STATE_NO_SCSI_STATUS)
10524 completion_code = MPT_SCANDV_DID_RESET;
10525 else if (pReply->SCSIState & MPI_SCSI_STATE_TERMINATED)
10526 completion_code = MPT_SCANDV_DID_RESET;
10527 @@ -2885,7 +2912,8 @@ mptscsih_get_completion_code(MPT_ADAPTER
10528 *
10529 **/
10530 int
10531 -mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
10532 +mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
10533 + MPT_FRAME_HDR *reply)
10534 {
10535 SCSIIORequest_t *pReq;
10536 SCSIIOReply_t *pReply;
10537 @@ -2965,7 +2993,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10538 if (ioc->ioc_reset_in_progress) {
10539 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
10540 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10541 - "%s: busy with host reset\n", ioc->name, __FUNCTION__));
10542 + "%s: busy with host reset\n", ioc->name, __func__));
10543 return MPT_SCANDV_BUSY;
10544 }
10545 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
10546 @@ -3091,7 +3119,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10547 */
10548 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
10549 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: No msg frames!\n",
10550 - ioc->name, __FUNCTION__));
10551 + ioc->name, __func__));
10552 ret = MPT_SCANDV_BUSY;
10553 goto out;
10554 }
10555 @@ -3128,11 +3156,11 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10556 if (cmd == REQUEST_SENSE) {
10557 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED);
10558 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10559 - "%s: Untagged! 0x%02x\n", ioc->name, __FUNCTION__, cmd));
10560 + "%s: Untagged! 0x%02x\n", ioc->name, __func__, cmd));
10561 }
10562
10563 for (ii = 0; ii < 16; ii++)
10564 - pScsiReq->CDB[ii] = CDB[ii];
10565 + pScsiReq->CDB[ii] = CDB[ii];
10566
10567 pScsiReq->DataLength = cpu_to_le32(io->size);
10568 pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma
10569 @@ -3140,7 +3168,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10570
10571 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10572 "%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%d\n",
10573 - ioc->name, __FUNCTION__, cmd, io->channel, io->id, io->lun));
10574 + ioc->name, __func__, cmd, io->channel, io->id, io->lun));
10575
10576 if (dir == MPI_SCSIIO_CONTROL_READ)
10577 ioc->add_sge((char *) &pScsiReq->SGL,
10578 @@ -3156,7 +3184,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10579 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10580 ret = MPT_SCANDV_DID_RESET;
10581 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10582 - "%s: TIMED OUT for cmd=0x%02x\n", ioc->name, __FUNCTION__,
10583 + "%s: TIMED OUT for cmd=0x%02x\n", ioc->name, __func__,
10584 cmd));
10585 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
10586 mpt_free_msg_frame(ioc, mf);
10587 @@ -3166,7 +3194,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10588 if (!mptscsih_scandv_bus_reset(ioc))
10589 goto out;
10590 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
10591 - ioc->name, __FUNCTION__);
10592 + ioc->name, __func__);
10593 if (mpt_SoftResetHandler(ioc, CAN_SLEEP) != 0)
10594 mpt_HardResetHandler(ioc, CAN_SLEEP);
10595 mpt_free_msg_frame(ioc, mf);
10596 @@ -3176,7 +3204,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10597
10598 ret = ioc->internal_cmds.completion_code;
10599 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: success, rc=0x%02x\n",
10600 - ioc->name, __FUNCTION__, ret));
10601 + ioc->name, __func__, ret));
10602
10603 out:
10604 CLEAR_MGMT_STATUS(ioc->internal_cmds.status)
10605 @@ -3195,7 +3223,8 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
10606 *
10607 */
10608 static void
10609 -mptscsih_synchronize_cache(struct scsi_device *sdev, MPT_SCSI_HOST *hd, VirtDevice *vdevice)
10610 +mptscsih_synchronize_cache(struct scsi_device *sdev, MPT_SCSI_HOST *hd,
10611 + VirtDevice *vdevice)
10612 {
10613 INTERNAL_CMD iocmd;
10614 MPT_ADAPTER *ioc = hd->ioc;
10615 @@ -3219,8 +3248,9 @@ mptscsih_synchronize_cache(struct scsi_d
10616 iocmd.id = vdevice->vtarget->id;
10617 iocmd.lun = vdevice->lun;
10618
10619 - sdev_printk(KERN_INFO, sdev, MYIOC_s_FMT "SYNCHRONIZE_CACHE: fw_channel %d,"
10620 - " fw_id %d\n", ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id);
10621 + sdev_printk(KERN_INFO, sdev, MYIOC_s_FMT
10622 + "SYNCHRONIZE_CACHE: fw_channel %d, fw_id %d\n",
10623 + ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id);
10624 mptscsih_do_cmd(hd, &iocmd);
10625 }
10626
10627 @@ -3408,7 +3438,8 @@ static DEVICE_ATTR(debug_level, S_IRUGO
10628 mptscsih_debug_level_show, mptscsih_debug_level_store);
10629
10630 static ssize_t
10631 -mptscsih_disable_hotplug_remove_show(struct device *dev, struct device_attribute *attr, char *buf)
10632 +mptscsih_disable_hotplug_remove_show(struct device *dev,
10633 + struct device_attribute *attr, char *buf)
10634 {
10635 struct Scsi_Host *host = class_to_shost(dev);
10636 MPT_SCSI_HOST *hd = shost_priv(host);
10637 @@ -3417,7 +3448,8 @@ mptscsih_disable_hotplug_remove_show(str
10638 return snprintf(buf, PAGE_SIZE, "%02xh\n", ioc->disable_hotplug_remove);
10639 }
10640 static ssize_t
10641 -mptscsih_disable_hotplug_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
10642 +mptscsih_disable_hotplug_remove_store(struct device *dev,
10643 + struct device_attribute *attr, const char *buf, size_t count)
10644 {
10645 struct Scsi_Host *host = class_to_shost(dev);
10646 MPT_SCSI_HOST *hd = shost_priv(host);
10647 @@ -3436,7 +3468,8 @@ mptscsih_disable_hotplug_remove_store(st
10648 return strlen(buf);
10649 }
10650 static DEVICE_ATTR(disable_hotplug_remove, S_IRUGO | S_IWUSR,
10651 - mptscsih_disable_hotplug_remove_show, mptscsih_disable_hotplug_remove_store);
10652 + mptscsih_disable_hotplug_remove_show,
10653 + mptscsih_disable_hotplug_remove_store);
10654
10655 struct device_attribute *mptscsih_host_attrs[] = {
10656 &dev_attr_version_fw,
10657 --- a/drivers/message/fusion/mptscsih.h
10658 +++ b/drivers/message/fusion/mptscsih.h
10659 @@ -129,11 +129,13 @@ extern int mptscsih_scandv_complete(MPT_
10660 extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
10661 extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
10662 extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
10663 -extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout);
10664 +extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
10665 + u8 id, int lun, int ctx2abort, ulong timeout);
10666 extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
10667 extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
10668 extern int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
10669 extern struct device_attribute *mptscsih_host_attrs[];
10670 -extern int mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id);
10671 +extern int mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel,
10672 + u8 id);
10673 extern struct scsi_cmnd * mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i);
10674 extern void mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code);
10675 --- a/drivers/message/fusion/mptspi.c
10676 +++ b/drivers/message/fusion/mptspi.c
10677 @@ -87,7 +87,8 @@ MODULE_PARM_DESC(mpt_saf_te, " Force ena
10678
10679 static int mpt_qas = MPTSCSIH_QAS;
10680 module_param(mpt_qas, int, 1);
10681 -MODULE_PARM_DESC(mpt_qas, " Quick Arbitration and Selection (QAS) enabled=1, disabled=0 (default=MPTSCSIH_QAS=1)");
10682 +MODULE_PARM_DESC(mpt_qas, " Quick Arbitration and Selection (QAS) enabled=1,"
10683 + " disabled= (default=MPTSCSIH_QAS=1)");
10684
10685 static void mptspi_write_offset(struct scsi_target *, int);
10686 static void mptspi_write_width(struct scsi_target *, int);
10687 @@ -240,7 +241,7 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST
10688 */
10689
10690 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10691 - "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id));
10692 + "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id));
10693 }
10694 }
10695
10696 @@ -314,7 +315,7 @@ mptspi_writeIOCPage4(MPT_SCSI_HOST *hd,
10697
10698 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
10699 "writeIOCPage4: MaxSEP=%d ActiveSEP=%d id=%d bus=%d\n",
10700 - ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel));
10701 + ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel));
10702
10703 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);
10704
10705 @@ -495,7 +496,7 @@ mptspi_print_write_nego(struct _MPT_SCSI
10706 ii & MPI_SCSIDEVPAGE0_NP_WR_FLOW ? "WRFLOW ": "",
10707 ii & MPI_SCSIDEVPAGE0_NP_RD_STRM ? "RDSTRM ": "",
10708 ii & MPI_SCSIDEVPAGE0_NP_RTI ? "RTI ": "",
10709 - ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP ": "");
10710 + ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP " : "");
10711 }
10712
10713 /**
10714 @@ -523,7 +524,7 @@ mptspi_print_read_nego(struct _MPT_SCSI_
10715 ii & MPI_SCSIDEVPAGE0_NP_WR_FLOW ? "WRFLOW ": "",
10716 ii & MPI_SCSIDEVPAGE0_NP_RD_STRM ? "RDSTRM ": "",
10717 ii & MPI_SCSIDEVPAGE0_NP_RTI ? "RTI ": "",
10718 - ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP ": "");
10719 + ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP " : "");
10720 }
10721
10722 static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
10723 @@ -822,8 +823,8 @@ static int mptspi_write_spi_device_pg1(s
10724
10725 pg1 = dma_alloc_coherent(&ioc->pcidev->dev, size, &pg1_dma, GFP_KERNEL);
10726 if (pg1 == NULL) {
10727 - starget_printk(KERN_ERR, starget,
10728 - MYIOC_s_FMT "dma_alloc_coherent for parameters failed\n", ioc->name);
10729 + starget_printk(KERN_ERR, starget, MYIOC_s_FMT
10730 + "dma_alloc_coherent for parameters failed\n", ioc->name);
10731 return -EINVAL;
10732 }
10733
10734 @@ -1071,12 +1072,12 @@ mpt_work_wrapper(struct work_struct *wor
10735 if(vtarget->id != disk)
10736 continue;
10737
10738 - starget_printk(KERN_INFO, vtarget->starget,
10739 - MYIOC_s_FMT "Integrated RAID requests DV of new device\n", ioc->name);
10740 + starget_printk(KERN_INFO, vtarget->starget, MYIOC_s_FMT
10741 + "Integrated RAID requests DV of new device\n", ioc->name);
10742 mptspi_dv_device(hd, sdev);
10743 }
10744 - shost_printk(KERN_INFO, shost,
10745 - MYIOC_s_FMT "Integrated RAID detects new device %d\n", ioc->name, disk);
10746 + shost_printk(KERN_INFO, shost, MYIOC_s_FMT
10747 + "Integrated RAID detects new device %d\n", ioc->name, disk);
10748 scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1);
10749 }
10750
10751 @@ -1087,8 +1088,8 @@ static void mpt_dv_raid(struct _MPT_SCSI
10752 MPT_ADAPTER *ioc = hd->ioc;
10753
10754 if (!wqw) {
10755 - shost_printk(KERN_ERR, ioc->sh,
10756 - MYIOC_s_FMT "Failed to act on RAID event for physical disk %d\n",
10757 + shost_printk(KERN_ERR, ioc->sh, MYIOC_s_FMT
10758 + "Failed to act on RAID event for physical disk %d\n",
10759 ioc->name, disk);
10760 return;
10761 }
10762 --- a/drivers/message/fusion/rejected_ioctls/diag_buffer.c
10763 +++ b/drivers/message/fusion/rejected_ioctls/diag_buffer.c
10764 @@ -4,19 +4,20 @@
10765 * Outputs: None.
10766 * Return: 0 if successful
10767 * -EFAULT if data unavailable
10768 - * -EBUSY if previous command timout and IOC reset is not complete.
10769 + * -EBUSY if previous command timout and IOC reset is not
10770 + * complete.
10771 * -ENODEV if no such device/adapter
10772 * -ETIME if timer expires
10773 * -ENOMEM if memory allocation error
10774 */
10775 static int
10776 -mptctl_register_diag_buffer (unsigned long arg)
10777 +mptctl_register_diag_buffer(unsigned long arg)
10778 {
10779 mpt_diag_register_t __user *uarg = (void __user *) arg;
10780 mpt_diag_register_t karg;
10781 MPT_ADAPTER *ioc;
10782 int iocnum, rc, ii;
10783 - void * request_data;
10784 + void *request_data;
10785 dma_addr_t request_data_dma;
10786 u32 request_data_sz;
10787 MPT_FRAME_HDR *mf;
10788 @@ -34,33 +35,35 @@ mptctl_register_diag_buffer (unsigned lo
10789 return -EFAULT;
10790 }
10791
10792 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
10793 - (ioc == NULL)) {
10794 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
10795 +
10796 + if ((iocnum < 0) || (ioc == NULL)) {
10797 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
10798 - __FILE__, __FUNCTION__, __LINE__, iocnum);
10799 + __FILE__, __func__, __LINE__, iocnum);
10800 return -ENODEV;
10801 }
10802
10803 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
10804 - __FUNCTION__));
10805 + __func__));
10806 buffer_type = karg.data.BufferType;
10807 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
10808 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
10809 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
10810 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
10811 return -ENODEV;
10812 }
10813
10814 if (ioc->DiagBuffer_Status[buffer_type] &
10815 MPT_DIAG_BUFFER_IS_REGISTERED) {
10816 printk(MYIOC_s_DEBUG_FMT "%s: already has a Registered "
10817 - "buffer for buffer_type=%x\n", ioc->name, __FUNCTION__,
10818 + "buffer for buffer_type=%x\n", ioc->name, __func__,
10819 buffer_type);
10820 return -EFAULT;
10821 }
10822
10823 /* Get a free request frame and save the message context.
10824 */
10825 - if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL)
10826 + mf = mpt_get_msg_frame(mptctl_id, ioc);
10827 + if (mf == NULL)
10828 return -EAGAIN;
10829
10830 request_data = ioc->DiagBuffer[buffer_type];
10831 @@ -85,7 +88,7 @@ mptctl_register_diag_buffer (unsigned lo
10832 if (request_data == NULL) {
10833 printk(MYIOC_s_DEBUG_FMT "%s: pci_alloc_consistent"
10834 " FAILED, (request_sz=%d)\n", ioc->name,
10835 - __FUNCTION__, request_data_sz);
10836 + __func__, request_data_sz);
10837 mpt_free_msg_frame(ioc, mf);
10838 return -EAGAIN;
10839 }
10840 @@ -137,7 +140,7 @@ mptctl_register_diag_buffer (unsigned lo
10841 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10842 rc = -ETIME;
10843 printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name,
10844 - __FUNCTION__);
10845 + __func__);
10846 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
10847 mpt_free_msg_frame(ioc, mf);
10848 goto out;
10849 @@ -150,7 +153,7 @@ mptctl_register_diag_buffer (unsigned lo
10850 /* process the completed Reply Message Frame */
10851 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
10852 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: status=%x\n",
10853 - ioc->name, __FUNCTION__, ioc->ioctl_cmds.status));
10854 + ioc->name, __func__, ioc->ioctl_cmds.status));
10855 rc = -EFAULT;
10856 goto out;
10857 }
10858 @@ -160,12 +163,13 @@ mptctl_register_diag_buffer (unsigned lo
10859 MPI_IOCSTATUS_SUCCESS) {
10860 if (diag_buffer_post_reply->MsgLength > 5)
10861 ioc->DataSize[buffer_type] =
10862 - le32_to_cpu(diag_buffer_post_reply->TransferLength);
10863 + le32_to_cpu
10864 + (diag_buffer_post_reply->TransferLength);
10865 ioc->DiagBuffer_Status[buffer_type] |=
10866 MPT_DIAG_BUFFER_IS_REGISTERED;
10867 } else {
10868 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: IOCStatus=%x "
10869 - "IOCLogInfo=%x\n", ioc->name, __FUNCTION__,
10870 + "IOCLogInfo=%x\n", ioc->name, __func__,
10871 diag_buffer_post_reply->IOCStatus,
10872 diag_buffer_post_reply->IOCLogInfo));
10873 rc = -EFAULT;
10874 @@ -187,18 +191,19 @@ mptctl_register_diag_buffer (unsigned lo
10875 * Outputs: None.
10876 * Return: 0 if successful
10877 * -EFAULT if data unavailable
10878 - * -EBUSY if previous command timout and IOC reset is not complete.
10879 + * -EBUSY if previous command timout and IOC reset is
10880 + * not complete.
10881 * -ENODEV if no such device/adapter
10882 * -ETIME if timer expires
10883 * -ENOMEM if memory allocation error
10884 */
10885 static int
10886 -mptctl_release_diag_buffer (unsigned long arg)
10887 +mptctl_release_diag_buffer(unsigned long arg)
10888 {
10889 mpt_diag_release_t __user *uarg = (void __user *) arg;
10890 mpt_diag_release_t karg;
10891 MPT_ADAPTER *ioc;
10892 - void * request_data;
10893 + void *request_data;
10894 int iocnum, rc;
10895 MPT_FRAME_HDR *mf;
10896 DiagReleaseRequest_t *diag_release;
10897 @@ -210,42 +215,42 @@ mptctl_release_diag_buffer (unsigned lon
10898 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_release_t))) {
10899 printk(KERN_ERR "%s@%d::%s - "
10900 "Unable to read in mpt_diag_release_t struct @ %p\n",
10901 - __FILE__, __LINE__, __FUNCTION__, uarg);
10902 + __FILE__, __LINE__, __func__, uarg);
10903 return -EFAULT;
10904 }
10905
10906 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
10907 - (ioc == NULL)) {
10908 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
10909 + if ((iocnum < 0) || (ioc == NULL)) {
10910 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
10911 - __FILE__, __FUNCTION__, __LINE__, iocnum);
10912 + __FILE__, __func__, __LINE__, iocnum);
10913 return -ENODEV;
10914 }
10915
10916 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
10917 - __FUNCTION__));
10918 + __func__));
10919 buffer_type = karg.data.UniqueId & 0x000000ff;
10920 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
10921 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
10922 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
10923 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
10924 return -ENODEV;
10925 }
10926
10927 if ((ioc->DiagBuffer_Status[buffer_type] &
10928 - MPT_DIAG_BUFFER_IS_REGISTERED) == 0 ) {
10929 + MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
10930 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x is not "
10931 - "registered\n", ioc->name, __FUNCTION__, buffer_type);
10932 + "registered\n", ioc->name, __func__, buffer_type);
10933 return -EFAULT;
10934 }
10935
10936 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
10937 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not registered\n",
10938 - ioc->name, __FUNCTION__, karg.data.UniqueId);
10939 + ioc->name, __func__, karg.data.UniqueId);
10940 return -EFAULT;
10941 }
10942
10943 if (ioc->DiagBuffer_Status[buffer_type] & MPT_DIAG_BUFFER_IS_RELEASED) {
10944 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x "
10945 - "is already released\n", ioc->name, __FUNCTION__,
10946 + "is already released\n", ioc->name, __func__,
10947 buffer_type));
10948 return rc;
10949 }
10950 @@ -254,13 +259,14 @@ mptctl_release_diag_buffer (unsigned lon
10951
10952 if (request_data == NULL) {
10953 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
10954 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
10955 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
10956 return -ENODEV;
10957 }
10958
10959 /* Get a free request frame and save the message context.
10960 */
10961 - if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL)
10962 + mf = mpt_get_msg_frame(mptctl_id, ioc);
10963 + if (mf == NULL)
10964 return -EAGAIN;
10965
10966 diag_release = (DiagReleaseRequest_t *)mf;
10967 @@ -281,7 +287,7 @@ mptctl_release_diag_buffer (unsigned lon
10968 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
10969 rc = -ETIME;
10970 printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name,
10971 - __FUNCTION__);
10972 + __func__);
10973 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
10974 mpt_free_msg_frame(ioc, mf);
10975 goto out;
10976 @@ -294,7 +300,7 @@ mptctl_release_diag_buffer (unsigned lon
10977 /* process the completed Reply Message Frame */
10978 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
10979 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: status=%x\n",
10980 - ioc->name, __FUNCTION__, ioc->ioctl_cmds.status));
10981 + ioc->name, __func__, ioc->ioctl_cmds.status));
10982 rc = -EFAULT;
10983 goto out;
10984 }
10985 @@ -304,7 +310,7 @@ mptctl_release_diag_buffer (unsigned lon
10986 MPI_IOCSTATUS_SUCCESS) {
10987 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: IOCStatus=%x "
10988 "IOCLogInfo=%x\n",
10989 - ioc->name, __FUNCTION__, diag_release_reply->IOCStatus,
10990 + ioc->name, __func__, diag_release_reply->IOCStatus,
10991 diag_release_reply->IOCLogInfo));
10992 rc = -EFAULT;
10993 } else
10994 @@ -324,19 +330,20 @@ mptctl_release_diag_buffer (unsigned lon
10995 * Outputs: None.
10996 * Return: 0 if successful
10997 * -EFAULT if data unavailable
10998 - * -EBUSY if previous command timout and IOC reset is not complete.
10999 + * -EBUSY if previous command timout and IOC reset is
11000 + * not complete.
11001 * -ENODEV if no such device/adapter
11002 * -ETIME if timer expires
11003 * -ENOMEM if memory allocation error
11004 */
11005 static int
11006 -mptctl_unregister_diag_buffer (unsigned long arg)
11007 +mptctl_unregister_diag_buffer(unsigned long arg)
11008 {
11009 mpt_diag_unregister_t __user *uarg = (void __user *) arg;
11010 mpt_diag_unregister_t karg;
11011 MPT_ADAPTER *ioc;
11012 int iocnum;
11013 - void * request_data;
11014 + void *request_data;
11015 dma_addr_t request_data_dma;
11016 u32 request_data_sz;
11017 u8 buffer_type;
11018 @@ -344,49 +351,48 @@ mptctl_unregister_diag_buffer (unsigned
11019 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_unregister_t))) {
11020 printk(KERN_ERR "%s@%d::%s - "
11021 "Unable to read in mpt_diag_unregister_t struct @ %p\n",
11022 - __FILE__, __LINE__, __FUNCTION__, uarg);
11023 + __FILE__, __LINE__, __func__, uarg);
11024 return -EFAULT;
11025 }
11026 -
11027 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
11028 - (ioc == NULL)) {
11029 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
11030 + if ((iocnum < 0) || (ioc == NULL)) {
11031 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
11032 - __FILE__, __FUNCTION__, __LINE__, iocnum);
11033 + __FILE__, __func__, __LINE__, iocnum);
11034 return -ENODEV;
11035 }
11036
11037 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
11038 - __FUNCTION__));
11039 + __func__));
11040 buffer_type = karg.data.UniqueId & 0x000000ff;
11041 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
11042 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
11043 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11044 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11045 return -ENODEV;
11046 }
11047
11048 if ((ioc->DiagBuffer_Status[buffer_type] &
11049 MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
11050 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x is not "
11051 - "registered\n", ioc->name, __FUNCTION__, buffer_type);
11052 + "registered\n", ioc->name, __func__, buffer_type);
11053 return -EFAULT;
11054 }
11055 if ((ioc->DiagBuffer_Status[buffer_type] &
11056 MPT_DIAG_BUFFER_IS_RELEASED) == 0) {
11057 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x has not been "
11058 - "released\n", ioc->name, __FUNCTION__, buffer_type);
11059 + "released\n", ioc->name, __func__, buffer_type);
11060 return -EFAULT;
11061 }
11062
11063 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
11064 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not registered\n",
11065 - ioc->name, __FUNCTION__, karg.data.UniqueId);
11066 + ioc->name, __func__, karg.data.UniqueId);
11067 return -EFAULT;
11068 }
11069
11070 request_data = ioc->DiagBuffer[buffer_type];
11071 if (!request_data) {
11072 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11073 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11074 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11075 return -ENODEV;
11076 }
11077
11078 @@ -405,18 +411,19 @@ mptctl_unregister_diag_buffer (unsigned
11079 * Outputs: None.
11080 * Return: 0 if successful
11081 * -EFAULT if data unavailable
11082 - * -EBUSY if previous command timout and IOC reset is not complete.
11083 + * -EBUSY if previous command timout and IOC reset
11084 + * is not complete.
11085 * -ENODEV if no such device/adapter
11086 * -ETIME if timer expires
11087 * -ENOMEM if memory allocation error
11088 */
11089 static int
11090 -mptctl_query_diag_buffer (unsigned long arg)
11091 +mptctl_query_diag_buffer(unsigned long arg)
11092 {
11093 mpt_diag_query_t __user *uarg = (void __user *)arg;
11094 mpt_diag_query_t karg;
11095 MPT_ADAPTER *ioc;
11096 - void * request_data;
11097 + void *request_data;
11098 int iocnum, ii, rc;
11099 u8 buffer_type;
11100
11101 @@ -424,38 +431,38 @@ mptctl_query_diag_buffer (unsigned long
11102 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_query_t))) {
11103 printk(KERN_ERR "%s@%d::%s - "
11104 "Unable to read in mpt_diag_query_t struct @ %p\n",
11105 - __FILE__, __LINE__, __FUNCTION__, uarg);
11106 + __FILE__, __LINE__, __func__, uarg);
11107 return -EFAULT;
11108 }
11109
11110 karg.data.Flags = 0;
11111 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
11112 - (ioc == NULL)) {
11113 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
11114 + if ((iocnum < 0) || (ioc == NULL)) {
11115 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
11116 - __FILE__, __FUNCTION__, __LINE__, iocnum);
11117 + __FILE__, __func__, __LINE__, iocnum);
11118 goto out;
11119 }
11120
11121 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
11122 - __FUNCTION__));
11123 + __func__));
11124 buffer_type = karg.data.BufferType;
11125 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
11126 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability for "
11127 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11128 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11129 goto out;
11130 }
11131
11132 if ((ioc->DiagBuffer_Status[buffer_type] &
11133 MPT_DIAG_BUFFER_IS_REGISTERED) == 0) {
11134 printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x is not "
11135 - "registered\n", ioc->name, __FUNCTION__, buffer_type);
11136 + "registered\n", ioc->name, __func__, buffer_type);
11137 goto out;
11138 }
11139
11140 if (karg.data.UniqueId & 0xffffff00) {
11141 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
11142 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not "
11143 - "registered\n", ioc->name, __FUNCTION__,
11144 + "registered\n", ioc->name, __func__,
11145 karg.data.UniqueId);
11146 goto out;
11147 }
11148 @@ -464,7 +471,7 @@ mptctl_query_diag_buffer (unsigned long
11149 request_data = ioc->DiagBuffer[buffer_type];
11150 if (!request_data) {
11151 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11152 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11153 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11154 goto out;
11155 }
11156
11157 @@ -490,7 +497,7 @@ mptctl_query_diag_buffer (unsigned long
11158 out:
11159 if (copy_to_user(uarg, &karg, sizeof(mpt_diag_query_t))) {
11160 printk(MYIOC_s_ERR_FMT "%s Unable to write mpt_diag_query_t "
11161 - "data @ %p\n", ioc->name, __FUNCTION__, uarg);
11162 + "data @ %p\n", ioc->name, __func__, uarg);
11163 return -EFAULT;
11164 }
11165 return rc;
11166 @@ -502,13 +509,14 @@ mptctl_query_diag_buffer (unsigned long
11167 * Outputs: None.
11168 * Return: 0 if successful
11169 * -EFAULT if data unavailable
11170 - * -EBUSY if previous command timout and IOC reset is not complete.
11171 + * -EBUSY if previous command timout and IOC reset
11172 + * is not complete.
11173 * -ENODEV if no such device/adapter
11174 * -ETIME if timer expires
11175 * -ENOMEM if memory allocation error
11176 */
11177 static int
11178 -mptctl_read_diag_buffer (unsigned long arg)
11179 +mptctl_read_diag_buffer(unsigned long arg)
11180 {
11181 mpt_diag_read_buffer_t __user *uarg = (void __user *) arg;
11182 mpt_diag_read_buffer_t karg;
11183 @@ -527,50 +535,49 @@ mptctl_read_diag_buffer (unsigned long a
11184 if (copy_from_user(&karg, uarg, sizeof(mpt_diag_read_buffer_t))) {
11185 printk(KERN_ERR "%s@%d::%s - "
11186 "Unable to read in mpt_diag_read_buffer_t struct @ %p\n",
11187 - __FILE__, __LINE__, __FUNCTION__, uarg);
11188 + __FILE__, __LINE__, __func__, uarg);
11189 return -EFAULT;
11190 }
11191 -
11192 - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
11193 - (ioc == NULL)) {
11194 + iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc);
11195 + if ((iocnum < 0) || (ioc == NULL)) {
11196 printk(KERN_ERR "%s::%s() @%d - ioc%d not found!\n",
11197 - __FILE__, __FUNCTION__, __LINE__, iocnum);
11198 + __FILE__, __func__, __LINE__, iocnum);
11199 return -ENODEV;
11200 }
11201
11202 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s enter.\n", ioc->name,
11203 - __FUNCTION__));
11204 + __func__));
11205 buffer_type = karg.data.UniqueId & 0x000000ff;
11206 if (!(ioc->facts.IOCCapabilities & MPT_DIAG_CAPABILITY(buffer_type))) {
11207 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have Capability "
11208 - "for buffer_type=%x\n", ioc->name, __FUNCTION__,
11209 + "for buffer_type=%x\n", ioc->name, __func__,
11210 buffer_type);
11211 return -EFAULT;
11212 }
11213
11214 if (karg.data.UniqueId != ioc->UniqueId[buffer_type]) {
11215 printk(MYIOC_s_DEBUG_FMT "%s: unique_id=%x is not registered\n",
11216 - ioc->name, __FUNCTION__, karg.data.UniqueId);
11217 + ioc->name, __func__, karg.data.UniqueId);
11218 return -EFAULT;
11219 }
11220
11221 request_data = ioc->DiagBuffer[buffer_type];
11222 if (!request_data) {
11223 printk(MYIOC_s_DEBUG_FMT "%s: doesn't have buffer for "
11224 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type);
11225 + "buffer_type=%x\n", ioc->name, __func__, buffer_type);
11226 return -EFAULT;
11227 }
11228
11229 diagData = (void *)(request_data + karg.data.StartingOffset);
11230 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: diagData=%p "
11231 - "request_data=%p StartingOffset=%x\n", ioc->name, __FUNCTION__,
11232 + "request_data=%p StartingOffset=%x\n", ioc->name, __func__,
11233 diagData, request_data, karg.data.StartingOffset));
11234
11235 if (copy_to_user((void __user *)&uarg->data.DiagnosticData[0],
11236 diagData, karg.data.BytesToRead)) {
11237 printk(MYIOC_s_ERR_FMT "%s: Unable to write "
11238 "mpt_diag_read_buffer_t data @ %p\n", ioc->name,
11239 - __FUNCTION__, diagData);
11240 + __func__, diagData);
11241 return -EFAULT;
11242 }
11243
11244 @@ -578,17 +585,18 @@ mptctl_read_diag_buffer (unsigned long a
11245 goto out;
11246
11247 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: Reregister "
11248 - "buffer_type=%x\n", ioc->name, __FUNCTION__, buffer_type));
11249 + "buffer_type=%x\n", ioc->name, __func__, buffer_type));
11250 if ((ioc->DiagBuffer_Status[buffer_type] &
11251 - MPT_DIAG_BUFFER_IS_RELEASED) == 0) {
11252 + MPT_DIAG_BUFFER_IS_RELEASED) == 0) {
11253 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: buffer_type=%x "
11254 - "is still registered\n", ioc->name, __FUNCTION__,
11255 + "is still registered\n", ioc->name, __func__,
11256 buffer_type));
11257 return rc;
11258 }
11259 /* Get a free request frame and save the message context.
11260 */
11261 - if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL)
11262 + mf = mpt_get_msg_frame(mptctl_id, ioc);
11263 + if (mf == NULL)
11264 return -EAGAIN;
11265
11266 diag_buffer_post_request = (DiagBufferPostRequest_t *)mf;
11267 @@ -602,7 +610,7 @@ mptctl_read_diag_buffer (unsigned long a
11268 diag_buffer_post_request->Reserved2 = 0;
11269 diag_buffer_post_request->Reserved3 = 0;
11270 diag_buffer_post_request->BufferAddress.High = 0;
11271 - if ( buffer_type == MPI_DIAG_BUF_TYPE_EXTENDED )
11272 + if (buffer_type == MPI_DIAG_BUF_TYPE_EXTENDED)
11273 diag_buffer_post_request->ExtendedType =
11274 cpu_to_le32(ioc->ExtendedType[buffer_type]);
11275 diag_buffer_post_request->BufferLength =
11276 @@ -627,7 +635,7 @@ mptctl_read_diag_buffer (unsigned long a
11277 if (!(ioc->ioctl_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
11278 rc = -ETIME;
11279 printk(MYIOC_s_WARN_FMT "%s: failed\n", ioc->name,
11280 - __FUNCTION__);
11281 + __func__);
11282 if (ioc->ioctl_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) {
11283 mpt_free_msg_frame(ioc, mf);
11284 goto out;
11285 @@ -640,7 +648,7 @@ mptctl_read_diag_buffer (unsigned long a
11286 /* process the completed Reply Message Frame */
11287 if ((ioc->ioctl_cmds.status & MPT_MGMT_STATUS_RF_VALID) == 0) {
11288 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: status=%x\n",
11289 - ioc->name, __FUNCTION__, ioc->ioctl_cmds.status));
11290 + ioc->name, __func__, ioc->ioctl_cmds.status));
11291 rc = -EFAULT;
11292 }
11293
11294 @@ -654,7 +662,7 @@ mptctl_read_diag_buffer (unsigned long a
11295 MPT_DIAG_BUFFER_IS_REGISTERED;
11296 } else {
11297 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: IOCStatus=%x "
11298 - "IOCLogInfo=%x\n", ioc->name, __FUNCTION__,
11299 + "IOCLogInfo=%x\n", ioc->name, __func__,
11300 diag_buffer_post_reply->IOCStatus,
11301 diag_buffer_post_reply->IOCLogInfo));
11302 rc = -EFAULT;
11303 --- a/drivers/message/fusion/rejected_ioctls/diag_buffer.h
11304 +++ b/drivers/message/fusion/rejected_ioctls/diag_buffer.h
11305 @@ -1,8 +1,13 @@
11306 -#define MPTDIAGREGISTER _IOWR(MPT_MAGIC_NUMBER,26,mpt_diag_register_t)
11307 -#define MPTDIAGRELEASE _IOWR(MPT_MAGIC_NUMBER,27,mpt_diag_release_t)
11308 -#define MPTDIAGUNREGISTER _IOWR(MPT_MAGIC_NUMBER,28,mpt_diag_unregister_t)
11309 -#define MPTDIAGQUERY _IOWR(MPT_MAGIC_NUMBER,29,mpt_diag_query_t)
11310 -#define MPTDIAGREADBUFFER _IOWR(MPT_MAGIC_NUMBER,30,mpt_diag_read_buffer_t)
11311 +#define MPTDIAGREGISTER \
11312 + _IOWR(MPT_MAGIC_NUMBER, 26, mpt_diag_register_t)
11313 +#define MPTDIAGRELEASE \
11314 + _IOWR(MPT_MAGIC_NUMBER, 27, mpt_diag_release_t)
11315 +#define MPTDIAGUNREGISTER \
11316 + _IOWR(MPT_MAGIC_NUMBER, 28, mpt_diag_unregister_t)
11317 +#define MPTDIAGQUERY \
11318 + _IOWR(MPT_MAGIC_NUMBER, 29, mpt_diag_query_t)
11319 +#define MPTDIAGREADBUFFER \
11320 + _IOWR(MPT_MAGIC_NUMBER, 30, mpt_diag_read_buffer_t)
11321
11322 #define MPI_FW_DIAG_IOCTL (0x80646961)
11323 #define MPI_FW_DIAG_TYPE_REGISTER (0x00000001)
11324 @@ -25,7 +30,8 @@
11325 #define MPI_FW_DIAG_ERROR_NO_BUFFER (0x00000013)
11326 #define MPI_FW_DIAG_ERROR_ALREADY_RELEASED (0x00000014)
11327
11328 -#define MPT_DIAG_CAPABILITY(bufftype) (MPI_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER << bufftype)
11329 +#define MPT_DIAG_CAPABILITY(bufftype) \
11330 + (MPI_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER << bufftype)
11331
11332 #define MPT_DIAG_BUFFER_IS_REGISTERED 1
11333 #define MPT_DIAG_BUFFER_IS_RELEASED 2