diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2016-01-03 06:05:51 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-01-07 03:43:04 +0100 |
commit | 11d2f63b9cf5665ce9dc425236b326dd327c4aa3 (patch) | |
tree | 04598a1c4128a8ce1edc7ab482a0dd07f5d67da6 /drivers/scsi/NCR5380.h | |
parent | ncr5380: Remove redundant ICR_ARBITRATION_LOST test and eliminate FLAG_DTC3181E (diff) | |
download | linux-11d2f63b9cf5665ce9dc425236b326dd327c4aa3.tar.xz linux-11d2f63b9cf5665ce9dc425236b326dd327c4aa3.zip |
ncr5380: Change instance->host_lock to hostdata->lock
NCR5380.c presently uses the instance->host_lock spin lock. Convert this
to a new spin lock that protects the NCR5380_hostdata struct.
atari_NCR5380.c previously used local_irq_save/restore() rather than a
spin lock. Convert this to hostdata->lock in irq mode. For SMP platforms,
the interrupt handler now also acquires the spin lock.
This brings all locking in the two core drivers into agreement.
Adding this locking also means that a bunch of volatile qualifiers can be
removed from the members of the NCR5380_hostdata struct. This is done in
a subsequent patch.
Proper locking will allow the abort handler to locate a command being
aborted. This is presently impossible if the abort handler is invoked when
the command has been moved from a queue to a pointer on the stack. (If
eh_abort_handler can't determine whether a command has been completed
or is still being processed then it can't decide whether to return
success or failure.)
The hostdata spin lock is now held when calling NCR5380_select() and
NCR5380_information_transfer(). Where possible, the lock is dropped for
polling and PIO transfers.
Clean up the now-redundant SELECT_ENABLE_REG writes, that used to provide
limited mutual exclusion between information_transfer() and reselect().
Accessing hostdata->connected without data races means taking the lock;
cleanup these accesses.
The new spin lock falls away for m68k and other UP builds, so this should
have little impact there. In the SMP case the new lock should be
uncontested even when the SCSI bus is contested.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/NCR5380.h')
-rw-r--r-- | drivers/scsi/NCR5380.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index 96fced9e6064..aab360810c43 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h @@ -256,6 +256,7 @@ struct NCR5380_hostdata { volatile struct scsi_cmnd *connected; /* currently connected command */ volatile struct scsi_cmnd *issue_queue; /* waiting to be issued */ volatile struct scsi_cmnd *disconnected_queue; /* waiting for reconnect */ + spinlock_t lock; /* protects this struct */ int flags; struct scsi_eh_save ses; char info[256]; |