aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r--drivers/scsi/aacraid/commctrl.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 851a7e599c50..f8afa358b6b6 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -243,7 +243,6 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
243 * Search the list of AdapterFibContext addresses on the adapter 243 * Search the list of AdapterFibContext addresses on the adapter
244 * to be sure this is a valid address 244 * to be sure this is a valid address
245 */ 245 */
246 spin_lock_irqsave(&dev->fib_lock, flags);
247 entry = dev->fib_list.next; 246 entry = dev->fib_list.next;
248 fibctx = NULL; 247 fibctx = NULL;
249 248
@@ -252,25 +251,24 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
252 /* 251 /*
253 * Extract the AdapterFibContext from the Input parameters. 252 * Extract the AdapterFibContext from the Input parameters.
254 */ 253 */
255 if (fibctx->unique == f.fibctx) { /* We found a winner */ 254 if (fibctx->unique == f.fibctx) { /* We found a winner */
256 break; 255 break;
257 } 256 }
258 entry = entry->next; 257 entry = entry->next;
259 fibctx = NULL; 258 fibctx = NULL;
260 } 259 }
261 if (!fibctx) { 260 if (!fibctx) {
262 spin_unlock_irqrestore(&dev->fib_lock, flags);
263 dprintk ((KERN_INFO "Fib Context not found\n")); 261 dprintk ((KERN_INFO "Fib Context not found\n"));
264 return -EINVAL; 262 return -EINVAL;
265 } 263 }
266 264
267 if((fibctx->type != FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT) || 265 if((fibctx->type != FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT) ||
268 (fibctx->size != sizeof(struct aac_fib_context))) { 266 (fibctx->size != sizeof(struct aac_fib_context))) {
269 spin_unlock_irqrestore(&dev->fib_lock, flags);
270 dprintk ((KERN_INFO "Fib Context corrupt?\n")); 267 dprintk ((KERN_INFO "Fib Context corrupt?\n"));
271 return -EINVAL; 268 return -EINVAL;
272 } 269 }
273 status = 0; 270 status = 0;
271 spin_lock_irqsave(&dev->fib_lock, flags);
274 /* 272 /*
275 * If there are no fibs to send back, then either wait or return 273 * If there are no fibs to send back, then either wait or return
276 * -EAGAIN 274 * -EAGAIN
@@ -328,9 +326,7 @@ return_fib:
328int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) 326int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx)
329{ 327{
330 struct fib *fib; 328 struct fib *fib;
331 unsigned long flags;
332 329
333 spin_lock_irqsave(&dev->fib_lock, flags);
334 /* 330 /*
335 * First free any FIBs that have not been consumed. 331 * First free any FIBs that have not been consumed.
336 */ 332 */
@@ -353,7 +349,6 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx)
353 * Remove the Context from the AdapterFibContext List 349 * Remove the Context from the AdapterFibContext List
354 */ 350 */
355 list_del(&fibctx->next); 351 list_del(&fibctx->next);
356 spin_unlock_irqrestore(&dev->fib_lock, flags);
357 /* 352 /*
358 * Invalidate context 353 * Invalidate context
359 */ 354 */
@@ -419,8 +414,8 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
419 * @arg: ioctl arguments 414 * @arg: ioctl arguments
420 * 415 *
421 * This routine returns the driver version. 416 * This routine returns the driver version.
422 * Under Linux, there have been no version incompatibilities, so this is 417 * Under Linux, there have been no version incompatibilities, so this is
423 * simple! 418 * simple!
424 */ 419 */
425 420
426static int check_revision(struct aac_dev *dev, void __user *arg) 421static int check_revision(struct aac_dev *dev, void __user *arg)
@@ -468,7 +463,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
468 u32 data_dir; 463 u32 data_dir;
469 void __user *sg_user[32]; 464 void __user *sg_user[32];
470 void *sg_list[32]; 465 void *sg_list[32];
471 u32 sg_indx = 0; 466 u32 sg_indx = 0;
472 u32 byte_count = 0; 467 u32 byte_count = 0;
473 u32 actual_fibsize64, actual_fibsize = 0; 468 u32 actual_fibsize64, actual_fibsize = 0;
474 int i; 469 int i;
@@ -522,11 +517,11 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
522 // Fix up srb for endian and force some values 517 // Fix up srb for endian and force some values
523 518
524 srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this 519 srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this
525 srbcmd->channel = cpu_to_le32(user_srbcmd->channel); 520 srbcmd->channel = cpu_to_le32(user_srbcmd->channel);
526 srbcmd->id = cpu_to_le32(user_srbcmd->id); 521 srbcmd->id = cpu_to_le32(user_srbcmd->id);
527 srbcmd->lun = cpu_to_le32(user_srbcmd->lun); 522 srbcmd->lun = cpu_to_le32(user_srbcmd->lun);
528 srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout); 523 srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout);
529 srbcmd->flags = cpu_to_le32(flags); 524 srbcmd->flags = cpu_to_le32(flags);
530 srbcmd->retry_limit = 0; // Obsolete parameter 525 srbcmd->retry_limit = 0; // Obsolete parameter
531 srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); 526 srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size);
532 memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); 527 memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb));
@@ -791,9 +786,9 @@ static int aac_get_pci_info(struct aac_dev* dev, void __user *arg)
791 pci_info.bus = dev->pdev->bus->number; 786 pci_info.bus = dev->pdev->bus->number;
792 pci_info.slot = PCI_SLOT(dev->pdev->devfn); 787 pci_info.slot = PCI_SLOT(dev->pdev->devfn);
793 788
794 if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { 789 if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) {
795 dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); 790 dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n"));
796 return -EFAULT; 791 return -EFAULT;
797 } 792 }
798 return 0; 793 return 0;
799} 794}