summaryrefslogtreecommitdiff
path: root/drivers/scsi/atari_scsi.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-10-10 07:46:52 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-09 01:29:47 +0300
commitabd12b09292cc87a75f7c3e3c3f2b12589560bb1 (patch)
treeca3e12de22a0ac603fe9bcc2891b0c9ee362e10d /drivers/scsi/atari_scsi.c
parentb223680da0627eccf38ba28453746ac7bee06342 (diff)
downloadlinux-abd12b09292cc87a75f7c3e3c3f2b12589560bb1.tar.xz
scsi: atari_scsi: Make device register accessors re-entrant
This patch fixes an old bug: accesses to device registers from the interrupt handler (after reselection, DMA completion etc.) could mess up a device register access elsewhere, if the latter takes place outside of an irq lock (during selection etc.). Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/atari_scsi.c')
-rw-r--r--drivers/scsi/atari_scsi.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index a59ad94ea52b..862f30c23ff0 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -670,14 +670,26 @@ static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value)
static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
{
- dma_wd.dma_mode_status= (u_short)(0x88 + reg);
- return (u_char)dma_wd.fdc_acces_seccount;
+ unsigned long flags;
+ unsigned char result;
+
+ reg += 0x88;
+ local_irq_save(flags);
+ dma_wd.dma_mode_status = (u_short)reg;
+ result = (u_char)dma_wd.fdc_acces_seccount;
+ local_irq_restore(flags);
+ return result;
}
static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
{
- dma_wd.dma_mode_status = (u_short)(0x88 + reg);
+ unsigned long flags;
+
+ reg += 0x88;
+ local_irq_save(flags);
+ dma_wd.dma_mode_status = (u_short)reg;
dma_wd.fdc_acces_seccount = (u_short)value;
+ local_irq_restore(flags);
}