esp_scsi: read status registers
authorHannes Reinecke <hare@suse.de>
Mon, 24 Nov 2014 14:37:23 +0000 (15:37 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 24 Nov 2014 15:10:24 +0000 (16:10 +0100)
A read to ESP_INTRPT will clear ESP_STATUS and ESP_SSTEP. So read
all status registers in one go to avoid losing information.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/esp_scsi.c

index 800ff3ea501d69efee463164d672520888f87639..7ebf2c7d17a4c3eb73c7aabe94c026aaba6bdd89 100644 (file)
@@ -982,7 +982,6 @@ static int esp_check_spur_intr(struct esp *esp)
 
        default:
                if (!(esp->sreg & ESP_STAT_INTR)) {
-                       esp->ireg = esp_read8(ESP_INTRPT);
                        if (esp->ireg & ESP_INTR_SR)
                                return 1;
 
@@ -2056,7 +2055,12 @@ static void __esp_interrupt(struct esp *esp)
        int finish_reset, intr_done;
        u8 phase;
 
+       /*
+       * Once INTRPT is read STATUS and SSTEP are cleared.
+       */
        esp->sreg = esp_read8(ESP_STATUS);
+       esp->seqreg = esp_read8(ESP_SSTEP);
+       esp->ireg = esp_read8(ESP_INTRPT);
 
        if (esp->flags & ESP_FLAG_RESETTING) {
                finish_reset = 1;
@@ -2069,8 +2073,6 @@ static void __esp_interrupt(struct esp *esp)
                        return;
        }
 
-       esp->ireg = esp_read8(ESP_INTRPT);
-
        if (esp->ireg & ESP_INTR_SR)
                finish_reset = 1;