X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fftape%2Flowlevel%2Ffdc-io.c;h=093fdf98b19a999dddc9b8ebe1dfe87dd4a2ad15;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=3b78eda30b1951bf6b8653513b1a9e197e597473;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c index 3b78eda30..093fdf98b 100644 --- a/drivers/char/ftape/lowlevel/fdc-io.c +++ b/drivers/char/ftape/lowlevel/fdc-io.c @@ -50,7 +50,7 @@ /* Global vars. */ -int ftape_motor; +static int ftape_motor; volatile int ftape_current_cylinder = -1; volatile fdc_mode_enum fdc_mode = fdc_idle; fdc_config_info fdc; @@ -86,6 +86,8 @@ static __u8 fdc_prec_code; /* fdc precomp. select code */ static char ftape_id[] = "ftape"; /* used by request irq and free irq */ +static int fdc_set_seek_rate(int seek_rate); + void fdc_catch_stray_interrupts(int count) { unsigned long flags; @@ -103,7 +105,7 @@ void fdc_catch_stray_interrupts(int count) * If usecs == 0 then just test status, else wait at least for usecs. * Returns -ETIME on timeout. Function must be calibrated first ! */ -int fdc_wait(unsigned int usecs, __u8 mask, __u8 state) +static int fdc_wait(unsigned int usecs, __u8 mask, __u8 state) { int count_1 = (fdc_calibr_count * usecs + fdc_calibr_count - 1) / fdc_calibr_time; @@ -129,18 +131,12 @@ static void fdc_usec_wait(unsigned int usecs) fdc_wait(usecs, 0, 1); /* will always timeout ! */ } -int fdc_ready_out_wait(unsigned int usecs) +static int fdc_ready_out_wait(unsigned int usecs) { fdc_usec_wait(FT_RQM_DELAY); /* wait for valid RQM status */ return fdc_wait(usecs, FDC_DATA_OUT_READY, FDC_DATA_OUT_READY); } -int fdc_ready_in_wait(unsigned int usecs) -{ - fdc_usec_wait(FT_RQM_DELAY); /* wait for valid RQM status */ - return fdc_wait(usecs, FDC_DATA_OUT_READY, FDC_DATA_IN_READY); -} - void fdc_wait_calibrate(void) { ftape_calibrate("fdc_wait", @@ -341,7 +337,7 @@ int fdc_result(__u8 * res_data, int res_len) /* Handle command and result phases for * commands without data phase. */ -int fdc_issue_command(const __u8 * out_data, int out_count, +static int fdc_issue_command(const __u8 * out_data, int out_count, __u8 * in_data, int in_count) { TRACE_FUN(ft_t_any); @@ -389,11 +385,10 @@ int fdc_interrupt_wait(unsigned int time) recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&ftape_wait_intr, &wait); - while (!ft_interrupt_seen && (current->state == TASK_INTERRUPTIBLE)) { - timeout = schedule_timeout(timeout); - } + while (!ft_interrupt_seen && timeout) + timeout = schedule_timeout_interruptible(timeout); spin_lock_irq(¤t->sighand->siglock); current->blocked = old_sigmask; @@ -497,7 +492,7 @@ void fdc_set_write_precomp(int precomp) /* Reprogram the 82078 registers to use Data Rate Table 1 on all drives. */ -void fdc_set_drive_specs(void) +static void fdc_set_drive_specs(void) { __u8 cmd[] = { FDC_DRIVE_SPEC, 0x00, 0x00, 0x00, 0x00, 0xc0}; int result; @@ -612,7 +607,7 @@ void fdc_reset(void) fdc_mode = fdc_idle; - /* maybe the cli()/sti() pair is not necessary, BUT: + /* maybe the spin_lock_irq* pair is not necessary, BUT: * the following line MUST be here. Otherwise fdc_interrupt_wait() * won't wait. Note that fdc_reset() is called from * ftape_dumb_stop() when the fdc is busy transferring data. In this @@ -705,7 +700,7 @@ void fdc_disable(void) /* Specify FDC seek-rate (milliseconds) */ -int fdc_set_seek_rate(int seek_rate) +static int fdc_set_seek_rate(int seek_rate) { /* set step rate, dma mode, and minimal head load and unload times */ @@ -803,49 +798,6 @@ int fdc_seek(int track) TRACE_EXIT 0; } -/* Recalibrate and wait until home. - */ -int fdc_recalibrate(void) -{ - __u8 out[2]; - int st0; - int pcn; - int retry; - int old_seek_rate = fdc_seek_rate; - TRACE_FUN(ft_t_any); - - TRACE_CATCH(fdc_set_seek_rate(6),); - out[0] = FDC_RECAL; - out[1] = ft_drive_sel; - ft_seek_completed = 0; - TRACE_CATCH(fdc_command(out, 2),); - /* Handle interrupts until ft_seek_completed or timeout. - */ - for (retry = 0;; ++retry) { - TRACE_CATCH(fdc_interrupt_wait(2 * FT_SECOND),); - if (ft_seek_completed) { - TRACE_CATCH(fdc_sense_interrupt_status(&st0, &pcn),); - if ((st0 & ST0_SEEK_END) == 0) { - if (retry < 1) { - continue; /* some drives/fdc's - * give an extra interrupt - */ - } else { - TRACE_ABORT(-EIO, ft_t_err, - "no seek-end after seek completion !??"); - } - } - break; - } - } - ftape_current_cylinder = pcn; - if (pcn != 0) { - TRACE(ft_t_err, "failed: resulting track = %d", pcn); - } - TRACE_CATCH(fdc_set_seek_rate(old_seek_rate),); - TRACE_EXIT 0; -} - static int perpend_mode; /* set if fdc is in perpendicular mode */ static int perpend_off(void) @@ -1079,7 +1031,7 @@ static int fdc_fifo_enable(void) */ static __u8 fdc_save_state[2]; -int fdc_probe(void) +static int fdc_probe(void) { __u8 cmd[1]; __u8 stat[16]; /* must be able to hold dumpregs & save results */ @@ -1308,7 +1260,7 @@ static irqreturn_t ftape_interrupt(int irq, void *dev_id, struct pt_regs *regs) TRACE_EXIT IRQ_RETVAL(handled); } -int fdc_grab_irq_and_dma(void) +static int fdc_grab_irq_and_dma(void) { TRACE_FUN(ft_t_any);