Commit abd12b09 authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen

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: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b223680d
...@@ -670,14 +670,26 @@ static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value) ...@@ -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) static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
{ {
dma_wd.dma_mode_status= (u_short)(0x88 + reg); unsigned long flags;
return (u_char)dma_wd.fdc_acces_seccount; 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) 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; dma_wd.fdc_acces_seccount = (u_short)value;
local_irq_restore(flags);
} }
......
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