aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid/megaraid_mbox.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-10-31 15:06:02 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-11-06 13:51:32 -0500
commitf2c8dc402b939ddcb0299bb60227c47dc454c85a (patch)
tree541ba37d973d19495047a987f14e45a63febaa1e /drivers/scsi/megaraid/megaraid_mbox.c
parent3072c4abdd8c239a28085733adf3aaae94ad8fbe (diff)
[SCSI] megaraid_mbox: remove scsi_assign_lock usage
also remove the adapter->host_lock alias for adapter->lock and remove some superflous locking aswell as removing the tiny locking wrappers for the EH routines. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_mbox.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c81
1 files changed, 17 insertions, 64 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index c9e743ba09ec..670c7a44ab67 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -533,8 +533,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
533 533
534 // Initialize the synchronization lock for kernel and LLD 534 // Initialize the synchronization lock for kernel and LLD
535 spin_lock_init(&adapter->lock); 535 spin_lock_init(&adapter->lock);
536 adapter->host_lock = &adapter->lock;
537
538 536
539 // Initialize the command queues: the list of free SCBs and the list 537 // Initialize the command queues: the list of free SCBs and the list
540 // of pending SCBs. 538 // of pending SCBs.
@@ -715,9 +713,6 @@ megaraid_io_attach(adapter_t *adapter)
715 SCSIHOST2ADAP(host) = (caddr_t)adapter; 713 SCSIHOST2ADAP(host) = (caddr_t)adapter;
716 adapter->host = host; 714 adapter->host = host;
717 715
718 // export the parameters required by the mid-layer
719 scsi_assign_lock(host, adapter->host_lock);
720
721 host->irq = adapter->irq; 716 host->irq = adapter->irq;
722 host->unique_id = adapter->unique_id; 717 host->unique_id = adapter->unique_id;
723 host->can_queue = adapter->max_cmds; 718 host->can_queue = adapter->max_cmds;
@@ -1560,10 +1555,6 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
1560 scp->scsi_done = done; 1555 scp->scsi_done = done;
1561 scp->result = 0; 1556 scp->result = 0;
1562 1557
1563 assert_spin_locked(adapter->host_lock);
1564
1565 spin_unlock(adapter->host_lock);
1566
1567 /* 1558 /*
1568 * Allocate and build a SCB request 1559 * Allocate and build a SCB request
1569 * if_busy flag will be set if megaraid_mbox_build_cmd() command could 1560 * if_busy flag will be set if megaraid_mbox_build_cmd() command could
@@ -1573,23 +1564,16 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
1573 * return 0 in that case, and we would do the callback right away. 1564 * return 0 in that case, and we would do the callback right away.
1574 */ 1565 */
1575 if_busy = 0; 1566 if_busy = 0;
1576 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy); 1567 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy);
1577
1578 if (scb) {
1579 megaraid_mbox_runpendq(adapter, scb);
1580 }
1581
1582 spin_lock(adapter->host_lock);
1583
1584 if (!scb) { // command already completed 1568 if (!scb) { // command already completed
1585 done(scp); 1569 done(scp);
1586 return 0; 1570 return 0;
1587 } 1571 }
1588 1572
1573 megaraid_mbox_runpendq(adapter, scb);
1589 return if_busy; 1574 return if_busy;
1590} 1575}
1591 1576
1592
1593/** 1577/**
1594 * megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid 1578 * megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid
1595 * firmware lingua 1579 * firmware lingua
@@ -2546,9 +2530,7 @@ megaraid_mbox_dpc(unsigned long devp)
2546 megaraid_dealloc_scb(adapter, scb); 2530 megaraid_dealloc_scb(adapter, scb);
2547 2531
2548 // send the scsi packet back to kernel 2532 // send the scsi packet back to kernel
2549 spin_lock(adapter->host_lock);
2550 scp->scsi_done(scp); 2533 scp->scsi_done(scp);
2551 spin_unlock(adapter->host_lock);
2552 } 2534 }
2553 2535
2554 return; 2536 return;
@@ -2563,7 +2545,7 @@ megaraid_mbox_dpc(unsigned long devp)
2563 * aborted. All the commands issued to the F/W must complete. 2545 * aborted. All the commands issued to the F/W must complete.
2564 **/ 2546 **/
2565static int 2547static int
2566__megaraid_abort_handler(struct scsi_cmnd *scp) 2548megaraid_abort_handler(struct scsi_cmnd *scp)
2567{ 2549{
2568 adapter_t *adapter; 2550 adapter_t *adapter;
2569 mraid_device_t *raid_dev; 2551 mraid_device_t *raid_dev;
@@ -2577,8 +2559,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2577 adapter = SCP2ADAPTER(scp); 2559 adapter = SCP2ADAPTER(scp);
2578 raid_dev = ADAP2RAIDDEV(adapter); 2560 raid_dev = ADAP2RAIDDEV(adapter);
2579 2561
2580 assert_spin_locked(adapter->host_lock);
2581
2582 con_log(CL_ANN, (KERN_WARNING 2562 con_log(CL_ANN, (KERN_WARNING
2583 "megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n", 2563 "megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n",
2584 scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp), 2564 scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp),
@@ -2658,6 +2638,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2658 // traverse through the list of all SCB, since driver does not 2638 // traverse through the list of all SCB, since driver does not
2659 // maintain these SCBs on any list 2639 // maintain these SCBs on any list
2660 found = 0; 2640 found = 0;
2641 spin_lock_irq(&adapter->lock);
2661 for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) { 2642 for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
2662 scb = adapter->kscb_list + i; 2643 scb = adapter->kscb_list + i;
2663 2644
@@ -2680,6 +2661,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2680 } 2661 }
2681 } 2662 }
2682 } 2663 }
2664 spin_unlock_irq(&adapter->lock);
2683 2665
2684 if (!found) { 2666 if (!found) {
2685 con_log(CL_ANN, (KERN_WARNING 2667 con_log(CL_ANN, (KERN_WARNING
@@ -2696,22 +2678,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
2696 return FAILED; 2678 return FAILED;
2697} 2679}
2698 2680
2699static int
2700megaraid_abort_handler(struct scsi_cmnd *scp)
2701{
2702 adapter_t *adapter;
2703 int rc;
2704
2705 adapter = SCP2ADAPTER(scp);
2706
2707 spin_lock_irq(adapter->host_lock);
2708 rc = __megaraid_abort_handler(scp);
2709 spin_unlock_irq(adapter->host_lock);
2710
2711 return rc;
2712}
2713
2714
2715/** 2681/**
2716 * megaraid_reset_handler - device reset hadler for mailbox based driver 2682 * megaraid_reset_handler - device reset hadler for mailbox based driver
2717 * @scp : reference command 2683 * @scp : reference command
@@ -2723,7 +2689,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
2723 * host 2689 * host
2724 **/ 2690 **/
2725static int 2691static int
2726__megaraid_reset_handler(struct scsi_cmnd *scp) 2692megaraid_reset_handler(struct scsi_cmnd *scp)
2727{ 2693{
2728 adapter_t *adapter; 2694 adapter_t *adapter;
2729 scb_t *scb; 2695 scb_t *scb;
@@ -2739,10 +2705,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2739 adapter = SCP2ADAPTER(scp); 2705 adapter = SCP2ADAPTER(scp);
2740 raid_dev = ADAP2RAIDDEV(adapter); 2706 raid_dev = ADAP2RAIDDEV(adapter);
2741 2707
2742 assert_spin_locked(adapter->host_lock);
2743
2744 con_log(CL_ANN, (KERN_WARNING "megaraid: reseting the host...\n"));
2745
2746 // return failure if adapter is not responding 2708 // return failure if adapter is not responding
2747 if (raid_dev->hw_error) { 2709 if (raid_dev->hw_error) {
2748 con_log(CL_ANN, (KERN_NOTICE 2710 con_log(CL_ANN, (KERN_NOTICE
@@ -2779,8 +2741,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2779 adapter->outstanding_cmds, MBOX_RESET_WAIT)); 2741 adapter->outstanding_cmds, MBOX_RESET_WAIT));
2780 } 2742 }
2781 2743
2782 spin_unlock(adapter->host_lock);
2783
2784 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; 2744 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
2785 2745
2786 recovering = adapter->outstanding_cmds; 2746 recovering = adapter->outstanding_cmds;
@@ -2806,7 +2766,7 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2806 msleep(1000); 2766 msleep(1000);
2807 } 2767 }
2808 2768
2809 spin_lock(adapter->host_lock); 2769 spin_lock(&adapter->lock);
2810 2770
2811 // If still outstanding commands, bail out 2771 // If still outstanding commands, bail out
2812 if (adapter->outstanding_cmds) { 2772 if (adapter->outstanding_cmds) {
@@ -2815,7 +2775,8 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2815 2775
2816 raid_dev->hw_error = 1; 2776 raid_dev->hw_error = 1;
2817 2777
2818 return FAILED; 2778 rval = FAILED;
2779 goto out;
2819 } 2780 }
2820 else { 2781 else {
2821 con_log(CL_ANN, (KERN_NOTICE 2782 con_log(CL_ANN, (KERN_NOTICE
@@ -2824,7 +2785,10 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2824 2785
2825 2786
2826 // If the controller supports clustering, reset reservations 2787 // If the controller supports clustering, reset reservations
2827 if (!adapter->ha) return SUCCESS; 2788 if (!adapter->ha) {
2789 rval = SUCCESS;
2790 goto out;
2791 }
2828 2792
2829 // clear reservations if any 2793 // clear reservations if any
2830 raw_mbox[0] = CLUSTER_CMD; 2794 raw_mbox[0] = CLUSTER_CMD;
@@ -2841,22 +2805,11 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
2841 "megaraid: reservation reset failed\n")); 2805 "megaraid: reservation reset failed\n"));
2842 } 2806 }
2843 2807
2808 out:
2809 spin_unlock_irq(&adapter->lock);
2844 return rval; 2810 return rval;
2845} 2811}
2846 2812
2847static int
2848megaraid_reset_handler(struct scsi_cmnd *cmd)
2849{
2850 int rc;
2851
2852 spin_lock_irq(cmd->device->host->host_lock);
2853 rc = __megaraid_reset_handler(cmd);
2854 spin_unlock_irq(cmd->device->host->host_lock);
2855
2856 return rc;
2857}
2858
2859
2860/* 2813/*
2861 * START: internal commands library 2814 * START: internal commands library
2862 * 2815 *
@@ -3776,9 +3729,9 @@ wait_till_fw_empty(adapter_t *adapter)
3776 /* 3729 /*
3777 * Set the quiescent flag to stop issuing cmds to FW. 3730 * Set the quiescent flag to stop issuing cmds to FW.
3778 */ 3731 */
3779 spin_lock_irqsave(adapter->host_lock, flags); 3732 spin_lock_irqsave(&adapter->lock, flags);
3780 adapter->quiescent++; 3733 adapter->quiescent++;
3781 spin_unlock_irqrestore(adapter->host_lock, flags); 3734 spin_unlock_irqrestore(&adapter->lock, flags);
3782 3735
3783 /* 3736 /*
3784 * Wait till there are no more cmds outstanding at FW. Try for at most 3737 * Wait till there are no more cmds outstanding at FW. Try for at most