Commit 20081964 authored by David Jeffery's avatar David Jeffery Committed by James Simmons

[PATCH] ips driver 4/6

This is by far the biggest patch.  It is a rewrite of the
driver's horrid locking.  In addition to the host_lock,
the driver used to have 4 other locks per adapter!
It had a redundant ha_lock and a lock for each of 3
queues.  In a few places it also played with atomic bit
setting. And almost all of it was useless as the
host_lock was already held.

This patch cleans up this locking nightmare.  The driver
now uses the host_lock exclusively.  Only a few places
needed to add calls to lock the host_lock.  Most of
this patch is deletion of useless extra locking.
parent d3c20327
This diff is collapsed.
...@@ -91,16 +91,6 @@ ...@@ -91,16 +91,6 @@
#define MDELAY mdelay #define MDELAY mdelay
#endif #endif
/*
* Lock macros
*/
#define IPS_SCB_LOCK(cpu_flags) spin_lock_irqsave(&ha->scb_lock, cpu_flags)
#define IPS_SCB_UNLOCK(cpu_flags) spin_unlock_irqrestore(&ha->scb_lock, cpu_flags)
#define IPS_QUEUE_LOCK(queue) spin_lock_irqsave(&(queue)->lock, (queue)->cpu_flags)
#define IPS_QUEUE_UNLOCK(queue) spin_unlock_irqrestore(&(queue)->lock, (queue)->cpu_flags)
#define IPS_HA_LOCK(cpu_flags) spin_lock_irqsave(&ha->ips_lock, cpu_flags)
#define IPS_HA_UNLOCK(cpu_flags) spin_unlock_irqrestore(&ha->ips_lock, cpu_flags)
/* /*
* Adapter address map equates * Adapter address map equates
*/ */
...@@ -1054,8 +1044,6 @@ typedef struct ips_scb_queue { ...@@ -1054,8 +1044,6 @@ typedef struct ips_scb_queue {
struct ips_scb *head; struct ips_scb *head;
struct ips_scb *tail; struct ips_scb *tail;
int count; int count;
unsigned long cpu_flags;
spinlock_t lock;
} ips_scb_queue_t; } ips_scb_queue_t;
/* /*
...@@ -1065,13 +1053,10 @@ typedef struct ips_wait_queue { ...@@ -1065,13 +1053,10 @@ typedef struct ips_wait_queue {
Scsi_Cmnd *head; Scsi_Cmnd *head;
Scsi_Cmnd *tail; Scsi_Cmnd *tail;
int count; int count;
unsigned long cpu_flags;
spinlock_t lock;
} ips_wait_queue_t; } ips_wait_queue_t;
typedef struct ips_copp_wait_item { typedef struct ips_copp_wait_item {
Scsi_Cmnd *scsi_cmd; Scsi_Cmnd *scsi_cmd;
struct semaphore *sem;
struct ips_copp_wait_item *next; struct ips_copp_wait_item *next;
} ips_copp_wait_item_t; } ips_copp_wait_item_t;
...@@ -1079,8 +1064,6 @@ typedef struct ips_copp_queue { ...@@ -1079,8 +1064,6 @@ typedef struct ips_copp_queue {
struct ips_copp_wait_item *head; struct ips_copp_wait_item *head;
struct ips_copp_wait_item *tail; struct ips_copp_wait_item *tail;
int count; int count;
unsigned long cpu_flags;
spinlock_t lock;
} ips_copp_queue_t; } ips_copp_queue_t;
/* forward decl for host structure */ /* forward decl for host structure */
...@@ -1129,7 +1112,6 @@ typedef struct ips_ha { ...@@ -1129,7 +1112,6 @@ typedef struct ips_ha {
char *ioctl_data; /* IOCTL data area */ char *ioctl_data; /* IOCTL data area */
uint32_t ioctl_datasize; /* IOCTL data size */ uint32_t ioctl_datasize; /* IOCTL data size */
uint32_t cmd_in_progress; /* Current command in progress*/ uint32_t cmd_in_progress; /* Current command in progress*/
unsigned long flags; /* HA flags */
uint8_t waitflag; /* are we waiting for cmd */ uint8_t waitflag; /* are we waiting for cmd */
uint8_t active; uint8_t active;
int ioctl_reset; /* IOCTL Requested Reset Flag */ int ioctl_reset; /* IOCTL Requested Reset Flag */
...@@ -1149,11 +1131,6 @@ typedef struct ips_ha { ...@@ -1149,11 +1131,6 @@ typedef struct ips_ha {
char *ioremap_ptr; /* ioremapped memory pointer */ char *ioremap_ptr; /* ioremapped memory pointer */
ips_hw_func_t func; /* hw function pointers */ ips_hw_func_t func; /* hw function pointers */
struct pci_dev *pcidev; /* PCI device handle */ struct pci_dev *pcidev; /* PCI device handle */
spinlock_t scb_lock;
spinlock_t copp_lock;
spinlock_t ips_lock;
struct semaphore ioctl_sem; /* Semaphore for new IOCTL's */
struct semaphore flash_ioctl_sem; /* Semaphore for Flashing */
char *flash_data; /* Save Area for flash data */ char *flash_data; /* Save Area for flash data */
u8 flash_order; /* Save Area for flash size order */ u8 flash_order; /* Save Area for flash size order */
u32 flash_datasize; /* Save Area for flash data size */ u32 flash_datasize; /* Save Area for flash data size */
...@@ -1186,7 +1163,6 @@ typedef struct ips_scb { ...@@ -1186,7 +1163,6 @@ typedef struct ips_scb {
Scsi_Cmnd *scsi_cmd; Scsi_Cmnd *scsi_cmd;
struct ips_scb *q_next; struct ips_scb *q_next;
ips_scb_callback callback; ips_scb_callback callback;
struct semaphore *sem;
uint32_t sg_busaddr; uint32_t sg_busaddr;
int sg_count; int sg_count;
} ips_scb_t; } ips_scb_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment