aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/floppy.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index dae637abeec3..3072003d81ca 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -686,9 +686,8 @@ static void __reschedule_timeout(int drive, const char *message, int marg)
686 } else 686 } else
687 fd_timeout.expires = jiffies + UDP->timeout; 687 fd_timeout.expires = jiffies + UDP->timeout;
688 add_timer(&fd_timeout); 688 add_timer(&fd_timeout);
689 if (UDP->flags & FD_DEBUG) { 689 if (UDP->flags & FD_DEBUG)
690 DPRINT("reschedule timeout %s %d\n", message, marg); 690 DPRINT("reschedule timeout %s %d\n", message, marg);
691 }
692 timeout_message = message; 691 timeout_message = message;
693} 692}
694 693
@@ -809,9 +808,8 @@ static int set_dor(int fdc, char mask, char data)
809 if (is_selected(olddor, unit) && !is_selected(newdor, unit)) { 808 if (is_selected(olddor, unit) && !is_selected(newdor, unit)) {
810 drive = REVDRIVE(fdc, unit); 809 drive = REVDRIVE(fdc, unit);
811#ifdef DCL_DEBUG 810#ifdef DCL_DEBUG
812 if (UDP->flags & FD_DEBUG) { 811 if (UDP->flags & FD_DEBUG)
813 DPRINT("calling disk change from set_dor\n"); 812 DPRINT("calling disk change from set_dor\n");
814 }
815#endif 813#endif
816 disk_change(drive); 814 disk_change(drive);
817 } 815 }
@@ -1030,9 +1028,8 @@ static void cancel_activity(void)
1030static void fd_watchdog(void) 1028static void fd_watchdog(void)
1031{ 1029{
1032#ifdef DCL_DEBUG 1030#ifdef DCL_DEBUG
1033 if (DP->flags & FD_DEBUG) { 1031 if (DP->flags & FD_DEBUG)
1034 DPRINT("calling disk change from watchdog\n"); 1032 DPRINT("calling disk change from watchdog\n");
1035 }
1036#endif 1033#endif
1037 1034
1038 if (disk_change(current_drive)) { 1035 if (disk_change(current_drive)) {
@@ -1369,9 +1366,9 @@ static void fdc_specify(void)
1369 1366
1370 /* Convert step rate from microseconds to milliseconds and 4 bits */ 1367 /* Convert step rate from microseconds to milliseconds and 4 bits */
1371 srt = 16 - DIV_ROUND_UP(DP->srt * scale_dtr / 1000, NOMINAL_DTR); 1368 srt = 16 - DIV_ROUND_UP(DP->srt * scale_dtr / 1000, NOMINAL_DTR);
1372 if (slow_floppy) { 1369 if (slow_floppy)
1373 srt = srt / 4; 1370 srt = srt / 4;
1374 } 1371
1375 SUPBOUND(srt, 0xf); 1372 SUPBOUND(srt, 0xf);
1376 INFBOUND(srt, 0); 1373 INFBOUND(srt, 0);
1377 1374
@@ -1635,9 +1632,8 @@ static void seek_floppy(void)
1635 blind_seek = 0; 1632 blind_seek = 0;
1636 1633
1637#ifdef DCL_DEBUG 1634#ifdef DCL_DEBUG
1638 if (DP->flags & FD_DEBUG) { 1635 if (DP->flags & FD_DEBUG)
1639 DPRINT("calling disk change from seek\n"); 1636 DPRINT("calling disk change from seek\n");
1640 }
1641#endif 1637#endif
1642 1638
1643 if (!TESTF(FD_DISK_NEWCHANGE) && 1639 if (!TESTF(FD_DISK_NEWCHANGE) &&
@@ -1969,9 +1965,8 @@ static void floppy_ready(void)
1969 return; 1965 return;
1970 1966
1971#ifdef DCL_DEBUG 1967#ifdef DCL_DEBUG
1972 if (DP->flags & FD_DEBUG) { 1968 if (DP->flags & FD_DEBUG)
1973 DPRINT("calling disk change from floppy_ready\n"); 1969 DPRINT("calling disk change from floppy_ready\n");
1974 }
1975#endif 1970#endif
1976 if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) && 1971 if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) &&
1977 disk_change(current_drive) && !DP->select_delay) 1972 disk_change(current_drive) && !DP->select_delay)
@@ -2004,9 +1999,8 @@ static void floppy_start(void)
2004 1999
2005 scandrives(); 2000 scandrives();
2006#ifdef DCL_DEBUG 2001#ifdef DCL_DEBUG
2007 if (DP->flags & FD_DEBUG) { 2002 if (DP->flags & FD_DEBUG)
2008 DPRINT("setting NEWCHANGE in floppy_start\n"); 2003 DPRINT("setting NEWCHANGE in floppy_start\n");
2009 }
2010#endif 2004#endif
2011 SETF(FD_DISK_NEWCHANGE); 2005 SETF(FD_DISK_NEWCHANGE);
2012 floppy_ready(); 2006 floppy_ready();
@@ -2758,9 +2752,8 @@ static int make_raw_rw_request(void)
2758 dma_limit = 2752 dma_limit =
2759 (MAX_DMA_ADDRESS - 2753 (MAX_DMA_ADDRESS -
2760 ((unsigned long)current_req->buffer)) >> 9; 2754 ((unsigned long)current_req->buffer)) >> 9;
2761 if ((unsigned long)max_size > dma_limit) { 2755 if ((unsigned long)max_size > dma_limit)
2762 max_size = dma_limit; 2756 max_size = dma_limit;
2763 }
2764 /* 64 kb boundaries */ 2757 /* 64 kb boundaries */
2765 if (CROSS_64KB(current_req->buffer, max_size << 9)) 2758 if (CROSS_64KB(current_req->buffer, max_size << 9))
2766 max_size = (K_64 - 2759 max_size = (K_64 -
@@ -3026,9 +3019,8 @@ static int poll_drive(int interruptible, int flag)
3026 raw_cmd->cmd_count = 0; 3019 raw_cmd->cmd_count = 0;
3027 cont = &poll_cont; 3020 cont = &poll_cont;
3028#ifdef DCL_DEBUG 3021#ifdef DCL_DEBUG
3029 if (DP->flags & FD_DEBUG) { 3022 if (DP->flags & FD_DEBUG)
3030 DPRINT("setting NEWCHANGE in poll_drive\n"); 3023 DPRINT("setting NEWCHANGE in poll_drive\n");
3031 }
3032#endif 3024#endif
3033 SETF(FD_DISK_NEWCHANGE); 3025 SETF(FD_DISK_NEWCHANGE);
3034 WAIT(floppy_ready); 3026 WAIT(floppy_ready);
@@ -3291,9 +3283,8 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
3291 cont = &raw_cmd_cont; 3283 cont = &raw_cmd_cont;
3292 ret = wait_til_done(floppy_start, 1); 3284 ret = wait_til_done(floppy_start, 1);
3293#ifdef DCL_DEBUG 3285#ifdef DCL_DEBUG
3294 if (DP->flags & FD_DEBUG) { 3286 if (DP->flags & FD_DEBUG)
3295 DPRINT("calling disk change from raw_cmd ioctl\n"); 3287 DPRINT("calling disk change from raw_cmd ioctl\n");
3296 }
3297#endif 3288#endif
3298 3289
3299 if (ret != -EINTR && FDCS->reset) 3290 if (ret != -EINTR && FDCS->reset)
@@ -3486,18 +3477,18 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3486 * We do this in order to provide a means to eject floppy disks before 3477 * We do this in order to provide a means to eject floppy disks before
3487 * installing the new fdutils package */ 3478 * installing the new fdutils package */
3488 if (cmd == CDROMEJECT || /* CD-ROM eject */ 3479 if (cmd == CDROMEJECT || /* CD-ROM eject */
3489 cmd == 0x6470 /* SunOS floppy eject */ ) { 3480 cmd == 0x6470) { /* SunOS floppy eject */
3490 DPRINT("obsolete eject ioctl\n"); 3481 DPRINT("obsolete eject ioctl\n");
3491 DPRINT("please use floppycontrol --eject\n"); 3482 DPRINT("please use floppycontrol --eject\n");
3492 cmd = FDEJECT; 3483 cmd = FDEJECT;
3493 } 3484 }
3494 3485
3495 /* convert the old style command into a new style command */ 3486 if (!((cmd & 0xff00) == 0x0200))
3496 if ((cmd & 0xff00) == 0x0200) {
3497 ECALL(normalize_ioctl(&cmd, &size));
3498 } else
3499 return -EINVAL; 3487 return -EINVAL;
3500 3488
3489 /* convert the old style command into a new style command */
3490 ECALL(normalize_ioctl(&cmd, &size));
3491
3501 /* permission checks */ 3492 /* permission checks */
3502 if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) || 3493 if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) ||
3503 ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))) 3494 ((cmd & 0x80) && !capable(CAP_SYS_ADMIN)))
@@ -3746,9 +3737,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
3746 INFBOUND(try, 16); 3737 INFBOUND(try, 16);
3747 tmp = (char *)fd_dma_mem_alloc(1024 * try); 3738 tmp = (char *)fd_dma_mem_alloc(1024 * try);
3748 } 3739 }
3749 if (!tmp && !floppy_track_buffer) { 3740 if (!tmp && !floppy_track_buffer)
3750 fallback_on_nodma_alloc(&tmp, 2048 * try); 3741 fallback_on_nodma_alloc(&tmp, 2048 * try);
3751 }
3752 if (!tmp && !floppy_track_buffer) { 3742 if (!tmp && !floppy_track_buffer) {
3753 DPRINT("Unable to allocate DMA memory\n"); 3743 DPRINT("Unable to allocate DMA memory\n");
3754 goto out; 3744 goto out;