Commit a04d620c authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k block local_irq*() updates

Convert m68k block drivers to new local_irq*() framework:
  - Atari ACSI
  - Amiga floppy
  - Atari floppy
  - Macintosh IIfx/Quadra 900/Quadra 950 floppy
parent f95ae0b0
......@@ -493,8 +493,7 @@ static int acsicmd_dma( const char *cmd, char *buffer, int blocks, int rwflag, i
acsi_delay_end(COMMAND_DELAY);
DISABLE_IRQ();
save_flags(flags);
cli();
local_irq_save(flags);
/* Low on A1 */
dma_wd.dma_mode_status = 0x88 | rwflag;
MFPDELAY();
......@@ -511,7 +510,7 @@ static int acsicmd_dma( const char *cmd, char *buffer, int blocks, int rwflag, i
else
dma_wd.dma_hi = (unsigned char)paddr;
MFPDELAY();
restore_flags(flags);
local_irq_restore(flags);
/* send the command bytes except the last */
for( i = 0; i < 5; ++i ) {
......
......@@ -500,12 +500,11 @@ static void slm_test_ready( unsigned long dummy )
int did_wait = 0;
#endif
save_flags(flags);
cli();
local_irq_save(flags);
addr = get_dma_addr();
if ((d = SLMEndAddr - addr) > 0) {
restore_flags(flags);
local_irq_restore(flags);
/* slice not yet finished, decide whether to start another timer or to
* busy-wait */
......@@ -523,7 +522,7 @@ static void slm_test_ready( unsigned long dummy )
do_gettimeofday( &start_tm );
did_wait = 1;
#endif
cli();
local_irq_disable();
while( get_dma_addr() < SLMEndAddr )
barrier();
}
......@@ -547,7 +546,7 @@ static void slm_test_ready( unsigned long dummy )
DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 );
#endif
restore_flags(flags);
local_irq_restore(flags);
#ifdef DEBUG
if (did_wait) {
......@@ -586,8 +585,7 @@ static void set_dma_addr( unsigned long paddr )
{ unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
dma_wd.dma_lo = (unsigned char)paddr;
paddr >>= 8;
MFPDELAY();
......@@ -599,7 +597,7 @@ static void set_dma_addr( unsigned long paddr )
else
dma_wd.dma_hi = (unsigned char)paddr;
MFPDELAY();
restore_flags(flags);
local_irq_restore(flags);
}
......
......@@ -228,12 +228,11 @@ static void ms_delay(int ms)
unsigned long flags;
int ticks;
if (ms > 0) {
save_flags(flags);
cli();
local_irq_save(flags);
while (ms_busy == 0)
sleep_on(&ms_wait);
ms_busy = 0;
restore_flags(flags);
local_irq_restore(flags);
ticks = MS_TICKS*ms-1;
ciaa.tblo=ticks%256;
ciaa.tbhi=ticks/256;
......@@ -259,13 +258,12 @@ static void get_fdc(int drive)
#ifdef DEBUG
printk("get_fdc: drive %d fdc_busy %d fdc_nested %d\n",drive,fdc_busy,fdc_nested);
#endif
save_flags(flags);
cli();
local_irq_save(flags);
while (!try_fdc(drive))
sleep_on(&fdc_wait);
fdc_busy = drive;
fdc_nested++;
restore_flags(flags);
local_irq_restore(flags);
}
static inline void rel_fdc(void)
......@@ -321,8 +319,7 @@ static void fd_deselect (int drive)
}
get_fdc(drive);
save_flags (flags);
cli();
local_irq_save(flags);
selected = -1;
......@@ -330,7 +327,7 @@ static void fd_deselect (int drive)
prb |= (SELMASK(0)|SELMASK(1)|SELMASK(2)|SELMASK(3));
ciab.prb = prb;
restore_flags (flags);
local_irq_restore (flags);
rel_fdc();
}
......@@ -1305,10 +1302,9 @@ static int non_int_flush_track (unsigned long nr)
rel_fdc();
return 0;
}
save_flags(flags);
cli();
local_irq_save(flags);
if (writepending != 2) {
restore_flags(flags);
local_irq_restore(flags);
(*unit[nr].dtype->write_fkt)(nr);
if (!raw_write(nr)) {
printk (KERN_NOTICE "floppy disk write protected "
......@@ -1320,7 +1316,7 @@ static int non_int_flush_track (unsigned long nr)
sleep_on (&wait_fd_block);
}
else {
restore_flags(flags);
local_irq_restore(flags);
ms_delay(2); /* 2 ms post_write delay */
post_write(nr);
}
......@@ -1428,8 +1424,7 @@ static void redo_fd_request(void)
* setup a callback to write the track buffer
* after a short (1 tick) delay.
*/
save_flags (flags);
cli();
local_irq_save(flags);
floppy->dirty = 1;
/* reset the timer */
......@@ -1437,7 +1432,7 @@ static void redo_fd_request(void)
flush_track_timer[drive].expires = jiffies + 1;
add_timer (flush_track_timer + drive);
restore_flags (flags);
local_irq_restore(flags);
break;
}
}
......@@ -1606,15 +1601,14 @@ static int floppy_open(struct inode *inode, struct file *filp)
}
}
save_flags(flags);
cli();
local_irq_save(flags);
fd_ref[drive]++;
fd_device[drive] = system;
#ifdef MODULE
if (unit[drive].motor == 0)
MOD_INC_USE_COUNT;
#endif
restore_flags(flags);
local_irq_restore(flags);
if (old_dev != system)
invalidate_buffers(mk_kdev(FLOPPY_MAJOR, drive + (system << 2)));
......
......@@ -248,24 +248,24 @@ static struct atari_floppy_struct {
#define FDC_READ(reg) ({ \
/* unsigned long __flags; */ \
unsigned short __val; \
/* save_flags(__flags); cli(); */ \
/* local_irq_save(__flags); */ \
dma_wd.dma_mode_status = 0x80 | (reg); \
udelay(25); \
__val = dma_wd.fdc_acces_seccount; \
MFPDELAY(); \
/* restore_flags(__flags); */ \
/* local_irq_restore(__flags); */ \
__val & 0xff; \
})
#define FDC_WRITE(reg,val) \
do { \
/* unsigned long __flags; */ \
/* save_flags(__flags); cli(); */ \
/* local_irq_save(__flags); */ \
dma_wd.dma_mode_status = 0x80 | (reg); \
udelay(25); \
dma_wd.fdc_acces_seccount = (val); \
MFPDELAY(); \
/* restore_flags(__flags); */ \
/* local_irq_restore(__flags); */ \
} while(0)
......@@ -434,14 +434,14 @@ static void fd_select_side( int side )
{
unsigned long flags;
save_flags(flags);
cli(); /* protect against various other ints mucking around with the PSG */
/* protect against various other ints mucking around with the PSG */
local_irq_save(flags);
sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
sound_ym.wd_data = (side == 0) ? sound_ym.rd_data_reg_sel | 0x01 :
sound_ym.rd_data_reg_sel & 0xfe;
restore_flags(flags);
local_irq_restore(flags);
}
......@@ -457,13 +457,13 @@ static void fd_select_drive( int drive )
if (drive == SelectedDrive)
return;
save_flags(flags);
cli(); /* protect against various other ints mucking around with the PSG */
/* protect against various other ints mucking around with the PSG */
local_irq_save(flags);
sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
tmp = sound_ym.rd_data_reg_sel;
sound_ym.wd_data = (tmp | DSKDRVNONE) & ~(drive == 0 ? DSKDRV0 : DSKDRV1);
atari_dont_touch_floppy_select = 1;
restore_flags(flags);
local_irq_restore(flags);
/* restore track register to saved value */
FDC_WRITE( FDCREG_TRACK, UD.track );
......@@ -484,8 +484,8 @@ static void fd_deselect( void )
{
unsigned long flags;
save_flags(flags);
cli(); /* protect against various other ints mucking around with the PSG */
/* protect against various other ints mucking around with the PSG */
local_irq_save(flags);
atari_dont_touch_floppy_select = 0;
sound_ym.rd_data_reg_sel=14; /* Select PSG Port A */
sound_ym.wd_data = (sound_ym.rd_data_reg_sel |
......@@ -493,7 +493,7 @@ static void fd_deselect( void )
/* On Falcon, the drive B select line is used on the printer port, so
* leave it alone... */
SelectedDrive = -1;
restore_flags(flags);
local_irq_restore(flags);
}
......@@ -549,8 +549,8 @@ static void check_change( unsigned long dummy )
if (++drive > 1 || !UD.connected)
drive = 0;
save_flags(flags);
cli(); /* protect against various other ints mucking around with the PSG */
/* protect against various other ints mucking around with the PSG */
local_irq_save(flags);
if (!stdma_islocked()) {
sound_ym.rd_data_reg_sel = 14;
......@@ -566,7 +566,7 @@ static void check_change( unsigned long dummy )
set_bit (drive, &changed_floppies);
}
}
restore_flags(flags);
local_irq_restore(flags);
start_check_change_timer();
}
......@@ -666,13 +666,12 @@ static int do_format(kdev_t device, struct atari_format_descr *desc)
DPRINT(("do_format( dr=%d tr=%d he=%d offs=%d )\n",
drive, desc->track, desc->head, desc->sect_offset ));
save_flags(flags);
cli();
local_irq_save(flags);
while( fdc_busy ) sleep_on( &fdc_wait );
fdc_busy = 1;
stdma_lock(floppy_irq, NULL);
atari_turnon_irq( IRQ_MFP_FDC ); /* should be already, just to be sure */
restore_flags(flags);
local_irq_restore(flags);
type = minor(device) >> 2;
if (type) {
......@@ -930,8 +929,7 @@ static void fd_rwsec( void )
udelay(25);
/* Setup DMA */
save_flags(flags);
cli();
local_irq_save(flags);
dma_wd.dma_lo = (unsigned char)paddr;
MFPDELAY();
paddr >>= 8;
......@@ -943,7 +941,7 @@ static void fd_rwsec( void )
else
dma_wd.dma_hi = (unsigned char)paddr;
MFPDELAY();
restore_flags(flags);
local_irq_restore(flags);
/* Clear FIFO and switch DMA to correct mode */
dma_wd.dma_mode_status = 0x90 | rwflag;
......@@ -990,8 +988,7 @@ static void fd_readtrack_check( unsigned long dummy )
{
unsigned long flags, addr, addr2;
save_flags(flags);
cli();
local_irq_save(flags);
if (!MultReadInProgress) {
/* This prevents a race condition that could arise if the
......@@ -1000,7 +997,7 @@ static void fd_readtrack_check( unsigned long dummy )
* already cleared 'MultReadInProgress' when flow of control
* gets here.
*/
restore_flags(flags);
local_irq_restore(flags);
return;
}
......@@ -1026,7 +1023,7 @@ static void fd_readtrack_check( unsigned long dummy )
*/
SET_IRQ_HANDLER( NULL );
MultReadInProgress = 0;
restore_flags(flags);
local_irq_restore(flags);
DPRINT(("fd_readtrack_check(): done\n"));
FDC_WRITE( FDCREG_CMD, FDCCMD_FORCI );
udelay(25);
......@@ -1038,7 +1035,7 @@ static void fd_readtrack_check( unsigned long dummy )
}
else {
/* not yet finished, wait another tenth rotation */
restore_flags(flags);
local_irq_restore(flags);
DPRINT(("fd_readtrack_check(): not yet finished\n"));
mod_timer(&readtrack_timer, jiffies + HZ/5/10);
}
......@@ -1199,8 +1196,7 @@ static void fd_writetrack( void )
udelay(40);
/* Setup DMA */
save_flags(flags);
cli();
local_irq_save(flags);
dma_wd.dma_lo = (unsigned char)paddr;
MFPDELAY();
paddr >>= 8;
......@@ -1212,7 +1208,7 @@ static void fd_writetrack( void )
else
dma_wd.dma_hi = (unsigned char)paddr;
MFPDELAY();
restore_flags(flags);
local_irq_restore(flags);
/* Clear FIFO and switch DMA to correct mode */
dma_wd.dma_mode_status = 0x190;
......@@ -1325,12 +1321,11 @@ static void finish_fdc_done( int dummy )
start_check_change_timer();
start_motor_off_timer();
save_flags(flags);
cli();
local_irq_save(flags);
stdma_release();
fdc_busy = 0;
wake_up( &fdc_wait );
restore_flags(flags);
local_irq_restore(flags);
DPRINT(("finish_fdc() finished\n"));
}
......@@ -1519,10 +1514,10 @@ void do_fd_request(request_queue_t * q)
stdma_lock(floppy_irq, NULL);
atari_disable_irq( IRQ_MFP_FDC );
save_flags(flags); /* The request function is called with ints
sti(); * disabled... so must save the IPL for later */
local_save_flags(flags); /* The request function is called with ints
local_irq_disable(); * disabled... so must save the IPL for later */
redo_fd_request();
restore_flags(flags);
local_irq_restore(flags);
atari_enable_irq( IRQ_MFP_FDC );
}
......
......@@ -209,17 +209,16 @@ static void swimiop_init_request(struct swim_iop_req *req)
static int swimiop_send_request(struct swim_iop_req *req)
{
unsigned long cpu_flags;
unsigned long flags;
int err;
/* It's doubtful an interrupt routine would try to send */
/* a SWIM request, but I'd rather play it safe here. */
save_flags(cpu_flags);
cli();
local_irq_save(flags);
if (current_req != NULL) {
restore_flags(cpu_flags);
local_irq_restore(flags);
return -ENOMEM;
}
......@@ -227,7 +226,7 @@ static int swimiop_send_request(struct swim_iop_req *req)
/* Interrupts should be back on for iop_send_message() */
restore_flags(cpu_flags);
local_irq_restore(flags);
err = iop_send_message(SWIM_IOP, SWIM_CHAN, (void *) req,
sizeof(req->command), (__u8 *) &req->command[0],
......@@ -423,14 +422,13 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
{
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
if (fs->state != idle) {
++fs->wanted;
while (fs->state != available) {
if (interruptible && signal_pending(current)) {
--fs->wanted;
restore_flags(flags);
local_irq_restore(flags);
return -EINTR;
}
interruptible_sleep_on(&fs->wait);
......@@ -438,7 +436,7 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
--fs->wanted;
}
fs->state = state;
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......@@ -446,11 +444,10 @@ static void release_drive(struct floppy_state *fs)
{
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
fs->state = idle;
start_request(fs);
restore_flags(flags);
local_irq_restore(flags);
}
static void set_timeout(struct floppy_state *fs, int nticks,
......@@ -458,7 +455,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
{
unsigned long flags;
save_flags(flags); cli();
local_irq_save(flags);
if (fs->timeout_pending)
del_timer(&fs->timeout);
init_timer(&fs->timeout);
......@@ -467,7 +464,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
fs->timeout.data = (unsigned long) fs;
add_timer(&fs->timeout);
fs->timeout_pending = 1;
restore_flags(flags);
local_irq_restore(flags);
}
static void do_fd_request(request_queue_t * q)
......
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